diff --git a/tests/unit/base/test_version.py b/tests/unit/base/test_version.py index 94c0ad496..731b78b76 100644 --- a/tests/unit/base/test_version.py +++ b/tests/unit/base/test_version.py @@ -811,10 +811,12 @@ async def test_fetch_with_response_info_async(self): ), Request(url="https://api.twilio.com/2010-04-01/Accounts/AC123.json"), ) - payload, status_code, headers = ( - await self.client.api.v2010.fetch_with_response_info_async( - method="GET", uri="/Accounts/AC123.json" - ) + ( + payload, + status_code, + headers, + ) = await self.client.api.v2010.fetch_with_response_info_async( + method="GET", uri="/Accounts/AC123.json" ) self.assertEqual(payload["sid"], "AC123") @@ -836,12 +838,14 @@ async def test_update_with_response_info_async(self): url="https://api.twilio.com/2010-04-01/Accounts/AC123.json", ), ) - payload, status_code, headers = ( - await self.client.api.v2010.update_with_response_info_async( - method="POST", - uri="/Accounts/AC123.json", - data={"name": "Updated Account"}, - ) + ( + payload, + status_code, + headers, + ) = await self.client.api.v2010.update_with_response_info_async( + method="POST", + uri="/Accounts/AC123.json", + data={"name": "Updated Account"}, ) self.assertEqual(payload["sid"], "AC123") @@ -858,10 +862,12 @@ async def test_delete_with_response_info_async(self): url="https://api.twilio.com/2010-04-01/Accounts/AC123/Messages/MM123.json", ), ) - success, status_code, headers = ( - await self.client.api.v2010.delete_with_response_info_async( - method="DELETE", uri="/Accounts/AC123/Messages/MM123.json" - ) + ( + success, + status_code, + headers, + ) = await self.client.api.v2010.delete_with_response_info_async( + method="DELETE", uri="/Accounts/AC123/Messages/MM123.json" ) self.assertTrue(success) @@ -881,12 +887,14 @@ async def test_create_with_response_info_async(self): url="https://api.twilio.com/2010-04-01/Accounts/AC123/Messages.json", ), ) - payload, status_code, headers = ( - await self.client.api.v2010.create_with_response_info_async( - method="POST", - uri="/Accounts/AC123/Messages.json", - data={"body": "Hello World"}, - ) + ( + payload, + status_code, + headers, + ) = await self.client.api.v2010.create_with_response_info_async( + method="POST", + uri="/Accounts/AC123/Messages.json", + data={"body": "Hello World"}, ) self.assertEqual(payload["sid"], "MM123") @@ -906,10 +914,12 @@ async def test_page_with_response_info_async(self): url="https://api.twilio.com/2010-04-01/Accounts/AC123/Messages.json" ), ) - response, status_code, headers = ( - await self.client.api.v2010.page_with_response_info_async( - method="GET", uri="/Accounts/AC123/Messages.json" - ) + ( + response, + status_code, + headers, + ) = await self.client.api.v2010.page_with_response_info_async( + method="GET", uri="/Accounts/AC123/Messages.json" ) self.assertIsNotNone(response) @@ -989,10 +999,12 @@ async def test_fetch_with_response_info_async_empty_headers(self): Response(200, '{"sid": "AC123", "name": "Test Account"}', None), Request(url="https://api.twilio.com/2010-04-01/Accounts/AC123.json"), ) - payload, status_code, headers = ( - await self.client.api.v2010.fetch_with_response_info_async( - method="GET", uri="/Accounts/AC123.json" - ) + ( + payload, + status_code, + headers, + ) = await self.client.api.v2010.fetch_with_response_info_async( + method="GET", uri="/Accounts/AC123.json" ) self.assertEqual(payload["sid"], "AC123") @@ -1014,10 +1026,12 @@ async def test_fetch_with_response_info_async_multiple_headers(self): ), Request(url="https://api.twilio.com/2010-04-01/Accounts/AC123.json"), ) - payload, status_code, headers = ( - await self.client.api.v2010.fetch_with_response_info_async( - method="GET", uri="/Accounts/AC123.json" - ) + ( + payload, + status_code, + headers, + ) = await self.client.api.v2010.fetch_with_response_info_async( + method="GET", uri="/Accounts/AC123.json" ) self.assertEqual(status_code, 200) diff --git a/tests/unit/http/test_http_client.py b/tests/unit/http/test_http_client.py index 9a74139d4..9ee28bfa0 100644 --- a/tests/unit/http/test_http_client.py +++ b/tests/unit/http/test_http_client.py @@ -296,7 +296,6 @@ def test_session_not_preserved(self): class TestTwilioRequest(unittest.TestCase): def test_str(self): - req = Request( method="POST", url="https://api.twilio.com/2010-04-01/Accounts.json", diff --git a/twilio/base/client_base.py b/twilio/base/client_base.py index af5ccdb09..42b1bd50a 100644 --- a/twilio/base/client_base.py +++ b/twilio/base/client_base.py @@ -90,7 +90,6 @@ def request( headers = self.get_headers(method, headers) if self.credential_provider: - auth_strategy = self.credential_provider.to_auth_strategy() headers["Authorization"] = auth_strategy.get_auth_string() elif self.username is not None and self.password is not None: diff --git a/twilio/http/token_manager.py b/twilio/http/token_manager.py index 28cc73101..54db346ac 100644 --- a/twilio/http/token_manager.py +++ b/twilio/http/token_manager.py @@ -2,6 +2,5 @@ class TokenManager: - def fetch_access_token(self, version: Version): pass diff --git a/twilio/rest/__init__.py b/twilio/rest/__init__.py index f0594570e..26dfbc1c0 100644 --- a/twilio/rest/__init__.py +++ b/twilio/rest/__init__.py @@ -33,6 +33,7 @@ from twilio.rest.knowledge import Knowledge from twilio.rest.lookups import Lookups from twilio.rest.marketplace import Marketplace + from twilio.rest.memory import Memory from twilio.rest.messaging import Messaging from twilio.rest.monitor import Monitor from twilio.rest.notify import Notify @@ -147,6 +148,7 @@ def __init__( self._knowledge: Optional["Knowledge"] = None self._lookups: Optional["Lookups"] = None self._marketplace: Optional["Marketplace"] = None + self._memory: Optional["Memory"] = None self._messaging: Optional["Messaging"] = None self._monitor: Optional["Monitor"] = None self._notify: Optional["Notify"] = None @@ -428,6 +430,19 @@ def messaging(self) -> "Messaging": self._messaging = Messaging(self) return self._messaging + @property + def memory(self) -> "Memory": + """ + Access the Messaging Twilio Domain + + :returns: Messaging Twilio Domain + """ + if self._memory is None: + from twilio.rest.memory import Memory + + self._memory = Memory(self) + return self._memory + @property def monitor(self) -> "Monitor": """ diff --git a/twilio/rest/accounts/AccountsBase.py b/twilio/rest/accounts/AccountsBase.py index e9ac0d589..a89be8416 100644 --- a/twilio/rest/accounts/AccountsBase.py +++ b/twilio/rest/accounts/AccountsBase.py @@ -17,7 +17,6 @@ class AccountsBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Accounts Domain diff --git a/twilio/rest/accounts/v1/__init__.py b/twilio/rest/accounts/v1/__init__.py index 8be121c71..ea8e28221 100644 --- a/twilio/rest/accounts/v1/__init__.py +++ b/twilio/rest/accounts/v1/__init__.py @@ -25,7 +25,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Accounts diff --git a/twilio/rest/accounts/v1/auth_token_promotion.py b/twilio/rest/accounts/v1/auth_token_promotion.py index c60ea48ba..68b90a293 100644 --- a/twilio/rest/accounts/v1/auth_token_promotion.py +++ b/twilio/rest/accounts/v1/auth_token_promotion.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional from twilio.base import deserialize, values @@ -23,6 +24,7 @@ class AuthTokenPromotionInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the secondary Auth Token was created for. :ivar auth_token: The promoted Auth Token that must be used to authenticate future API requests. @@ -107,7 +109,6 @@ def __repr__(self) -> str: class AuthTokenPromotionContext(InstanceContext): - def __init__(self, version: Version): """ Initialize the AuthTokenPromotionContext @@ -205,7 +206,6 @@ def __repr__(self) -> str: class AuthTokenPromotionList(ListResource): - def __init__(self, version: Version): """ Initialize the AuthTokenPromotionList diff --git a/twilio/rest/accounts/v1/bulk_consents.py b/twilio/rest/accounts/v1/bulk_consents.py index 423b8ed7e..613bdb1e1 100644 --- a/twilio/rest/accounts/v1/bulk_consents.py +++ b/twilio/rest/accounts/v1/bulk_consents.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class BulkConsentsInstance(InstanceResource): + """ :ivar items: A list of objects where each object represents the result of processing a `correlation_id`. Each object contains the following fields: `correlation_id`, a unique 32-character UUID that maps the response to the original request; `error_code`, an integer where 0 indicates success and any non-zero value represents an error; and `error_messages`, an array of strings describing specific validation errors encountered. If the request is successful, the error_messages array will be empty. """ @@ -42,7 +44,6 @@ def __repr__(self) -> str: class BulkConsentsList(ListResource): - def __init__(self, version: Version): """ Initialize the BulkConsentsList diff --git a/twilio/rest/accounts/v1/bulk_contacts.py b/twilio/rest/accounts/v1/bulk_contacts.py index 4ede446a9..1e404f256 100644 --- a/twilio/rest/accounts/v1/bulk_contacts.py +++ b/twilio/rest/accounts/v1/bulk_contacts.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class BulkContactsInstance(InstanceResource): + """ :ivar items: A list of objects where each object represents the result of processing a `correlation_id`. Each object contains the following fields: `correlation_id`, a unique 32-character UUID that maps the response to the original request; `error_code`, an integer where 0 indicates success and any non-zero value represents an error; and `error_messages`, an array of strings describing specific validation errors encountered. If the request is successful, the error_messages array will be empty. """ @@ -42,7 +44,6 @@ def __repr__(self) -> str: class BulkContactsList(ListResource): - def __init__(self, version: Version): """ Initialize the BulkContactsList diff --git a/twilio/rest/accounts/v1/credential/__init__.py b/twilio/rest/accounts/v1/credential/__init__.py index e9c4653f0..d76ce584f 100644 --- a/twilio/rest/accounts/v1/credential/__init__.py +++ b/twilio/rest/accounts/v1/credential/__init__.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Optional @@ -23,7 +24,6 @@ class CredentialList(ListResource): - def __init__(self, version: Version): """ Initialize the CredentialList diff --git a/twilio/rest/accounts/v1/credential/aws.py b/twilio/rest/accounts/v1/credential/aws.py index 65223b7e8..f9cede425 100644 --- a/twilio/rest/accounts/v1/credential/aws.py +++ b/twilio/rest/accounts/v1/credential/aws.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class AwsInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the AWS resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AWS resource. @@ -206,7 +208,6 @@ def __repr__(self) -> str: class AwsContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the AwsContext @@ -493,7 +494,6 @@ def __repr__(self) -> str: class AwsPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> AwsInstance: """ Build an instance of AwsInstance @@ -512,7 +512,6 @@ def __repr__(self) -> str: class AwsList(ListResource): - def __init__(self, version: Version): """ Initialize the AwsList @@ -1005,10 +1004,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AwsPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/accounts/v1/credential/public_key.py b/twilio/rest/accounts/v1/credential/public_key.py index 392bba092..30951cbe9 100644 --- a/twilio/rest/accounts/v1/credential/public_key.py +++ b/twilio/rest/accounts/v1/credential/public_key.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class PublicKeyInstance(InstanceResource): + """ :ivar sid: The unique string that that we created to identify the PublicKey resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Credential that the PublicKey resource belongs to. @@ -208,7 +210,6 @@ def __repr__(self) -> str: class PublicKeyContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the PublicKeyContext @@ -497,7 +498,6 @@ def __repr__(self) -> str: class PublicKeyPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> PublicKeyInstance: """ Build an instance of PublicKeyInstance @@ -516,7 +516,6 @@ def __repr__(self) -> str: class PublicKeyList(ListResource): - def __init__(self, version: Version): """ Initialize the PublicKeyList @@ -1001,10 +1000,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = PublicKeyPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/accounts/v1/messaging_geopermissions.py b/twilio/rest/accounts/v1/messaging_geopermissions.py index 0d077f885..497fb18cd 100644 --- a/twilio/rest/accounts/v1/messaging_geopermissions.py +++ b/twilio/rest/accounts/v1/messaging_geopermissions.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class MessagingGeopermissionsInstance(InstanceResource): + """ :ivar permissions: A list of objects where each object represents the result of processing a messaging Geo Permission. Each object contains the following fields: `country_code`, the country code of the country for which the permission was updated; `type`, the type of the permission i.e. country; `enabled`, true if the permission is enabled else false; `error_code`, an integer where 0 indicates success and any non-zero value represents an error; and `error_messages`, an array of strings describing specific validation errors encountered. If the request is successful, the error_messages array will be empty. """ @@ -42,7 +44,6 @@ def __repr__(self) -> str: class MessagingGeopermissionsList(ListResource): - def __init__(self, version: Version): """ Initialize the MessagingGeopermissionsList diff --git a/twilio/rest/accounts/v1/safelist.py b/twilio/rest/accounts/v1/safelist.py index f7e7912dd..e75b1e4ef 100644 --- a/twilio/rest/accounts/v1/safelist.py +++ b/twilio/rest/accounts/v1/safelist.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class SafelistInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the SafeList resource. :ivar phone_number: The phone number or phone number 1k prefix in SafeList. @@ -44,7 +46,6 @@ def __repr__(self) -> str: class SafelistList(ListResource): - def __init__(self, version: Version): """ Initialize the SafelistList diff --git a/twilio/rest/accounts/v1/secondary_auth_token.py b/twilio/rest/accounts/v1/secondary_auth_token.py index 9d79a739d..3a4c35e54 100644 --- a/twilio/rest/accounts/v1/secondary_auth_token.py +++ b/twilio/rest/accounts/v1/secondary_auth_token.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional from twilio.base import deserialize, values @@ -23,6 +24,7 @@ class SecondaryAuthTokenInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the secondary Auth Token was created for. :ivar date_created: The date and time in UTC when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. @@ -143,7 +145,6 @@ def __repr__(self) -> str: class SecondaryAuthTokenContext(InstanceContext): - def __init__(self, version: Version): """ Initialize the SecondaryAuthTokenContext @@ -309,7 +310,6 @@ def __repr__(self) -> str: class SecondaryAuthTokenList(ListResource): - def __init__(self, version: Version): """ Initialize the SecondaryAuthTokenList diff --git a/twilio/rest/api/ApiBase.py b/twilio/rest/api/ApiBase.py index e53535ab3..417bc0d0d 100644 --- a/twilio/rest/api/ApiBase.py +++ b/twilio/rest/api/ApiBase.py @@ -17,7 +17,6 @@ class ApiBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Api Domain diff --git a/twilio/rest/api/v2010/__init__.py b/twilio/rest/api/v2010/__init__.py index 2efb4ff3d..0a1c838cb 100644 --- a/twilio/rest/api/v2010/__init__.py +++ b/twilio/rest/api/v2010/__init__.py @@ -16,11 +16,15 @@ from twilio.base.version import Version from twilio.base.domain import Domain from twilio.rest.api.v2010.account import AccountList +from twilio.rest.api.v2010.sms_feedback import SmsFeedbackList +from twilio.rest.api.v2010.twiml_session import TwimlSessionList +from twilio.rest.api.v2010.usage_record_time_parameterized import ( + UsageRecordTimeParameterizedList, +) from twilio.rest.api.v2010.account import AccountContext class V2010(Version): - def __init__(self, domain: Domain): """ Initialize the V2010 version of Api @@ -29,6 +33,11 @@ def __init__(self, domain: Domain): """ super().__init__(domain, "2010-04-01") self._accounts: Optional[AccountList] = None + self._sms_feedback: Optional[SmsFeedbackList] = None + self._twiml_sessions: Optional[TwimlSessionList] = None + self._usage_record_time_parameterized: Optional[ + UsageRecordTimeParameterizedList + ] = None self._account: Optional[AccountContext] = None @property @@ -37,6 +46,26 @@ def accounts(self) -> AccountList: self._accounts = AccountList(self) return self._accounts + @property + def sms_feedback(self) -> SmsFeedbackList: + if self._sms_feedback is None: + self._sms_feedback = SmsFeedbackList(self) + return self._sms_feedback + + @property + def twiml_sessions(self) -> TwimlSessionList: + if self._twiml_sessions is None: + self._twiml_sessions = TwimlSessionList(self) + return self._twiml_sessions + + @property + def usage_record_time_parameterized(self) -> UsageRecordTimeParameterizedList: + if self._usage_record_time_parameterized is None: + self._usage_record_time_parameterized = UsageRecordTimeParameterizedList( + self + ) + return self._usage_record_time_parameterized + @property def account(self) -> AccountContext: if self._account is None: diff --git a/twilio/rest/api/v2010/account/__init__.py b/twilio/rest/api/v2010/account/__init__.py index f959fbb59..b530af8e9 100644 --- a/twilio/rest/api/v2010/account/__init__.py +++ b/twilio/rest/api/v2010/account/__init__.py @@ -12,6 +12,7 @@ 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 @@ -52,7 +53,6 @@ class AccountInstance(InstanceResource): - class Status(object): ACTIVE = "active" SUSPENDED = "suspended" @@ -404,7 +404,6 @@ def __repr__(self) -> str: class AccountContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the AccountContext @@ -962,7 +961,6 @@ def __repr__(self) -> str: class AccountPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> AccountInstance: """ Build an instance of AccountInstance @@ -981,7 +979,6 @@ def __repr__(self) -> str: class AccountList(ListResource): - def __init__(self, version: Version): """ Initialize the AccountList @@ -1498,10 +1495,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AccountPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/address/__init__.py b/twilio/rest/api/v2010/account/address/__init__.py index dd8088363..a47ed8245 100644 --- a/twilio/rest/api/v2010/account/address/__init__.py +++ b/twilio/rest/api/v2010/account/address/__init__.py @@ -12,6 +12,7 @@ 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 @@ -27,6 +28,7 @@ class AddressInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that is responsible for the Address resource. :ivar city: The city in which the address is located. @@ -344,7 +346,6 @@ def __repr__(self) -> str: class AddressContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the AddressContext @@ -818,7 +819,6 @@ def __repr__(self) -> str: class AddressPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> AddressInstance: """ Build an instance of AddressInstance @@ -839,7 +839,6 @@ def __repr__(self) -> str: class AddressList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the AddressList @@ -1607,10 +1606,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AddressPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/address/dependent_phone_number.py b/twilio/rest/api/v2010/account/address/dependent_phone_number.py index b869001d6..fb39d6a18 100644 --- a/twilio/rest/api/v2010/account/address/dependent_phone_number.py +++ b/twilio/rest/api/v2010/account/address/dependent_phone_number.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class DependentPhoneNumberInstance(InstanceResource): - class AddressRequirement(object): NONE = "none" ANY = "any" @@ -128,7 +128,6 @@ def __repr__(self) -> str: class DependentPhoneNumberPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> DependentPhoneNumberInstance: """ Build an instance of DependentPhoneNumberInstance @@ -152,7 +151,6 @@ def __repr__(self) -> str: class DependentPhoneNumberList(ListResource): - def __init__(self, version: Version, account_sid: str, address_sid: str): """ Initialize the DependentPhoneNumberList @@ -504,10 +502,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = DependentPhoneNumberPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/application.py b/twilio/rest/api/v2010/account/application.py index e56436798..b64c0208f 100644 --- a/twilio/rest/api/v2010/account/application.py +++ b/twilio/rest/api/v2010/account/application.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class ApplicationInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Application resource. :ivar api_version: The API version used to start a new TwiML session. @@ -436,7 +438,6 @@ def __repr__(self) -> str: class ApplicationContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the ApplicationContext @@ -1015,7 +1016,6 @@ def __repr__(self) -> str: class ApplicationPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ApplicationInstance: """ Build an instance of ApplicationInstance @@ -1036,7 +1036,6 @@ def __repr__(self) -> str: class ApplicationList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the ApplicationList @@ -1794,10 +1793,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ApplicationPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/authorized_connect_app.py b/twilio/rest/api/v2010/account/authorized_connect_app.py index bcce7dce7..cceefa30b 100644 --- a/twilio/rest/api/v2010/account/authorized_connect_app.py +++ b/twilio/rest/api/v2010/account/authorized_connect_app.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,7 +24,6 @@ class AuthorizedConnectAppInstance(InstanceResource): - class Permission(object): GET_ALL = "get-all" POST_ALL = "post-all" @@ -62,9 +62,9 @@ def __init__( "connect_app_homepage_url" ) self.connect_app_sid: Optional[str] = payload.get("connect_app_sid") - self.permissions: Optional[List["AuthorizedConnectAppInstance.Permission"]] = ( - payload.get("permissions") - ) + self.permissions: Optional[ + List["AuthorizedConnectAppInstance.Permission"] + ] = payload.get("permissions") self.uri: Optional[str] = payload.get("uri") self._solution = { @@ -136,7 +136,6 @@ def __repr__(self) -> str: class AuthorizedConnectAppContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, connect_app_sid: str): """ Initialize the AuthorizedConnectAppContext @@ -261,7 +260,6 @@ def __repr__(self) -> str: class AuthorizedConnectAppPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> AuthorizedConnectAppInstance: """ Build an instance of AuthorizedConnectAppInstance @@ -282,7 +280,6 @@ def __repr__(self) -> str: class AuthorizedConnectAppList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the AuthorizedConnectAppList @@ -632,10 +629,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AuthorizedConnectAppPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/__init__.py b/twilio/rest/api/v2010/account/available_phone_number_country/__init__.py index 1d7fbecc1..3892a896d 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/__init__.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/__init__.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -40,6 +41,7 @@ class AvailablePhoneNumberCountryInstance(InstanceResource): + """ :ivar country_code: The [ISO-3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code of the country. :ivar country: The name of the country. @@ -185,7 +187,6 @@ def __repr__(self) -> str: class AvailablePhoneNumberCountryContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, country_code: str): """ Initialize the AvailablePhoneNumberCountryContext @@ -413,7 +414,6 @@ def __repr__(self) -> str: class AvailablePhoneNumberCountryPage(Page): - def get_instance( self, payload: Dict[str, Any] ) -> AvailablePhoneNumberCountryInstance: @@ -436,7 +436,6 @@ def __repr__(self) -> str: class AvailablePhoneNumberCountryList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the AvailablePhoneNumberCountryList @@ -786,10 +785,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AvailablePhoneNumberCountryPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/local.py b/twilio/rest/api/v2010/account/available_phone_number_country/local.py index 696b53855..dd5aebe41 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/local.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/local.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class LocalInstance(InstanceResource): + """ :ivar friendly_name: A formatted version of the phone number. :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. @@ -78,7 +80,6 @@ def __repr__(self) -> str: class LocalPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> LocalInstance: """ Build an instance of LocalInstance @@ -102,7 +103,6 @@ def __repr__(self) -> str: class LocalList(ListResource): - def __init__(self, version: Version, account_sid: str, country_code: str): """ Initialize the LocalList @@ -1132,10 +1132,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = LocalPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/machine_to_machine.py b/twilio/rest/api/v2010/account/available_phone_number_country/machine_to_machine.py index bf9a44977..acaa706b5 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/machine_to_machine.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/machine_to_machine.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class MachineToMachineInstance(InstanceResource): + """ :ivar friendly_name: A formatted version of the phone number. :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. @@ -78,7 +80,6 @@ def __repr__(self) -> str: class MachineToMachinePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> MachineToMachineInstance: """ Build an instance of MachineToMachineInstance @@ -102,7 +103,6 @@ def __repr__(self) -> str: class MachineToMachineList(ListResource): - def __init__(self, version: Version, account_sid: str, country_code: str): """ Initialize the MachineToMachineList @@ -1132,10 +1132,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = MachineToMachinePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/mobile.py b/twilio/rest/api/v2010/account/available_phone_number_country/mobile.py index 9b901c9ce..5bd7715af 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/mobile.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/mobile.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class MobileInstance(InstanceResource): + """ :ivar friendly_name: A formatted version of the phone number. :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. @@ -78,7 +80,6 @@ def __repr__(self) -> str: class MobilePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> MobileInstance: """ Build an instance of MobileInstance @@ -102,7 +103,6 @@ def __repr__(self) -> str: class MobileList(ListResource): - def __init__(self, version: Version, account_sid: str, country_code: str): """ Initialize the MobileList @@ -1132,10 +1132,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = MobilePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/national.py b/twilio/rest/api/v2010/account/available_phone_number_country/national.py index 718873dc3..dc88fedab 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/national.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/national.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class NationalInstance(InstanceResource): + """ :ivar friendly_name: A formatted version of the phone number. :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. @@ -78,7 +80,6 @@ def __repr__(self) -> str: class NationalPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> NationalInstance: """ Build an instance of NationalInstance @@ -102,7 +103,6 @@ def __repr__(self) -> str: class NationalList(ListResource): - def __init__(self, version: Version, account_sid: str, country_code: str): """ Initialize the NationalList @@ -1132,10 +1132,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = NationalPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/shared_cost.py b/twilio/rest/api/v2010/account/available_phone_number_country/shared_cost.py index 8d5910c11..4c84c9ccc 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/shared_cost.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/shared_cost.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class SharedCostInstance(InstanceResource): + """ :ivar friendly_name: A formatted version of the phone number. :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. @@ -78,7 +80,6 @@ def __repr__(self) -> str: class SharedCostPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SharedCostInstance: """ Build an instance of SharedCostInstance @@ -102,7 +103,6 @@ def __repr__(self) -> str: class SharedCostList(ListResource): - def __init__(self, version: Version, account_sid: str, country_code: str): """ Initialize the SharedCostList @@ -1132,10 +1132,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SharedCostPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/toll_free.py b/twilio/rest/api/v2010/account/available_phone_number_country/toll_free.py index de262f771..07088fa1d 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/toll_free.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/toll_free.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class TollFreeInstance(InstanceResource): + """ :ivar friendly_name: A formatted version of the phone number. :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. @@ -78,7 +80,6 @@ def __repr__(self) -> str: class TollFreePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> TollFreeInstance: """ Build an instance of TollFreeInstance @@ -102,7 +103,6 @@ def __repr__(self) -> str: class TollFreeList(ListResource): - def __init__(self, version: Version, account_sid: str, country_code: str): """ Initialize the TollFreeList @@ -1132,10 +1132,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = TollFreePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/voip.py b/twilio/rest/api/v2010/account/available_phone_number_country/voip.py index d67bcc4bd..1aa035f47 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/voip.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/voip.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class VoipInstance(InstanceResource): + """ :ivar friendly_name: A formatted version of the phone number. :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. @@ -78,7 +80,6 @@ def __repr__(self) -> str: class VoipPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> VoipInstance: """ Build an instance of VoipInstance @@ -102,7 +103,6 @@ def __repr__(self) -> str: class VoipList(ListResource): - def __init__(self, version: Version, account_sid: str, country_code: str): """ Initialize the VoipList @@ -1132,10 +1132,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = VoipPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/balance.py b/twilio/rest/api/v2010/account/balance.py index 106e76e33..5c22da75a 100644 --- a/twilio/rest/api/v2010/account/balance.py +++ b/twilio/rest/api/v2010/account/balance.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class BalanceInstance(InstanceResource): + """ :ivar account_sid: The unique SID identifier of the Account. :ivar balance: The balance of the Account, in units specified by the unit parameter. Balance changes may not be reflected immediately. Child accounts do not contain balance information @@ -50,7 +52,6 @@ def __repr__(self) -> str: class BalanceList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the BalanceList diff --git a/twilio/rest/api/v2010/account/call/__init__.py b/twilio/rest/api/v2010/account/call/__init__.py index d6a3c6666..96ba1edc4 100644 --- a/twilio/rest/api/v2010/account/call/__init__.py +++ b/twilio/rest/api/v2010/account/call/__init__.py @@ -12,6 +12,7 @@ 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 @@ -37,7 +38,6 @@ class CallInstance(InstanceResource): - class Status(object): QUEUED = "queued" RINGING = "ringing" @@ -71,6 +71,7 @@ class UpdateStatus(object): :ivar price_unit: The currency in which `Price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g., `USD`, `EUR`, `JPY`). Always capitalized for calls. :ivar direction: A string describing the direction of the call. Can be: `inbound` for inbound calls, `outbound-api` for calls initiated via the REST API or `outbound-dial` for calls initiated by a `` verb. Using [Elastic SIP Trunking](https://www.twilio.com/docs/sip-trunking), the values can be [`trunking-terminating`](https://www.twilio.com/docs/sip-trunking#termination) for outgoing calls from your communications infrastructure to the PSTN or [`trunking-originating`](https://www.twilio.com/docs/sip-trunking#origination) for incoming calls to your communications infrastructure from the PSTN. :ivar answered_by: Either `human` or `machine` if this call was initiated with answering machine detection. Empty otherwise. + :ivar annotation: :ivar api_version: The API version used to create the call. :ivar forwarded_from: The forwarding phone number if this call was an incoming call forwarded from another number (depends on carrier supporting forwarding). Otherwise, empty. :ivar group_sid: The Group SID associated with this call. If no Group is associated with the call, the field is empty. @@ -116,6 +117,7 @@ def __init__( self.price_unit: Optional[str] = payload.get("price_unit") self.direction: Optional[str] = payload.get("direction") self.answered_by: Optional[str] = payload.get("answered_by") + self.annotation: Optional[str] = payload.get("annotation") self.api_version: Optional[str] = payload.get("api_version") self.forwarded_from: Optional[str] = payload.get("forwarded_from") self.group_sid: Optional[str] = payload.get("group_sid") @@ -451,7 +453,6 @@ def __repr__(self) -> str: class CallContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the CallContext @@ -1039,7 +1040,6 @@ def __repr__(self) -> str: class CallPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> CallInstance: """ Build an instance of CallInstance @@ -1060,7 +1060,6 @@ def __repr__(self) -> str: class CallList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the CallList @@ -1093,10 +1092,12 @@ def _create( recording_channels: Union[str, object] = values.unset, recording_status_callback: Union[str, object] = values.unset, recording_status_callback_method: Union[str, object] = values.unset, + recording_configuration_id: Union[str, object] = values.unset, sip_auth_username: Union[str, object] = values.unset, sip_auth_password: Union[str, object] = values.unset, machine_detection: Union[str, object] = values.unset, machine_detection_timeout: Union[int, object] = values.unset, + provider_sid: Union[str, object] = values.unset, recording_status_callback_event: Union[List[str], object] = values.unset, trim: Union[str, object] = values.unset, caller_id: Union[str, object] = values.unset, @@ -1106,11 +1107,20 @@ def _create( async_amd: Union[str, object] = values.unset, async_amd_status_callback: Union[str, object] = values.unset, async_amd_status_callback_method: Union[str, object] = values.unset, + machine_detection_engine: Union[str, object] = values.unset, + machine_detection_min_word_length: Union[int, object] = values.unset, + machine_detection_max_word_length: Union[int, object] = values.unset, + machine_detection_words_silence: Union[int, object] = values.unset, + machine_detection_max_num_of_words: Union[int, object] = values.unset, + machine_detection_silence_threshold: Union[int, object] = values.unset, + byot_attestation: Union[str, object] = values.unset, byoc: Union[str, object] = values.unset, call_reason: Union[str, object] = values.unset, call_token: Union[str, object] = values.unset, recording_track: Union[str, object] = values.unset, time_limit: Union[int, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, client_notification_url: Union[str, object] = values.unset, url: Union[str, object] = values.unset, twiml: Union[str, object] = values.unset, @@ -1141,10 +1151,12 @@ def _create( "RecordingChannels": recording_channels, "RecordingStatusCallback": recording_status_callback, "RecordingStatusCallbackMethod": recording_status_callback_method, + "RecordingConfigurationId": recording_configuration_id, "SipAuthUsername": sip_auth_username, "SipAuthPassword": sip_auth_password, "MachineDetection": machine_detection, "MachineDetectionTimeout": machine_detection_timeout, + "ProviderSid": provider_sid, "RecordingStatusCallbackEvent": serialize.map( recording_status_callback_event, lambda e: e ), @@ -1156,11 +1168,20 @@ def _create( "AsyncAmd": async_amd, "AsyncAmdStatusCallback": async_amd_status_callback, "AsyncAmdStatusCallbackMethod": async_amd_status_callback_method, + "MachineDetectionEngine": machine_detection_engine, + "MachineDetectionMinWordLength": machine_detection_min_word_length, + "MachineDetectionMaxWordLength": machine_detection_max_word_length, + "MachineDetectionWordsSilence": machine_detection_words_silence, + "MachineDetectionMaxNumOfWords": machine_detection_max_num_of_words, + "MachineDetectionSilenceThreshold": machine_detection_silence_threshold, + "ByotAttestation": byot_attestation, "Byoc": byoc, "CallReason": call_reason, "CallToken": call_token, "RecordingTrack": recording_track, "TimeLimit": time_limit, + "Transcribe": serialize.boolean_to_string(transcribe), + "TranscriptionConfiguration": transcription_configuration, "ClientNotificationUrl": client_notification_url, "Url": url, "Twiml": twiml, @@ -1193,10 +1214,12 @@ def create( recording_channels: Union[str, object] = values.unset, recording_status_callback: Union[str, object] = values.unset, recording_status_callback_method: Union[str, object] = values.unset, + recording_configuration_id: Union[str, object] = values.unset, sip_auth_username: Union[str, object] = values.unset, sip_auth_password: Union[str, object] = values.unset, machine_detection: Union[str, object] = values.unset, machine_detection_timeout: Union[int, object] = values.unset, + provider_sid: Union[str, object] = values.unset, recording_status_callback_event: Union[List[str], object] = values.unset, trim: Union[str, object] = values.unset, caller_id: Union[str, object] = values.unset, @@ -1206,11 +1229,20 @@ def create( async_amd: Union[str, object] = values.unset, async_amd_status_callback: Union[str, object] = values.unset, async_amd_status_callback_method: Union[str, object] = values.unset, + machine_detection_engine: Union[str, object] = values.unset, + machine_detection_min_word_length: Union[int, object] = values.unset, + machine_detection_max_word_length: Union[int, object] = values.unset, + machine_detection_words_silence: Union[int, object] = values.unset, + machine_detection_max_num_of_words: Union[int, object] = values.unset, + machine_detection_silence_threshold: Union[int, object] = values.unset, + byot_attestation: Union[str, object] = values.unset, byoc: Union[str, object] = values.unset, call_reason: Union[str, object] = values.unset, call_token: Union[str, object] = values.unset, recording_track: Union[str, object] = values.unset, time_limit: Union[int, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, client_notification_url: Union[str, object] = values.unset, url: Union[str, object] = values.unset, twiml: Union[str, object] = values.unset, @@ -1233,10 +1265,12 @@ def create( :param recording_channels: The number of channels in the final recording. Can be: `mono` or `dual`. The default is `mono`. `mono` records both legs of the call in a single channel of the recording file. `dual` records each leg to a separate channel of the recording file. The first channel of a dual-channel recording contains the parent call and the second channel contains the child call. :param recording_status_callback: The URL that we call when the recording is available to be accessed. :param recording_status_callback_method: The HTTP method we should use when calling the `recording_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. + :param recording_configuration_id: The identifier of the configuration to be used when creating and processing the recording :param sip_auth_username: The username used to authenticate the caller making a SIP call. :param sip_auth_password: The password required to authenticate the user account specified in `sip_auth_username`. :param machine_detection: Whether to detect if a human, answering machine, or fax has picked up the call. Can be: `Enable` or `DetectMessageEnd`. Use `Enable` if you would like us to return `AnsweredBy` as soon as the called party is identified. Use `DetectMessageEnd`, if you would like to leave a message on an answering machine. If `send_digits` is provided, this parameter is ignored. For more information, see [Answering Machine Detection](https://www.twilio.com/docs/voice/answering-machine-detection). :param machine_detection_timeout: The number of seconds that we should attempt to detect an answering machine before timing out and sending a voice request with `AnsweredBy` of `unknown`. The default timeout is 30 seconds. + :param provider_sid: :param recording_status_callback_event: The recording status events that will trigger calls to the URL specified in `recording_status_callback`. Can be: `in-progress`, `completed` and `absent`. Defaults to `completed`. Separate multiple values with a space. :param trim: Whether to trim any leading and trailing silence from the recording. Can be: `trim-silence` or `do-not-trim` and the default is `trim-silence`. :param caller_id: The phone number, SIP address, or Client identifier that made this call. Phone numbers are in [E.164 format](https://wwnw.twilio.com/docs/glossary/what-e164) (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. @@ -1246,11 +1280,20 @@ def create( :param async_amd: Select whether to perform answering machine detection in the background. Default, blocks the execution of the call until Answering Machine Detection is completed. Can be: `true` or `false`. :param async_amd_status_callback: The URL that we should call using the `async_amd_status_callback_method` to notify customer application whether the call was answered by human, machine or fax. :param async_amd_status_callback_method: The HTTP method we should use when calling the `async_amd_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. + :param machine_detection_engine: Select answering machine detection engine. Can be: `Lumenvox` or `Asterisk`. Default: `Lumenvox`. + :param machine_detection_min_word_length: The minimum duration in milliseconds of voice to be considered as a word. Default: 100. + :param machine_detection_max_word_length: The maximum duration in milliseconds of a word to accept. Default: 5000. + :param machine_detection_words_silence: The minimum duration in milliseconds of silence after a word to consider the audio what follows as a new word. Default: 50. + :param machine_detection_max_num_of_words: The maximum number of words in the greeting. If exceeded then it's considered as MACHINE. Default: 5. + :param machine_detection_silence_threshold: The silence threshold. Default: 256. + :param byot_attestation: The per-call Bring Your Own Token (BYOT) STIR/SHAKEN attestation for a specific signing profile. This attestation is prioritized over other attestations. Valid values - A (full), B (partial), C (gateway). :param byoc: The SID of a BYOC (Bring Your Own Carrier) trunk to route this call with. Note that `byoc` is only meaningful when `to` is a phone number; it will otherwise be ignored. (Beta) :param call_reason: The Reason for the outgoing call. Use it to specify the purpose of the call that is presented on the called party's phone. (Branded Calls Beta) :param call_token: A token string needed to invoke a forwarded call. A call_token is generated when an incoming call is received on a Twilio number. Pass an incoming call's call_token value to a forwarded call via the call_token parameter when creating a new call. A forwarded call should bear the same CallerID of the original incoming call. :param recording_track: The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is generated from Twilio. `both` records the audio that is received and generated by Twilio. :param time_limit: The maximum duration of the call in seconds. Constraints depend on account and configuration. + :param transcribe: Whether to transcribe the call recording. The default is `false`. + :param transcription_configuration: The SID or (unique) friendly name of the transcription configuration object to use for transcribing. :param client_notification_url: The URL that we should use to deliver `push call notification`. :param url: The absolute URL that returns the TwiML instructions for the call. We will call this URL using the `method` when the call connects. For more information, see the [Url Parameter](https://www.twilio.com/docs/voice/make-calls#specify-a-url-parameter) section in [Making Calls](https://www.twilio.com/docs/voice/make-calls). :param twiml: TwiML instructions for the call Twilio will use without fetching Twiml from url parameter. If both `twiml` and `url` are provided then `twiml` parameter will be ignored. Max 4000 characters. @@ -1273,10 +1316,12 @@ def create( recording_channels=recording_channels, recording_status_callback=recording_status_callback, recording_status_callback_method=recording_status_callback_method, + recording_configuration_id=recording_configuration_id, sip_auth_username=sip_auth_username, sip_auth_password=sip_auth_password, machine_detection=machine_detection, machine_detection_timeout=machine_detection_timeout, + provider_sid=provider_sid, recording_status_callback_event=recording_status_callback_event, trim=trim, caller_id=caller_id, @@ -1286,11 +1331,20 @@ def create( async_amd=async_amd, async_amd_status_callback=async_amd_status_callback, async_amd_status_callback_method=async_amd_status_callback_method, + machine_detection_engine=machine_detection_engine, + machine_detection_min_word_length=machine_detection_min_word_length, + machine_detection_max_word_length=machine_detection_max_word_length, + machine_detection_words_silence=machine_detection_words_silence, + machine_detection_max_num_of_words=machine_detection_max_num_of_words, + machine_detection_silence_threshold=machine_detection_silence_threshold, + byot_attestation=byot_attestation, byoc=byoc, call_reason=call_reason, call_token=call_token, recording_track=recording_track, time_limit=time_limit, + transcribe=transcribe, + transcription_configuration=transcription_configuration, client_notification_url=client_notification_url, url=url, twiml=twiml, @@ -1316,10 +1370,12 @@ def create_with_http_info( recording_channels: Union[str, object] = values.unset, recording_status_callback: Union[str, object] = values.unset, recording_status_callback_method: Union[str, object] = values.unset, + recording_configuration_id: Union[str, object] = values.unset, sip_auth_username: Union[str, object] = values.unset, sip_auth_password: Union[str, object] = values.unset, machine_detection: Union[str, object] = values.unset, machine_detection_timeout: Union[int, object] = values.unset, + provider_sid: Union[str, object] = values.unset, recording_status_callback_event: Union[List[str], object] = values.unset, trim: Union[str, object] = values.unset, caller_id: Union[str, object] = values.unset, @@ -1329,11 +1385,20 @@ def create_with_http_info( async_amd: Union[str, object] = values.unset, async_amd_status_callback: Union[str, object] = values.unset, async_amd_status_callback_method: Union[str, object] = values.unset, + machine_detection_engine: Union[str, object] = values.unset, + machine_detection_min_word_length: Union[int, object] = values.unset, + machine_detection_max_word_length: Union[int, object] = values.unset, + machine_detection_words_silence: Union[int, object] = values.unset, + machine_detection_max_num_of_words: Union[int, object] = values.unset, + machine_detection_silence_threshold: Union[int, object] = values.unset, + byot_attestation: Union[str, object] = values.unset, byoc: Union[str, object] = values.unset, call_reason: Union[str, object] = values.unset, call_token: Union[str, object] = values.unset, recording_track: Union[str, object] = values.unset, time_limit: Union[int, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, client_notification_url: Union[str, object] = values.unset, url: Union[str, object] = values.unset, twiml: Union[str, object] = values.unset, @@ -1356,10 +1421,12 @@ def create_with_http_info( :param recording_channels: The number of channels in the final recording. Can be: `mono` or `dual`. The default is `mono`. `mono` records both legs of the call in a single channel of the recording file. `dual` records each leg to a separate channel of the recording file. The first channel of a dual-channel recording contains the parent call and the second channel contains the child call. :param recording_status_callback: The URL that we call when the recording is available to be accessed. :param recording_status_callback_method: The HTTP method we should use when calling the `recording_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. + :param recording_configuration_id: The identifier of the configuration to be used when creating and processing the recording :param sip_auth_username: The username used to authenticate the caller making a SIP call. :param sip_auth_password: The password required to authenticate the user account specified in `sip_auth_username`. :param machine_detection: Whether to detect if a human, answering machine, or fax has picked up the call. Can be: `Enable` or `DetectMessageEnd`. Use `Enable` if you would like us to return `AnsweredBy` as soon as the called party is identified. Use `DetectMessageEnd`, if you would like to leave a message on an answering machine. If `send_digits` is provided, this parameter is ignored. For more information, see [Answering Machine Detection](https://www.twilio.com/docs/voice/answering-machine-detection). :param machine_detection_timeout: The number of seconds that we should attempt to detect an answering machine before timing out and sending a voice request with `AnsweredBy` of `unknown`. The default timeout is 30 seconds. + :param provider_sid: :param recording_status_callback_event: The recording status events that will trigger calls to the URL specified in `recording_status_callback`. Can be: `in-progress`, `completed` and `absent`. Defaults to `completed`. Separate multiple values with a space. :param trim: Whether to trim any leading and trailing silence from the recording. Can be: `trim-silence` or `do-not-trim` and the default is `trim-silence`. :param caller_id: The phone number, SIP address, or Client identifier that made this call. Phone numbers are in [E.164 format](https://wwnw.twilio.com/docs/glossary/what-e164) (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. @@ -1369,11 +1436,20 @@ def create_with_http_info( :param async_amd: Select whether to perform answering machine detection in the background. Default, blocks the execution of the call until Answering Machine Detection is completed. Can be: `true` or `false`. :param async_amd_status_callback: The URL that we should call using the `async_amd_status_callback_method` to notify customer application whether the call was answered by human, machine or fax. :param async_amd_status_callback_method: The HTTP method we should use when calling the `async_amd_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. + :param machine_detection_engine: Select answering machine detection engine. Can be: `Lumenvox` or `Asterisk`. Default: `Lumenvox`. + :param machine_detection_min_word_length: The minimum duration in milliseconds of voice to be considered as a word. Default: 100. + :param machine_detection_max_word_length: The maximum duration in milliseconds of a word to accept. Default: 5000. + :param machine_detection_words_silence: The minimum duration in milliseconds of silence after a word to consider the audio what follows as a new word. Default: 50. + :param machine_detection_max_num_of_words: The maximum number of words in the greeting. If exceeded then it's considered as MACHINE. Default: 5. + :param machine_detection_silence_threshold: The silence threshold. Default: 256. + :param byot_attestation: The per-call Bring Your Own Token (BYOT) STIR/SHAKEN attestation for a specific signing profile. This attestation is prioritized over other attestations. Valid values - A (full), B (partial), C (gateway). :param byoc: The SID of a BYOC (Bring Your Own Carrier) trunk to route this call with. Note that `byoc` is only meaningful when `to` is a phone number; it will otherwise be ignored. (Beta) :param call_reason: The Reason for the outgoing call. Use it to specify the purpose of the call that is presented on the called party's phone. (Branded Calls Beta) :param call_token: A token string needed to invoke a forwarded call. A call_token is generated when an incoming call is received on a Twilio number. Pass an incoming call's call_token value to a forwarded call via the call_token parameter when creating a new call. A forwarded call should bear the same CallerID of the original incoming call. :param recording_track: The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is generated from Twilio. `both` records the audio that is received and generated by Twilio. :param time_limit: The maximum duration of the call in seconds. Constraints depend on account and configuration. + :param transcribe: Whether to transcribe the call recording. The default is `false`. + :param transcription_configuration: The SID or (unique) friendly name of the transcription configuration object to use for transcribing. :param client_notification_url: The URL that we should use to deliver `push call notification`. :param url: The absolute URL that returns the TwiML instructions for the call. We will call this URL using the `method` when the call connects. For more information, see the [Url Parameter](https://www.twilio.com/docs/voice/make-calls#specify-a-url-parameter) section in [Making Calls](https://www.twilio.com/docs/voice/make-calls). :param twiml: TwiML instructions for the call Twilio will use without fetching Twiml from url parameter. If both `twiml` and `url` are provided then `twiml` parameter will be ignored. Max 4000 characters. @@ -1396,10 +1472,12 @@ def create_with_http_info( recording_channels=recording_channels, recording_status_callback=recording_status_callback, recording_status_callback_method=recording_status_callback_method, + recording_configuration_id=recording_configuration_id, sip_auth_username=sip_auth_username, sip_auth_password=sip_auth_password, machine_detection=machine_detection, machine_detection_timeout=machine_detection_timeout, + provider_sid=provider_sid, recording_status_callback_event=recording_status_callback_event, trim=trim, caller_id=caller_id, @@ -1409,11 +1487,20 @@ def create_with_http_info( async_amd=async_amd, async_amd_status_callback=async_amd_status_callback, async_amd_status_callback_method=async_amd_status_callback_method, + machine_detection_engine=machine_detection_engine, + machine_detection_min_word_length=machine_detection_min_word_length, + machine_detection_max_word_length=machine_detection_max_word_length, + machine_detection_words_silence=machine_detection_words_silence, + machine_detection_max_num_of_words=machine_detection_max_num_of_words, + machine_detection_silence_threshold=machine_detection_silence_threshold, + byot_attestation=byot_attestation, byoc=byoc, call_reason=call_reason, call_token=call_token, recording_track=recording_track, time_limit=time_limit, + transcribe=transcribe, + transcription_configuration=transcription_configuration, client_notification_url=client_notification_url, url=url, twiml=twiml, @@ -1440,10 +1527,12 @@ async def _create_async( recording_channels: Union[str, object] = values.unset, recording_status_callback: Union[str, object] = values.unset, recording_status_callback_method: Union[str, object] = values.unset, + recording_configuration_id: Union[str, object] = values.unset, sip_auth_username: Union[str, object] = values.unset, sip_auth_password: Union[str, object] = values.unset, machine_detection: Union[str, object] = values.unset, machine_detection_timeout: Union[int, object] = values.unset, + provider_sid: Union[str, object] = values.unset, recording_status_callback_event: Union[List[str], object] = values.unset, trim: Union[str, object] = values.unset, caller_id: Union[str, object] = values.unset, @@ -1453,11 +1542,20 @@ async def _create_async( async_amd: Union[str, object] = values.unset, async_amd_status_callback: Union[str, object] = values.unset, async_amd_status_callback_method: Union[str, object] = values.unset, + machine_detection_engine: Union[str, object] = values.unset, + machine_detection_min_word_length: Union[int, object] = values.unset, + machine_detection_max_word_length: Union[int, object] = values.unset, + machine_detection_words_silence: Union[int, object] = values.unset, + machine_detection_max_num_of_words: Union[int, object] = values.unset, + machine_detection_silence_threshold: Union[int, object] = values.unset, + byot_attestation: Union[str, object] = values.unset, byoc: Union[str, object] = values.unset, call_reason: Union[str, object] = values.unset, call_token: Union[str, object] = values.unset, recording_track: Union[str, object] = values.unset, time_limit: Union[int, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, client_notification_url: Union[str, object] = values.unset, url: Union[str, object] = values.unset, twiml: Union[str, object] = values.unset, @@ -1488,10 +1586,12 @@ async def _create_async( "RecordingChannels": recording_channels, "RecordingStatusCallback": recording_status_callback, "RecordingStatusCallbackMethod": recording_status_callback_method, + "RecordingConfigurationId": recording_configuration_id, "SipAuthUsername": sip_auth_username, "SipAuthPassword": sip_auth_password, "MachineDetection": machine_detection, "MachineDetectionTimeout": machine_detection_timeout, + "ProviderSid": provider_sid, "RecordingStatusCallbackEvent": serialize.map( recording_status_callback_event, lambda e: e ), @@ -1503,11 +1603,20 @@ async def _create_async( "AsyncAmd": async_amd, "AsyncAmdStatusCallback": async_amd_status_callback, "AsyncAmdStatusCallbackMethod": async_amd_status_callback_method, + "MachineDetectionEngine": machine_detection_engine, + "MachineDetectionMinWordLength": machine_detection_min_word_length, + "MachineDetectionMaxWordLength": machine_detection_max_word_length, + "MachineDetectionWordsSilence": machine_detection_words_silence, + "MachineDetectionMaxNumOfWords": machine_detection_max_num_of_words, + "MachineDetectionSilenceThreshold": machine_detection_silence_threshold, + "ByotAttestation": byot_attestation, "Byoc": byoc, "CallReason": call_reason, "CallToken": call_token, "RecordingTrack": recording_track, "TimeLimit": time_limit, + "Transcribe": serialize.boolean_to_string(transcribe), + "TranscriptionConfiguration": transcription_configuration, "ClientNotificationUrl": client_notification_url, "Url": url, "Twiml": twiml, @@ -1540,10 +1649,12 @@ async def create_async( recording_channels: Union[str, object] = values.unset, recording_status_callback: Union[str, object] = values.unset, recording_status_callback_method: Union[str, object] = values.unset, + recording_configuration_id: Union[str, object] = values.unset, sip_auth_username: Union[str, object] = values.unset, sip_auth_password: Union[str, object] = values.unset, machine_detection: Union[str, object] = values.unset, machine_detection_timeout: Union[int, object] = values.unset, + provider_sid: Union[str, object] = values.unset, recording_status_callback_event: Union[List[str], object] = values.unset, trim: Union[str, object] = values.unset, caller_id: Union[str, object] = values.unset, @@ -1553,11 +1664,20 @@ async def create_async( async_amd: Union[str, object] = values.unset, async_amd_status_callback: Union[str, object] = values.unset, async_amd_status_callback_method: Union[str, object] = values.unset, + machine_detection_engine: Union[str, object] = values.unset, + machine_detection_min_word_length: Union[int, object] = values.unset, + machine_detection_max_word_length: Union[int, object] = values.unset, + machine_detection_words_silence: Union[int, object] = values.unset, + machine_detection_max_num_of_words: Union[int, object] = values.unset, + machine_detection_silence_threshold: Union[int, object] = values.unset, + byot_attestation: Union[str, object] = values.unset, byoc: Union[str, object] = values.unset, call_reason: Union[str, object] = values.unset, call_token: Union[str, object] = values.unset, recording_track: Union[str, object] = values.unset, time_limit: Union[int, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, client_notification_url: Union[str, object] = values.unset, url: Union[str, object] = values.unset, twiml: Union[str, object] = values.unset, @@ -1580,10 +1700,12 @@ async def create_async( :param recording_channels: The number of channels in the final recording. Can be: `mono` or `dual`. The default is `mono`. `mono` records both legs of the call in a single channel of the recording file. `dual` records each leg to a separate channel of the recording file. The first channel of a dual-channel recording contains the parent call and the second channel contains the child call. :param recording_status_callback: The URL that we call when the recording is available to be accessed. :param recording_status_callback_method: The HTTP method we should use when calling the `recording_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. + :param recording_configuration_id: The identifier of the configuration to be used when creating and processing the recording :param sip_auth_username: The username used to authenticate the caller making a SIP call. :param sip_auth_password: The password required to authenticate the user account specified in `sip_auth_username`. :param machine_detection: Whether to detect if a human, answering machine, or fax has picked up the call. Can be: `Enable` or `DetectMessageEnd`. Use `Enable` if you would like us to return `AnsweredBy` as soon as the called party is identified. Use `DetectMessageEnd`, if you would like to leave a message on an answering machine. If `send_digits` is provided, this parameter is ignored. For more information, see [Answering Machine Detection](https://www.twilio.com/docs/voice/answering-machine-detection). :param machine_detection_timeout: The number of seconds that we should attempt to detect an answering machine before timing out and sending a voice request with `AnsweredBy` of `unknown`. The default timeout is 30 seconds. + :param provider_sid: :param recording_status_callback_event: The recording status events that will trigger calls to the URL specified in `recording_status_callback`. Can be: `in-progress`, `completed` and `absent`. Defaults to `completed`. Separate multiple values with a space. :param trim: Whether to trim any leading and trailing silence from the recording. Can be: `trim-silence` or `do-not-trim` and the default is `trim-silence`. :param caller_id: The phone number, SIP address, or Client identifier that made this call. Phone numbers are in [E.164 format](https://wwnw.twilio.com/docs/glossary/what-e164) (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. @@ -1593,11 +1715,20 @@ async def create_async( :param async_amd: Select whether to perform answering machine detection in the background. Default, blocks the execution of the call until Answering Machine Detection is completed. Can be: `true` or `false`. :param async_amd_status_callback: The URL that we should call using the `async_amd_status_callback_method` to notify customer application whether the call was answered by human, machine or fax. :param async_amd_status_callback_method: The HTTP method we should use when calling the `async_amd_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. + :param machine_detection_engine: Select answering machine detection engine. Can be: `Lumenvox` or `Asterisk`. Default: `Lumenvox`. + :param machine_detection_min_word_length: The minimum duration in milliseconds of voice to be considered as a word. Default: 100. + :param machine_detection_max_word_length: The maximum duration in milliseconds of a word to accept. Default: 5000. + :param machine_detection_words_silence: The minimum duration in milliseconds of silence after a word to consider the audio what follows as a new word. Default: 50. + :param machine_detection_max_num_of_words: The maximum number of words in the greeting. If exceeded then it's considered as MACHINE. Default: 5. + :param machine_detection_silence_threshold: The silence threshold. Default: 256. + :param byot_attestation: The per-call Bring Your Own Token (BYOT) STIR/SHAKEN attestation for a specific signing profile. This attestation is prioritized over other attestations. Valid values - A (full), B (partial), C (gateway). :param byoc: The SID of a BYOC (Bring Your Own Carrier) trunk to route this call with. Note that `byoc` is only meaningful when `to` is a phone number; it will otherwise be ignored. (Beta) :param call_reason: The Reason for the outgoing call. Use it to specify the purpose of the call that is presented on the called party's phone. (Branded Calls Beta) :param call_token: A token string needed to invoke a forwarded call. A call_token is generated when an incoming call is received on a Twilio number. Pass an incoming call's call_token value to a forwarded call via the call_token parameter when creating a new call. A forwarded call should bear the same CallerID of the original incoming call. :param recording_track: The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is generated from Twilio. `both` records the audio that is received and generated by Twilio. :param time_limit: The maximum duration of the call in seconds. Constraints depend on account and configuration. + :param transcribe: Whether to transcribe the call recording. The default is `false`. + :param transcription_configuration: The SID or (unique) friendly name of the transcription configuration object to use for transcribing. :param client_notification_url: The URL that we should use to deliver `push call notification`. :param url: The absolute URL that returns the TwiML instructions for the call. We will call this URL using the `method` when the call connects. For more information, see the [Url Parameter](https://www.twilio.com/docs/voice/make-calls#specify-a-url-parameter) section in [Making Calls](https://www.twilio.com/docs/voice/make-calls). :param twiml: TwiML instructions for the call Twilio will use without fetching Twiml from url parameter. If both `twiml` and `url` are provided then `twiml` parameter will be ignored. Max 4000 characters. @@ -1620,10 +1751,12 @@ async def create_async( recording_channels=recording_channels, recording_status_callback=recording_status_callback, recording_status_callback_method=recording_status_callback_method, + recording_configuration_id=recording_configuration_id, sip_auth_username=sip_auth_username, sip_auth_password=sip_auth_password, machine_detection=machine_detection, machine_detection_timeout=machine_detection_timeout, + provider_sid=provider_sid, recording_status_callback_event=recording_status_callback_event, trim=trim, caller_id=caller_id, @@ -1633,11 +1766,20 @@ async def create_async( async_amd=async_amd, async_amd_status_callback=async_amd_status_callback, async_amd_status_callback_method=async_amd_status_callback_method, + machine_detection_engine=machine_detection_engine, + machine_detection_min_word_length=machine_detection_min_word_length, + machine_detection_max_word_length=machine_detection_max_word_length, + machine_detection_words_silence=machine_detection_words_silence, + machine_detection_max_num_of_words=machine_detection_max_num_of_words, + machine_detection_silence_threshold=machine_detection_silence_threshold, + byot_attestation=byot_attestation, byoc=byoc, call_reason=call_reason, call_token=call_token, recording_track=recording_track, time_limit=time_limit, + transcribe=transcribe, + transcription_configuration=transcription_configuration, client_notification_url=client_notification_url, url=url, twiml=twiml, @@ -1663,10 +1805,12 @@ async def create_with_http_info_async( recording_channels: Union[str, object] = values.unset, recording_status_callback: Union[str, object] = values.unset, recording_status_callback_method: Union[str, object] = values.unset, + recording_configuration_id: Union[str, object] = values.unset, sip_auth_username: Union[str, object] = values.unset, sip_auth_password: Union[str, object] = values.unset, machine_detection: Union[str, object] = values.unset, machine_detection_timeout: Union[int, object] = values.unset, + provider_sid: Union[str, object] = values.unset, recording_status_callback_event: Union[List[str], object] = values.unset, trim: Union[str, object] = values.unset, caller_id: Union[str, object] = values.unset, @@ -1676,11 +1820,20 @@ async def create_with_http_info_async( async_amd: Union[str, object] = values.unset, async_amd_status_callback: Union[str, object] = values.unset, async_amd_status_callback_method: Union[str, object] = values.unset, + machine_detection_engine: Union[str, object] = values.unset, + machine_detection_min_word_length: Union[int, object] = values.unset, + machine_detection_max_word_length: Union[int, object] = values.unset, + machine_detection_words_silence: Union[int, object] = values.unset, + machine_detection_max_num_of_words: Union[int, object] = values.unset, + machine_detection_silence_threshold: Union[int, object] = values.unset, + byot_attestation: Union[str, object] = values.unset, byoc: Union[str, object] = values.unset, call_reason: Union[str, object] = values.unset, call_token: Union[str, object] = values.unset, recording_track: Union[str, object] = values.unset, time_limit: Union[int, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, client_notification_url: Union[str, object] = values.unset, url: Union[str, object] = values.unset, twiml: Union[str, object] = values.unset, @@ -1703,10 +1856,12 @@ async def create_with_http_info_async( :param recording_channels: The number of channels in the final recording. Can be: `mono` or `dual`. The default is `mono`. `mono` records both legs of the call in a single channel of the recording file. `dual` records each leg to a separate channel of the recording file. The first channel of a dual-channel recording contains the parent call and the second channel contains the child call. :param recording_status_callback: The URL that we call when the recording is available to be accessed. :param recording_status_callback_method: The HTTP method we should use when calling the `recording_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. + :param recording_configuration_id: The identifier of the configuration to be used when creating and processing the recording :param sip_auth_username: The username used to authenticate the caller making a SIP call. :param sip_auth_password: The password required to authenticate the user account specified in `sip_auth_username`. :param machine_detection: Whether to detect if a human, answering machine, or fax has picked up the call. Can be: `Enable` or `DetectMessageEnd`. Use `Enable` if you would like us to return `AnsweredBy` as soon as the called party is identified. Use `DetectMessageEnd`, if you would like to leave a message on an answering machine. If `send_digits` is provided, this parameter is ignored. For more information, see [Answering Machine Detection](https://www.twilio.com/docs/voice/answering-machine-detection). :param machine_detection_timeout: The number of seconds that we should attempt to detect an answering machine before timing out and sending a voice request with `AnsweredBy` of `unknown`. The default timeout is 30 seconds. + :param provider_sid: :param recording_status_callback_event: The recording status events that will trigger calls to the URL specified in `recording_status_callback`. Can be: `in-progress`, `completed` and `absent`. Defaults to `completed`. Separate multiple values with a space. :param trim: Whether to trim any leading and trailing silence from the recording. Can be: `trim-silence` or `do-not-trim` and the default is `trim-silence`. :param caller_id: The phone number, SIP address, or Client identifier that made this call. Phone numbers are in [E.164 format](https://wwnw.twilio.com/docs/glossary/what-e164) (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. @@ -1716,11 +1871,20 @@ async def create_with_http_info_async( :param async_amd: Select whether to perform answering machine detection in the background. Default, blocks the execution of the call until Answering Machine Detection is completed. Can be: `true` or `false`. :param async_amd_status_callback: The URL that we should call using the `async_amd_status_callback_method` to notify customer application whether the call was answered by human, machine or fax. :param async_amd_status_callback_method: The HTTP method we should use when calling the `async_amd_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. + :param machine_detection_engine: Select answering machine detection engine. Can be: `Lumenvox` or `Asterisk`. Default: `Lumenvox`. + :param machine_detection_min_word_length: The minimum duration in milliseconds of voice to be considered as a word. Default: 100. + :param machine_detection_max_word_length: The maximum duration in milliseconds of a word to accept. Default: 5000. + :param machine_detection_words_silence: The minimum duration in milliseconds of silence after a word to consider the audio what follows as a new word. Default: 50. + :param machine_detection_max_num_of_words: The maximum number of words in the greeting. If exceeded then it's considered as MACHINE. Default: 5. + :param machine_detection_silence_threshold: The silence threshold. Default: 256. + :param byot_attestation: The per-call Bring Your Own Token (BYOT) STIR/SHAKEN attestation for a specific signing profile. This attestation is prioritized over other attestations. Valid values - A (full), B (partial), C (gateway). :param byoc: The SID of a BYOC (Bring Your Own Carrier) trunk to route this call with. Note that `byoc` is only meaningful when `to` is a phone number; it will otherwise be ignored. (Beta) :param call_reason: The Reason for the outgoing call. Use it to specify the purpose of the call that is presented on the called party's phone. (Branded Calls Beta) :param call_token: A token string needed to invoke a forwarded call. A call_token is generated when an incoming call is received on a Twilio number. Pass an incoming call's call_token value to a forwarded call via the call_token parameter when creating a new call. A forwarded call should bear the same CallerID of the original incoming call. :param recording_track: The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is generated from Twilio. `both` records the audio that is received and generated by Twilio. :param time_limit: The maximum duration of the call in seconds. Constraints depend on account and configuration. + :param transcribe: Whether to transcribe the call recording. The default is `false`. + :param transcription_configuration: The SID or (unique) friendly name of the transcription configuration object to use for transcribing. :param client_notification_url: The URL that we should use to deliver `push call notification`. :param url: The absolute URL that returns the TwiML instructions for the call. We will call this URL using the `method` when the call connects. For more information, see the [Url Parameter](https://www.twilio.com/docs/voice/make-calls#specify-a-url-parameter) section in [Making Calls](https://www.twilio.com/docs/voice/make-calls). :param twiml: TwiML instructions for the call Twilio will use without fetching Twiml from url parameter. If both `twiml` and `url` are provided then `twiml` parameter will be ignored. Max 4000 characters. @@ -1743,10 +1907,12 @@ async def create_with_http_info_async( recording_channels=recording_channels, recording_status_callback=recording_status_callback, recording_status_callback_method=recording_status_callback_method, + recording_configuration_id=recording_configuration_id, sip_auth_username=sip_auth_username, sip_auth_password=sip_auth_password, machine_detection=machine_detection, machine_detection_timeout=machine_detection_timeout, + provider_sid=provider_sid, recording_status_callback_event=recording_status_callback_event, trim=trim, caller_id=caller_id, @@ -1756,11 +1922,20 @@ async def create_with_http_info_async( async_amd=async_amd, async_amd_status_callback=async_amd_status_callback, async_amd_status_callback_method=async_amd_status_callback_method, + machine_detection_engine=machine_detection_engine, + machine_detection_min_word_length=machine_detection_min_word_length, + machine_detection_max_word_length=machine_detection_max_word_length, + machine_detection_words_silence=machine_detection_words_silence, + machine_detection_max_num_of_words=machine_detection_max_num_of_words, + machine_detection_silence_threshold=machine_detection_silence_threshold, + byot_attestation=byot_attestation, byoc=byoc, call_reason=call_reason, call_token=call_token, recording_track=recording_track, time_limit=time_limit, + transcribe=transcribe, + transcription_configuration=transcription_configuration, client_notification_url=client_notification_url, url=url, twiml=twiml, @@ -2468,10 +2643,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CallPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/call/event.py b/twilio/rest/api/v2010/account/call/event.py index acecb545d..a83babc69 100644 --- a/twilio/rest/api/v2010/account/call/event.py +++ b/twilio/rest/api/v2010/account/call/event.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class EventInstance(InstanceResource): + """ :ivar request: Contains a dictionary representing the request of the call. :ivar response: Contains a dictionary representing the call response, including a list of the call events. @@ -52,7 +54,6 @@ def __repr__(self) -> str: class EventPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> EventInstance: """ Build an instance of EventInstance @@ -76,7 +77,6 @@ def __repr__(self) -> str: class EventList(ListResource): - def __init__(self, version: Version, account_sid: str, call_sid: str): """ Initialize the EventList @@ -428,10 +428,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = EventPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/call/notification.py b/twilio/rest/api/v2010/account/call/notification.py index 996105c88..f6cc6d3aa 100644 --- a/twilio/rest/api/v2010/account/call/notification.py +++ b/twilio/rest/api/v2010/account/call/notification.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import date, datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values @@ -24,6 +25,7 @@ class NotificationInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Call Notification resource. :ivar api_version: The API version used to create the Call Notification resource. @@ -149,7 +151,6 @@ def __repr__(self) -> str: class NotificationContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, call_sid: str, sid: str): """ Initialize the NotificationContext @@ -282,7 +283,6 @@ def __repr__(self) -> str: class NotificationPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> NotificationInstance: """ Build an instance of NotificationInstance @@ -306,7 +306,6 @@ def __repr__(self) -> str: class NotificationList(ListResource): - def __init__(self, version: Version, account_sid: str, call_sid: str): """ Initialize the NotificationList @@ -810,10 +809,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = NotificationPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/call/payment.py b/twilio/rest/api/v2010/account/call/payment.py index 74383e52c..513b6efe4 100644 --- a/twilio/rest/api/v2010/account/call/payment.py +++ b/twilio/rest/api/v2010/account/call/payment.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, serialize, values @@ -23,7 +24,6 @@ class PaymentInstance(InstanceResource): - class BankAccountType(object): CONSUMER_CHECKING = "consumer-checking" CONSUMER_SAVINGS = "consumer-savings" @@ -36,6 +36,10 @@ class Capture(object): POSTAL_CODE = "postal-code" BANK_ROUTING_NUMBER = "bank-routing-number" BANK_ACCOUNT_NUMBER = "bank-account-number" + PAYMENT_CARD_NUMBER_MATCHER = "payment-card-number-matcher" + EXPIRATION_DATE_MATCHER = "expiration-date-matcher" + SECURITY_CODE_MATCHER = "security-code-matcher" + POSTAL_CODE_MATCHER = "postal-code-matcher" class PaymentMethod(object): CREDIT_CARD = "credit-card" @@ -211,7 +215,6 @@ def __repr__(self) -> str: class PaymentContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, call_sid: str, sid: str): """ Initialize the PaymentContext @@ -436,7 +439,6 @@ def __repr__(self) -> str: class PaymentList(ListResource): - def __init__(self, version: Version, account_sid: str, call_sid: str): """ Initialize the PaymentList @@ -477,6 +479,7 @@ def _create( timeout: Union[int, object] = values.unset, token_type: Union["PaymentInstance.TokenType", object] = values.unset, valid_card_types: Union[str, object] = values.unset, + require_matching_inputs: Union[str, object] = values.unset, ) -> tuple: """ Internal helper for create operation @@ -503,6 +506,7 @@ def _create( "Timeout": timeout, "TokenType": token_type, "ValidCardTypes": valid_card_types, + "RequireMatchingInputs": require_matching_inputs, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -535,6 +539,7 @@ def create( timeout: Union[int, object] = values.unset, token_type: Union["PaymentInstance.TokenType", object] = values.unset, valid_card_types: Union[str, object] = values.unset, + require_matching_inputs: Union[str, object] = values.unset, ) -> PaymentInstance: """ Create the PaymentInstance @@ -555,6 +560,7 @@ def create( :param timeout: The number of seconds that should wait for the caller to press a digit between each subsequent digit, after the first one, before moving on to validate the digits captured. The default is `5`, maximum is `600`. :param token_type: :param valid_card_types: Credit card types separated by space that Pay should accept. The default value is `visa mastercard amex` + :param require_matching_inputs: A comma-separated list of payment information fields that require the caller to enter the same value twice for confirmation. Supported values are `payment-card-number`, `expiration-date`, `security-code`, and `postal-code`. :returns: The created PaymentInstance """ @@ -575,6 +581,7 @@ def create( timeout=timeout, token_type=token_type, valid_card_types=valid_card_types, + require_matching_inputs=require_matching_inputs, ) return PaymentInstance( self._version, @@ -603,6 +610,7 @@ def create_with_http_info( timeout: Union[int, object] = values.unset, token_type: Union["PaymentInstance.TokenType", object] = values.unset, valid_card_types: Union[str, object] = values.unset, + require_matching_inputs: Union[str, object] = values.unset, ) -> ApiResponse: """ Create the PaymentInstance and return response metadata @@ -623,6 +631,7 @@ def create_with_http_info( :param timeout: The number of seconds that should wait for the caller to press a digit between each subsequent digit, after the first one, before moving on to validate the digits captured. The default is `5`, maximum is `600`. :param token_type: :param valid_card_types: Credit card types separated by space that Pay should accept. The default value is `visa mastercard amex` + :param require_matching_inputs: A comma-separated list of payment information fields that require the caller to enter the same value twice for confirmation. Supported values are `payment-card-number`, `expiration-date`, `security-code`, and `postal-code`. :returns: ApiResponse with instance, status code, and headers """ @@ -643,6 +652,7 @@ def create_with_http_info( timeout=timeout, token_type=token_type, valid_card_types=valid_card_types, + require_matching_inputs=require_matching_inputs, ) instance = PaymentInstance( self._version, @@ -672,6 +682,7 @@ async def _create_async( timeout: Union[int, object] = values.unset, token_type: Union["PaymentInstance.TokenType", object] = values.unset, valid_card_types: Union[str, object] = values.unset, + require_matching_inputs: Union[str, object] = values.unset, ) -> tuple: """ Internal async helper for create operation @@ -698,6 +709,7 @@ async def _create_async( "Timeout": timeout, "TokenType": token_type, "ValidCardTypes": valid_card_types, + "RequireMatchingInputs": require_matching_inputs, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -730,6 +742,7 @@ async def create_async( timeout: Union[int, object] = values.unset, token_type: Union["PaymentInstance.TokenType", object] = values.unset, valid_card_types: Union[str, object] = values.unset, + require_matching_inputs: Union[str, object] = values.unset, ) -> PaymentInstance: """ Asynchronously create the PaymentInstance @@ -750,6 +763,7 @@ async def create_async( :param timeout: The number of seconds that should wait for the caller to press a digit between each subsequent digit, after the first one, before moving on to validate the digits captured. The default is `5`, maximum is `600`. :param token_type: :param valid_card_types: Credit card types separated by space that Pay should accept. The default value is `visa mastercard amex` + :param require_matching_inputs: A comma-separated list of payment information fields that require the caller to enter the same value twice for confirmation. Supported values are `payment-card-number`, `expiration-date`, `security-code`, and `postal-code`. :returns: The created PaymentInstance """ @@ -770,6 +784,7 @@ async def create_async( timeout=timeout, token_type=token_type, valid_card_types=valid_card_types, + require_matching_inputs=require_matching_inputs, ) return PaymentInstance( self._version, @@ -798,6 +813,7 @@ async def create_with_http_info_async( timeout: Union[int, object] = values.unset, token_type: Union["PaymentInstance.TokenType", object] = values.unset, valid_card_types: Union[str, object] = values.unset, + require_matching_inputs: Union[str, object] = values.unset, ) -> ApiResponse: """ Asynchronously create the PaymentInstance and return response metadata @@ -818,6 +834,7 @@ async def create_with_http_info_async( :param timeout: The number of seconds that should wait for the caller to press a digit between each subsequent digit, after the first one, before moving on to validate the digits captured. The default is `5`, maximum is `600`. :param token_type: :param valid_card_types: Credit card types separated by space that Pay should accept. The default value is `visa mastercard amex` + :param require_matching_inputs: A comma-separated list of payment information fields that require the caller to enter the same value twice for confirmation. Supported values are `payment-card-number`, `expiration-date`, `security-code`, and `postal-code`. :returns: ApiResponse with instance, status code, and headers """ @@ -838,6 +855,7 @@ async def create_with_http_info_async( timeout=timeout, token_type=token_type, valid_card_types=valid_card_types, + require_matching_inputs=require_matching_inputs, ) instance = PaymentInstance( self._version, diff --git a/twilio/rest/api/v2010/account/call/recording.py b/twilio/rest/api/v2010/account/call/recording.py index 6a8d7b0f4..2a671478b 100644 --- a/twilio/rest/api/v2010/account/call/recording.py +++ b/twilio/rest/api/v2010/account/call/recording.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import date, datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values @@ -24,7 +25,6 @@ class RecordingInstance(InstanceResource): - class Source(object): DIALVERB = "DialVerb" CONFERENCE = "Conference" @@ -200,72 +200,84 @@ def update( self, status: "RecordingInstance.Status", pause_behavior: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, ) -> "RecordingInstance": """ Update the RecordingInstance :param status: :param pause_behavior: Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`. + :param play_beep: :returns: The updated RecordingInstance """ return self._proxy.update( status=status, pause_behavior=pause_behavior, + play_beep=play_beep, ) async def update_async( self, status: "RecordingInstance.Status", pause_behavior: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, ) -> "RecordingInstance": """ Asynchronous coroutine to update the RecordingInstance :param status: :param pause_behavior: Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`. + :param play_beep: :returns: The updated RecordingInstance """ return await self._proxy.update_async( status=status, pause_behavior=pause_behavior, + play_beep=play_beep, ) def update_with_http_info( self, status: "RecordingInstance.Status", pause_behavior: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, ) -> ApiResponse: """ Update the RecordingInstance with HTTP info :param status: :param pause_behavior: Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`. + :param play_beep: :returns: ApiResponse with instance, status code, and headers """ return self._proxy.update_with_http_info( status=status, pause_behavior=pause_behavior, + play_beep=play_beep, ) async def update_with_http_info_async( self, status: "RecordingInstance.Status", pause_behavior: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, ) -> ApiResponse: """ Asynchronous coroutine to update the RecordingInstance with HTTP info :param status: :param pause_behavior: Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`. + :param play_beep: :returns: ApiResponse with instance, status code, and headers """ return await self._proxy.update_with_http_info_async( status=status, pause_behavior=pause_behavior, + play_beep=play_beep, ) def __repr__(self) -> str: @@ -279,7 +291,6 @@ def __repr__(self) -> str: class RecordingContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, call_sid: str, sid: str): """ Initialize the RecordingContext @@ -473,6 +484,7 @@ def _update( self, status: "RecordingInstance.Status", pause_behavior: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, ) -> tuple: """ Internal helper for update operation @@ -485,6 +497,7 @@ def _update( { "Status": status, "PauseBehavior": pause_behavior, + "PlayBeep": serialize.boolean_to_string(play_beep), } ) headers = values.of({}) @@ -501,16 +514,20 @@ def update( self, status: "RecordingInstance.Status", pause_behavior: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, ) -> RecordingInstance: """ Update the RecordingInstance :param status: :param pause_behavior: Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`. + :param play_beep: :returns: The updated RecordingInstance """ - payload, _, _ = self._update(status=status, pause_behavior=pause_behavior) + payload, _, _ = self._update( + status=status, pause_behavior=pause_behavior, play_beep=play_beep + ) return RecordingInstance( self._version, payload, @@ -523,17 +540,19 @@ def update_with_http_info( self, status: "RecordingInstance.Status", pause_behavior: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, ) -> ApiResponse: """ Update the RecordingInstance and return response metadata :param status: :param pause_behavior: Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`. + :param play_beep: :returns: ApiResponse with instance, status code, and headers """ payload, status_code, headers = self._update( - status=status, pause_behavior=pause_behavior + status=status, pause_behavior=pause_behavior, play_beep=play_beep ) instance = RecordingInstance( self._version, @@ -548,6 +567,7 @@ async def _update_async( self, status: "RecordingInstance.Status", pause_behavior: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, ) -> tuple: """ Internal async helper for update operation @@ -560,6 +580,7 @@ async def _update_async( { "Status": status, "PauseBehavior": pause_behavior, + "PlayBeep": serialize.boolean_to_string(play_beep), } ) headers = values.of({}) @@ -576,17 +597,19 @@ async def update_async( self, status: "RecordingInstance.Status", pause_behavior: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, ) -> RecordingInstance: """ Asynchronous coroutine to update the RecordingInstance :param status: :param pause_behavior: Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`. + :param play_beep: :returns: The updated RecordingInstance """ payload, _, _ = await self._update_async( - status=status, pause_behavior=pause_behavior + status=status, pause_behavior=pause_behavior, play_beep=play_beep ) return RecordingInstance( self._version, @@ -600,17 +623,19 @@ async def update_with_http_info_async( self, status: "RecordingInstance.Status", pause_behavior: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, ) -> ApiResponse: """ Asynchronous coroutine to update the RecordingInstance and return response metadata :param status: :param pause_behavior: Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`. + :param play_beep: :returns: ApiResponse with instance, status code, and headers """ payload, status_code, headers = await self._update_async( - status=status, pause_behavior=pause_behavior + status=status, pause_behavior=pause_behavior, play_beep=play_beep ) instance = RecordingInstance( self._version, @@ -632,7 +657,6 @@ def __repr__(self) -> str: class RecordingPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> RecordingInstance: """ Build an instance of RecordingInstance @@ -656,7 +680,6 @@ def __repr__(self) -> str: class RecordingList(ListResource): - def __init__(self, version: Version, account_sid: str, call_sid: str): """ Initialize the RecordingList @@ -684,7 +707,9 @@ def _create( recording_status_callback_method: Union[str, object] = values.unset, trim: Union[str, object] = values.unset, recording_channels: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, recording_track: Union[str, object] = values.unset, + recording_configuration_id: Union[str, object] = values.unset, ) -> tuple: """ Internal helper for create operation @@ -702,7 +727,9 @@ def _create( "RecordingStatusCallbackMethod": recording_status_callback_method, "Trim": trim, "RecordingChannels": recording_channels, + "PlayBeep": serialize.boolean_to_string(play_beep), "RecordingTrack": recording_track, + "RecordingConfigurationId": recording_configuration_id, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -722,7 +749,9 @@ def create( recording_status_callback_method: Union[str, object] = values.unset, trim: Union[str, object] = values.unset, recording_channels: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, recording_track: Union[str, object] = values.unset, + recording_configuration_id: Union[str, object] = values.unset, ) -> RecordingInstance: """ Create the RecordingInstance @@ -732,7 +761,9 @@ def create( :param recording_status_callback_method: The HTTP method we should use to call `recording_status_callback`. Can be: `GET` or `POST` and the default is `POST`. :param trim: Whether to trim any leading and trailing silence in the recording. Can be: `trim-silence` or `do-not-trim` and the default is `do-not-trim`. `trim-silence` trims the silence from the beginning and end of the recording and `do-not-trim` does not. :param recording_channels: The number of channels used in the recording. Can be: `mono` or `dual` and the default is `mono`. `mono` records all parties of the call into one channel. `dual` records each party of a 2-party call into separate channels. + :param play_beep: :param recording_track: The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is generated from Twilio. `both` records the audio that is received and generated by Twilio. + :param recording_configuration_id: The identifier of the configuration to be used when creating and processing the recording :returns: The created RecordingInstance """ @@ -742,7 +773,9 @@ def create( recording_status_callback_method=recording_status_callback_method, trim=trim, recording_channels=recording_channels, + play_beep=play_beep, recording_track=recording_track, + recording_configuration_id=recording_configuration_id, ) return RecordingInstance( self._version, @@ -758,7 +791,9 @@ def create_with_http_info( recording_status_callback_method: Union[str, object] = values.unset, trim: Union[str, object] = values.unset, recording_channels: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, recording_track: Union[str, object] = values.unset, + recording_configuration_id: Union[str, object] = values.unset, ) -> ApiResponse: """ Create the RecordingInstance and return response metadata @@ -768,7 +803,9 @@ def create_with_http_info( :param recording_status_callback_method: The HTTP method we should use to call `recording_status_callback`. Can be: `GET` or `POST` and the default is `POST`. :param trim: Whether to trim any leading and trailing silence in the recording. Can be: `trim-silence` or `do-not-trim` and the default is `do-not-trim`. `trim-silence` trims the silence from the beginning and end of the recording and `do-not-trim` does not. :param recording_channels: The number of channels used in the recording. Can be: `mono` or `dual` and the default is `mono`. `mono` records all parties of the call into one channel. `dual` records each party of a 2-party call into separate channels. + :param play_beep: :param recording_track: The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is generated from Twilio. `both` records the audio that is received and generated by Twilio. + :param recording_configuration_id: The identifier of the configuration to be used when creating and processing the recording :returns: ApiResponse with instance, status code, and headers """ @@ -778,7 +815,9 @@ def create_with_http_info( recording_status_callback_method=recording_status_callback_method, trim=trim, recording_channels=recording_channels, + play_beep=play_beep, recording_track=recording_track, + recording_configuration_id=recording_configuration_id, ) instance = RecordingInstance( self._version, @@ -795,7 +834,9 @@ async def _create_async( recording_status_callback_method: Union[str, object] = values.unset, trim: Union[str, object] = values.unset, recording_channels: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, recording_track: Union[str, object] = values.unset, + recording_configuration_id: Union[str, object] = values.unset, ) -> tuple: """ Internal async helper for create operation @@ -813,7 +854,9 @@ async def _create_async( "RecordingStatusCallbackMethod": recording_status_callback_method, "Trim": trim, "RecordingChannels": recording_channels, + "PlayBeep": serialize.boolean_to_string(play_beep), "RecordingTrack": recording_track, + "RecordingConfigurationId": recording_configuration_id, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -833,7 +876,9 @@ async def create_async( recording_status_callback_method: Union[str, object] = values.unset, trim: Union[str, object] = values.unset, recording_channels: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, recording_track: Union[str, object] = values.unset, + recording_configuration_id: Union[str, object] = values.unset, ) -> RecordingInstance: """ Asynchronously create the RecordingInstance @@ -843,7 +888,9 @@ async def create_async( :param recording_status_callback_method: The HTTP method we should use to call `recording_status_callback`. Can be: `GET` or `POST` and the default is `POST`. :param trim: Whether to trim any leading and trailing silence in the recording. Can be: `trim-silence` or `do-not-trim` and the default is `do-not-trim`. `trim-silence` trims the silence from the beginning and end of the recording and `do-not-trim` does not. :param recording_channels: The number of channels used in the recording. Can be: `mono` or `dual` and the default is `mono`. `mono` records all parties of the call into one channel. `dual` records each party of a 2-party call into separate channels. + :param play_beep: :param recording_track: The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is generated from Twilio. `both` records the audio that is received and generated by Twilio. + :param recording_configuration_id: The identifier of the configuration to be used when creating and processing the recording :returns: The created RecordingInstance """ @@ -853,7 +900,9 @@ async def create_async( recording_status_callback_method=recording_status_callback_method, trim=trim, recording_channels=recording_channels, + play_beep=play_beep, recording_track=recording_track, + recording_configuration_id=recording_configuration_id, ) return RecordingInstance( self._version, @@ -869,7 +918,9 @@ async def create_with_http_info_async( recording_status_callback_method: Union[str, object] = values.unset, trim: Union[str, object] = values.unset, recording_channels: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, recording_track: Union[str, object] = values.unset, + recording_configuration_id: Union[str, object] = values.unset, ) -> ApiResponse: """ Asynchronously create the RecordingInstance and return response metadata @@ -879,7 +930,9 @@ async def create_with_http_info_async( :param recording_status_callback_method: The HTTP method we should use to call `recording_status_callback`. Can be: `GET` or `POST` and the default is `POST`. :param trim: Whether to trim any leading and trailing silence in the recording. Can be: `trim-silence` or `do-not-trim` and the default is `do-not-trim`. `trim-silence` trims the silence from the beginning and end of the recording and `do-not-trim` does not. :param recording_channels: The number of channels used in the recording. Can be: `mono` or `dual` and the default is `mono`. `mono` records all parties of the call into one channel. `dual` records each party of a 2-party call into separate channels. + :param play_beep: :param recording_track: The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is generated from Twilio. `both` records the audio that is received and generated by Twilio. + :param recording_configuration_id: The identifier of the configuration to be used when creating and processing the recording :returns: ApiResponse with instance, status code, and headers """ @@ -889,7 +942,9 @@ async def create_with_http_info_async( recording_status_callback_method=recording_status_callback_method, trim=trim, recording_channels=recording_channels, + play_beep=play_beep, recording_track=recording_track, + recording_configuration_id=recording_configuration_id, ) instance = RecordingInstance( self._version, @@ -1344,10 +1399,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = RecordingPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/call/siprec.py b/twilio/rest/api/v2010/account/call/siprec.py index 3c18fd9f1..70314a3ee 100644 --- a/twilio/rest/api/v2010/account/call/siprec.py +++ b/twilio/rest/api/v2010/account/call/siprec.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, values @@ -23,7 +24,6 @@ class SiprecInstance(InstanceResource): - class Status(object): IN_PROGRESS = "in-progress" STOPPED = "stopped" @@ -155,7 +155,6 @@ def __repr__(self) -> str: class SiprecContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, call_sid: str, sid: str): """ Initialize the SiprecContext @@ -310,7 +309,6 @@ def __repr__(self) -> str: class SiprecList(ListResource): - def __init__(self, version: Version, account_sid: str, call_sid: str): """ Initialize the SiprecList diff --git a/twilio/rest/api/v2010/account/call/stream.py b/twilio/rest/api/v2010/account/call/stream.py index 5f68803fb..09a02679e 100644 --- a/twilio/rest/api/v2010/account/call/stream.py +++ b/twilio/rest/api/v2010/account/call/stream.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, values @@ -23,7 +24,6 @@ class StreamInstance(InstanceResource): - class Status(object): IN_PROGRESS = "in-progress" STOPPED = "stopped" @@ -155,7 +155,6 @@ def __repr__(self) -> str: class StreamContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, call_sid: str, sid: str): """ Initialize the StreamContext @@ -312,7 +311,6 @@ def __repr__(self) -> str: class StreamList(ListResource): - def __init__(self, version: Version, account_sid: str, call_sid: str): """ Initialize the StreamList diff --git a/twilio/rest/api/v2010/account/call/transcription.py b/twilio/rest/api/v2010/account/call/transcription.py index 4422a1b07..6e924391a 100644 --- a/twilio/rest/api/v2010/account/call/transcription.py +++ b/twilio/rest/api/v2010/account/call/transcription.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, serialize, values @@ -23,7 +24,6 @@ class TranscriptionInstance(InstanceResource): - class Status(object): IN_PROGRESS = "in-progress" STOPPED = "stopped" @@ -157,7 +157,6 @@ def __repr__(self) -> str: class TranscriptionContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, call_sid: str, sid: str): """ Initialize the TranscriptionContext @@ -318,7 +317,6 @@ def __repr__(self) -> str: class TranscriptionList(ListResource): - def __init__(self, version: Version, account_sid: str, call_sid: str): """ Initialize the TranscriptionList @@ -357,6 +355,8 @@ def _create( hints: Union[str, object] = values.unset, enable_automatic_punctuation: Union[bool, object] = values.unset, intelligence_service: Union[str, object] = values.unset, + conversation_configuration: Union[str, object] = values.unset, + conversation_id: Union[str, object] = values.unset, enable_provider_data: Union[bool, object] = values.unset, ) -> tuple: """ @@ -384,6 +384,8 @@ def _create( enable_automatic_punctuation ), "IntelligenceService": intelligence_service, + "ConversationConfiguration": conversation_configuration, + "ConversationId": conversation_id, "EnableProviderData": serialize.boolean_to_string(enable_provider_data), } ) @@ -413,6 +415,8 @@ def create( hints: Union[str, object] = values.unset, enable_automatic_punctuation: Union[bool, object] = values.unset, intelligence_service: Union[str, object] = values.unset, + conversation_configuration: Union[str, object] = values.unset, + conversation_id: Union[str, object] = values.unset, enable_provider_data: Union[bool, object] = values.unset, ) -> TranscriptionInstance: """ @@ -432,6 +436,8 @@ def create( :param hints: A Phrase contains words and phrase \\\"hints\\\" so that the speech recognition engine is more likely to recognize them. :param enable_automatic_punctuation: The provider will add punctuation to recognition result :param intelligence_service: The SID or unique name of the [Intelligence Service](https://www.twilio.com/docs/conversational-intelligence/api/service-resource) for persisting transcripts and running post-call Language Operators + :param conversation_configuration: The ID of the Conversations Configuration for customizing conversation behavior in Intelligence Service + :param conversation_id: The ID of the Conversation for associating this Transcription with an existing Conversation in Intelligence Service :param enable_provider_data: Whether the callback includes raw provider data. :returns: The created TranscriptionInstance @@ -451,6 +457,8 @@ def create( hints=hints, enable_automatic_punctuation=enable_automatic_punctuation, intelligence_service=intelligence_service, + conversation_configuration=conversation_configuration, + conversation_id=conversation_id, enable_provider_data=enable_provider_data, ) return TranscriptionInstance( @@ -476,6 +484,8 @@ def create_with_http_info( hints: Union[str, object] = values.unset, enable_automatic_punctuation: Union[bool, object] = values.unset, intelligence_service: Union[str, object] = values.unset, + conversation_configuration: Union[str, object] = values.unset, + conversation_id: Union[str, object] = values.unset, enable_provider_data: Union[bool, object] = values.unset, ) -> ApiResponse: """ @@ -495,6 +505,8 @@ def create_with_http_info( :param hints: A Phrase contains words and phrase \\\"hints\\\" so that the speech recognition engine is more likely to recognize them. :param enable_automatic_punctuation: The provider will add punctuation to recognition result :param intelligence_service: The SID or unique name of the [Intelligence Service](https://www.twilio.com/docs/conversational-intelligence/api/service-resource) for persisting transcripts and running post-call Language Operators + :param conversation_configuration: The ID of the Conversations Configuration for customizing conversation behavior in Intelligence Service + :param conversation_id: The ID of the Conversation for associating this Transcription with an existing Conversation in Intelligence Service :param enable_provider_data: Whether the callback includes raw provider data. :returns: ApiResponse with instance, status code, and headers @@ -514,6 +526,8 @@ def create_with_http_info( hints=hints, enable_automatic_punctuation=enable_automatic_punctuation, intelligence_service=intelligence_service, + conversation_configuration=conversation_configuration, + conversation_id=conversation_id, enable_provider_data=enable_provider_data, ) instance = TranscriptionInstance( @@ -540,6 +554,8 @@ async def _create_async( hints: Union[str, object] = values.unset, enable_automatic_punctuation: Union[bool, object] = values.unset, intelligence_service: Union[str, object] = values.unset, + conversation_configuration: Union[str, object] = values.unset, + conversation_id: Union[str, object] = values.unset, enable_provider_data: Union[bool, object] = values.unset, ) -> tuple: """ @@ -567,6 +583,8 @@ async def _create_async( enable_automatic_punctuation ), "IntelligenceService": intelligence_service, + "ConversationConfiguration": conversation_configuration, + "ConversationId": conversation_id, "EnableProviderData": serialize.boolean_to_string(enable_provider_data), } ) @@ -596,6 +614,8 @@ async def create_async( hints: Union[str, object] = values.unset, enable_automatic_punctuation: Union[bool, object] = values.unset, intelligence_service: Union[str, object] = values.unset, + conversation_configuration: Union[str, object] = values.unset, + conversation_id: Union[str, object] = values.unset, enable_provider_data: Union[bool, object] = values.unset, ) -> TranscriptionInstance: """ @@ -615,6 +635,8 @@ async def create_async( :param hints: A Phrase contains words and phrase \\\"hints\\\" so that the speech recognition engine is more likely to recognize them. :param enable_automatic_punctuation: The provider will add punctuation to recognition result :param intelligence_service: The SID or unique name of the [Intelligence Service](https://www.twilio.com/docs/conversational-intelligence/api/service-resource) for persisting transcripts and running post-call Language Operators + :param conversation_configuration: The ID of the Conversations Configuration for customizing conversation behavior in Intelligence Service + :param conversation_id: The ID of the Conversation for associating this Transcription with an existing Conversation in Intelligence Service :param enable_provider_data: Whether the callback includes raw provider data. :returns: The created TranscriptionInstance @@ -634,6 +656,8 @@ async def create_async( hints=hints, enable_automatic_punctuation=enable_automatic_punctuation, intelligence_service=intelligence_service, + conversation_configuration=conversation_configuration, + conversation_id=conversation_id, enable_provider_data=enable_provider_data, ) return TranscriptionInstance( @@ -659,6 +683,8 @@ async def create_with_http_info_async( hints: Union[str, object] = values.unset, enable_automatic_punctuation: Union[bool, object] = values.unset, intelligence_service: Union[str, object] = values.unset, + conversation_configuration: Union[str, object] = values.unset, + conversation_id: Union[str, object] = values.unset, enable_provider_data: Union[bool, object] = values.unset, ) -> ApiResponse: """ @@ -678,6 +704,8 @@ async def create_with_http_info_async( :param hints: A Phrase contains words and phrase \\\"hints\\\" so that the speech recognition engine is more likely to recognize them. :param enable_automatic_punctuation: The provider will add punctuation to recognition result :param intelligence_service: The SID or unique name of the [Intelligence Service](https://www.twilio.com/docs/conversational-intelligence/api/service-resource) for persisting transcripts and running post-call Language Operators + :param conversation_configuration: The ID of the Conversations Configuration for customizing conversation behavior in Intelligence Service + :param conversation_id: The ID of the Conversation for associating this Transcription with an existing Conversation in Intelligence Service :param enable_provider_data: Whether the callback includes raw provider data. :returns: ApiResponse with instance, status code, and headers @@ -697,6 +725,8 @@ async def create_with_http_info_async( hints=hints, enable_automatic_punctuation=enable_automatic_punctuation, intelligence_service=intelligence_service, + conversation_configuration=conversation_configuration, + conversation_id=conversation_id, enable_provider_data=enable_provider_data, ) instance = TranscriptionInstance( diff --git a/twilio/rest/api/v2010/account/call/user_defined_message.py b/twilio/rest/api/v2010/account/call/user_defined_message.py index d1ed0a91e..38c95dac2 100644 --- a/twilio/rest/api/v2010/account/call/user_defined_message.py +++ b/twilio/rest/api/v2010/account/call/user_defined_message.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, values @@ -23,6 +24,7 @@ class UserDefinedMessageInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created User Defined Message. :ivar call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the User Defined Message is associated with. @@ -58,7 +60,6 @@ def __repr__(self) -> str: class UserDefinedMessageList(ListResource): - def __init__(self, version: Version, account_sid: str, call_sid: str): """ Initialize the UserDefinedMessageList diff --git a/twilio/rest/api/v2010/account/call/user_defined_message_subscription.py b/twilio/rest/api/v2010/account/call/user_defined_message_subscription.py index 9640005c7..1a6444c7b 100644 --- a/twilio/rest/api/v2010/account/call/user_defined_message_subscription.py +++ b/twilio/rest/api/v2010/account/call/user_defined_message_subscription.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, values @@ -23,6 +24,7 @@ class UserDefinedMessageSubscriptionInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that subscribed to the User Defined Messages. :ivar call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the User Defined Message Subscription is associated with. This refers to the Call SID that is producing the User Defined Messages. @@ -122,7 +124,6 @@ def __repr__(self) -> str: class UserDefinedMessageSubscriptionContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, call_sid: str, sid: str): """ Initialize the UserDefinedMessageSubscriptionContext @@ -225,7 +226,6 @@ def __repr__(self) -> str: class UserDefinedMessageSubscriptionList(ListResource): - def __init__(self, version: Version, account_sid: str, call_sid: str): """ Initialize the UserDefinedMessageSubscriptionList diff --git a/twilio/rest/api/v2010/account/conference/__init__.py b/twilio/rest/api/v2010/account/conference/__init__.py index 77624ea34..49be913cd 100644 --- a/twilio/rest/api/v2010/account/conference/__init__.py +++ b/twilio/rest/api/v2010/account/conference/__init__.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import date, datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values @@ -26,7 +27,6 @@ class ConferenceInstance(InstanceResource): - class ReasonConferenceEnded(object): CONFERENCE_ENDED_VIA_API = "conference-ended-via-api" PARTICIPANT_WITH_END_CONFERENCE_ON_EXIT_LEFT = ( @@ -260,7 +260,6 @@ def __repr__(self) -> str: class ConferenceContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the ConferenceContext @@ -576,7 +575,6 @@ def __repr__(self) -> str: class ConferencePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ConferenceInstance: """ Build an instance of ConferenceInstance @@ -597,7 +595,6 @@ def __repr__(self) -> str: class ConferenceList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the ConferenceList @@ -1239,10 +1236,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ConferencePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/conference/participant.py b/twilio/rest/api/v2010/account/conference/participant.py index dcbad37db..b1c5cbae2 100644 --- a/twilio/rest/api/v2010/account/conference/participant.py +++ b/twilio/rest/api/v2010/account/conference/participant.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class ParticipantInstance(InstanceResource): - class Status(object): QUEUED = "queued" CONNECTING = "connecting" @@ -384,7 +384,6 @@ def __repr__(self) -> str: class ParticipantContext(InstanceContext): - def __init__( self, version: Version, account_sid: str, conference_sid: str, call_sid: str ): @@ -907,7 +906,6 @@ def __repr__(self) -> str: class ParticipantPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ParticipantInstance: """ Build an instance of ParticipantInstance @@ -931,7 +929,6 @@ def __repr__(self) -> str: class ParticipantList(ListResource): - def __init__(self, version: Version, account_sid: str, conference_sid: str): """ Initialize the ParticipantList @@ -994,6 +991,7 @@ def _create( caller_id: Union[str, object] = values.unset, call_reason: Union[str, object] = values.unset, recording_track: Union[str, object] = values.unset, + recording_configuration_id: Union[str, object] = values.unset, time_limit: Union[int, object] = values.unset, machine_detection: Union[str, object] = values.unset, machine_detection_timeout: Union[int, object] = values.unset, @@ -1002,6 +1000,12 @@ def _create( machine_detection_silence_timeout: Union[int, object] = values.unset, amd_status_callback: Union[str, object] = values.unset, amd_status_callback_method: Union[str, object] = values.unset, + machine_detection_engine: Union[str, object] = values.unset, + machine_detection_min_word_length: Union[int, object] = values.unset, + machine_detection_max_word_length: Union[int, object] = values.unset, + machine_detection_words_silence: Union[int, object] = values.unset, + machine_detection_max_num_of_words: Union[int, object] = values.unset, + machine_detection_silence_threshold: Union[int, object] = values.unset, trim: Union[str, object] = values.unset, call_token: Union[str, object] = values.unset, client_notification_url: Union[str, object] = values.unset, @@ -1066,6 +1070,7 @@ def _create( "CallerId": caller_id, "CallReason": call_reason, "RecordingTrack": recording_track, + "RecordingConfigurationId": recording_configuration_id, "TimeLimit": time_limit, "MachineDetection": machine_detection, "MachineDetectionTimeout": machine_detection_timeout, @@ -1074,6 +1079,12 @@ def _create( "MachineDetectionSilenceTimeout": machine_detection_silence_timeout, "AmdStatusCallback": amd_status_callback, "AmdStatusCallbackMethod": amd_status_callback_method, + "MachineDetectionEngine": machine_detection_engine, + "MachineDetectionMinWordLength": machine_detection_min_word_length, + "MachineDetectionMaxWordLength": machine_detection_max_word_length, + "MachineDetectionWordsSilence": machine_detection_words_silence, + "MachineDetectionMaxNumOfWords": machine_detection_max_num_of_words, + "MachineDetectionSilenceThreshold": machine_detection_silence_threshold, "Trim": trim, "CallToken": call_token, "ClientNotificationUrl": client_notification_url, @@ -1132,6 +1143,7 @@ def create( caller_id: Union[str, object] = values.unset, call_reason: Union[str, object] = values.unset, recording_track: Union[str, object] = values.unset, + recording_configuration_id: Union[str, object] = values.unset, time_limit: Union[int, object] = values.unset, machine_detection: Union[str, object] = values.unset, machine_detection_timeout: Union[int, object] = values.unset, @@ -1140,6 +1152,12 @@ def create( machine_detection_silence_timeout: Union[int, object] = values.unset, amd_status_callback: Union[str, object] = values.unset, amd_status_callback_method: Union[str, object] = values.unset, + machine_detection_engine: Union[str, object] = values.unset, + machine_detection_min_word_length: Union[int, object] = values.unset, + machine_detection_max_word_length: Union[int, object] = values.unset, + machine_detection_words_silence: Union[int, object] = values.unset, + machine_detection_max_num_of_words: Union[int, object] = values.unset, + machine_detection_silence_threshold: Union[int, object] = values.unset, trim: Union[str, object] = values.unset, call_token: Union[str, object] = values.unset, client_notification_url: Union[str, object] = values.unset, @@ -1186,6 +1204,7 @@ def create( :param caller_id: The phone number, Client identifier, or username portion of SIP address that made this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). Client identifiers are formatted `client:name`. If using a phone number, it must be a Twilio number or a Verified [outgoing caller id](https://www.twilio.com/docs/voice/api/outgoing-caller-ids) for your account. If the `to` parameter is a phone number, `callerId` must also be a phone number. If `to` is sip address, this value of `callerId` should be a username portion to be used to populate the From header that is passed to the SIP endpoint. :param call_reason: The Reason for the outgoing call. Use it to specify the purpose of the call that is presented on the called party's phone. (Branded Calls Beta) :param recording_track: The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is sent from Twilio. `both` records the audio that is received and sent by Twilio. + :param recording_configuration_id: The identifier of the configuration to be used when creating and processing the recording :param time_limit: The maximum duration of the call in seconds. Constraints depend on account and configuration. :param machine_detection: Whether to detect if a human, answering machine, or fax has picked up the call. Can be: `Enable` or `DetectMessageEnd`. Use `Enable` if you would like us to return `AnsweredBy` as soon as the called party is identified. Use `DetectMessageEnd`, if you would like to leave a message on an answering machine. For more information, see [Answering Machine Detection](https://www.twilio.com/docs/voice/answering-machine-detection). :param machine_detection_timeout: The number of seconds that we should attempt to detect an answering machine before timing out and sending a voice request with `AnsweredBy` of `unknown`. The default timeout is 30 seconds. @@ -1194,6 +1213,12 @@ def create( :param machine_detection_silence_timeout: The number of milliseconds of initial silence after which an `unknown` AnsweredBy result will be returned. Possible Values: 2000-10000. Default: 5000. :param amd_status_callback: The URL that we should call using the `amd_status_callback_method` to notify customer application whether the call was answered by human, machine or fax. :param amd_status_callback_method: The HTTP method we should use when calling the `amd_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. + :param machine_detection_engine: Select answering machine detection engine. Can be: `Lumenvox` or `Asterisk`. Default: `Lumenvox`. + :param machine_detection_min_word_length: The minimum duration in milliseconds of voice to be considered as a word. Default: 100. + :param machine_detection_max_word_length: The maximum duration in milliseconds of a word to accept. Default: 5000. + :param machine_detection_words_silence: The minimum duration in milliseconds of silence after a word to consider the audio what follows as a new word. Default: 50. + :param machine_detection_max_num_of_words: The maximum number of words in the greeting. If exceeded, then it's considered as MACHINE. Default: 5. + :param machine_detection_silence_threshold: The silence threshold. Default: 256. :param trim: Whether to trim any leading and trailing silence from the participant recording. Can be: `trim-silence` or `do-not-trim` and the default is `trim-silence`. :param call_token: A token string needed to invoke a forwarded call. A call_token is generated when an incoming call is received on a Twilio number. Pass an incoming call's call_token value to a forwarded call via the call_token parameter when creating a new call. A forwarded call should bear the same CallerID of the original incoming call. :param client_notification_url: The URL that we should use to deliver `push call notification`. @@ -1240,6 +1265,7 @@ def create( caller_id=caller_id, call_reason=call_reason, recording_track=recording_track, + recording_configuration_id=recording_configuration_id, time_limit=time_limit, machine_detection=machine_detection, machine_detection_timeout=machine_detection_timeout, @@ -1248,6 +1274,12 @@ def create( machine_detection_silence_timeout=machine_detection_silence_timeout, amd_status_callback=amd_status_callback, amd_status_callback_method=amd_status_callback_method, + machine_detection_engine=machine_detection_engine, + machine_detection_min_word_length=machine_detection_min_word_length, + machine_detection_max_word_length=machine_detection_max_word_length, + machine_detection_words_silence=machine_detection_words_silence, + machine_detection_max_num_of_words=machine_detection_max_num_of_words, + machine_detection_silence_threshold=machine_detection_silence_threshold, trim=trim, call_token=call_token, client_notification_url=client_notification_url, @@ -1302,6 +1334,7 @@ def create_with_http_info( caller_id: Union[str, object] = values.unset, call_reason: Union[str, object] = values.unset, recording_track: Union[str, object] = values.unset, + recording_configuration_id: Union[str, object] = values.unset, time_limit: Union[int, object] = values.unset, machine_detection: Union[str, object] = values.unset, machine_detection_timeout: Union[int, object] = values.unset, @@ -1310,6 +1343,12 @@ def create_with_http_info( machine_detection_silence_timeout: Union[int, object] = values.unset, amd_status_callback: Union[str, object] = values.unset, amd_status_callback_method: Union[str, object] = values.unset, + machine_detection_engine: Union[str, object] = values.unset, + machine_detection_min_word_length: Union[int, object] = values.unset, + machine_detection_max_word_length: Union[int, object] = values.unset, + machine_detection_words_silence: Union[int, object] = values.unset, + machine_detection_max_num_of_words: Union[int, object] = values.unset, + machine_detection_silence_threshold: Union[int, object] = values.unset, trim: Union[str, object] = values.unset, call_token: Union[str, object] = values.unset, client_notification_url: Union[str, object] = values.unset, @@ -1356,6 +1395,7 @@ def create_with_http_info( :param caller_id: The phone number, Client identifier, or username portion of SIP address that made this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). Client identifiers are formatted `client:name`. If using a phone number, it must be a Twilio number or a Verified [outgoing caller id](https://www.twilio.com/docs/voice/api/outgoing-caller-ids) for your account. If the `to` parameter is a phone number, `callerId` must also be a phone number. If `to` is sip address, this value of `callerId` should be a username portion to be used to populate the From header that is passed to the SIP endpoint. :param call_reason: The Reason for the outgoing call. Use it to specify the purpose of the call that is presented on the called party's phone. (Branded Calls Beta) :param recording_track: The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is sent from Twilio. `both` records the audio that is received and sent by Twilio. + :param recording_configuration_id: The identifier of the configuration to be used when creating and processing the recording :param time_limit: The maximum duration of the call in seconds. Constraints depend on account and configuration. :param machine_detection: Whether to detect if a human, answering machine, or fax has picked up the call. Can be: `Enable` or `DetectMessageEnd`. Use `Enable` if you would like us to return `AnsweredBy` as soon as the called party is identified. Use `DetectMessageEnd`, if you would like to leave a message on an answering machine. For more information, see [Answering Machine Detection](https://www.twilio.com/docs/voice/answering-machine-detection). :param machine_detection_timeout: The number of seconds that we should attempt to detect an answering machine before timing out and sending a voice request with `AnsweredBy` of `unknown`. The default timeout is 30 seconds. @@ -1364,6 +1404,12 @@ def create_with_http_info( :param machine_detection_silence_timeout: The number of milliseconds of initial silence after which an `unknown` AnsweredBy result will be returned. Possible Values: 2000-10000. Default: 5000. :param amd_status_callback: The URL that we should call using the `amd_status_callback_method` to notify customer application whether the call was answered by human, machine or fax. :param amd_status_callback_method: The HTTP method we should use when calling the `amd_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. + :param machine_detection_engine: Select answering machine detection engine. Can be: `Lumenvox` or `Asterisk`. Default: `Lumenvox`. + :param machine_detection_min_word_length: The minimum duration in milliseconds of voice to be considered as a word. Default: 100. + :param machine_detection_max_word_length: The maximum duration in milliseconds of a word to accept. Default: 5000. + :param machine_detection_words_silence: The minimum duration in milliseconds of silence after a word to consider the audio what follows as a new word. Default: 50. + :param machine_detection_max_num_of_words: The maximum number of words in the greeting. If exceeded, then it's considered as MACHINE. Default: 5. + :param machine_detection_silence_threshold: The silence threshold. Default: 256. :param trim: Whether to trim any leading and trailing silence from the participant recording. Can be: `trim-silence` or `do-not-trim` and the default is `trim-silence`. :param call_token: A token string needed to invoke a forwarded call. A call_token is generated when an incoming call is received on a Twilio number. Pass an incoming call's call_token value to a forwarded call via the call_token parameter when creating a new call. A forwarded call should bear the same CallerID of the original incoming call. :param client_notification_url: The URL that we should use to deliver `push call notification`. @@ -1410,6 +1456,7 @@ def create_with_http_info( caller_id=caller_id, call_reason=call_reason, recording_track=recording_track, + recording_configuration_id=recording_configuration_id, time_limit=time_limit, machine_detection=machine_detection, machine_detection_timeout=machine_detection_timeout, @@ -1418,6 +1465,12 @@ def create_with_http_info( machine_detection_silence_timeout=machine_detection_silence_timeout, amd_status_callback=amd_status_callback, amd_status_callback_method=amd_status_callback_method, + machine_detection_engine=machine_detection_engine, + machine_detection_min_word_length=machine_detection_min_word_length, + machine_detection_max_word_length=machine_detection_max_word_length, + machine_detection_words_silence=machine_detection_words_silence, + machine_detection_max_num_of_words=machine_detection_max_num_of_words, + machine_detection_silence_threshold=machine_detection_silence_threshold, trim=trim, call_token=call_token, client_notification_url=client_notification_url, @@ -1473,6 +1526,7 @@ async def _create_async( caller_id: Union[str, object] = values.unset, call_reason: Union[str, object] = values.unset, recording_track: Union[str, object] = values.unset, + recording_configuration_id: Union[str, object] = values.unset, time_limit: Union[int, object] = values.unset, machine_detection: Union[str, object] = values.unset, machine_detection_timeout: Union[int, object] = values.unset, @@ -1481,6 +1535,12 @@ async def _create_async( machine_detection_silence_timeout: Union[int, object] = values.unset, amd_status_callback: Union[str, object] = values.unset, amd_status_callback_method: Union[str, object] = values.unset, + machine_detection_engine: Union[str, object] = values.unset, + machine_detection_min_word_length: Union[int, object] = values.unset, + machine_detection_max_word_length: Union[int, object] = values.unset, + machine_detection_words_silence: Union[int, object] = values.unset, + machine_detection_max_num_of_words: Union[int, object] = values.unset, + machine_detection_silence_threshold: Union[int, object] = values.unset, trim: Union[str, object] = values.unset, call_token: Union[str, object] = values.unset, client_notification_url: Union[str, object] = values.unset, @@ -1545,6 +1605,7 @@ async def _create_async( "CallerId": caller_id, "CallReason": call_reason, "RecordingTrack": recording_track, + "RecordingConfigurationId": recording_configuration_id, "TimeLimit": time_limit, "MachineDetection": machine_detection, "MachineDetectionTimeout": machine_detection_timeout, @@ -1553,6 +1614,12 @@ async def _create_async( "MachineDetectionSilenceTimeout": machine_detection_silence_timeout, "AmdStatusCallback": amd_status_callback, "AmdStatusCallbackMethod": amd_status_callback_method, + "MachineDetectionEngine": machine_detection_engine, + "MachineDetectionMinWordLength": machine_detection_min_word_length, + "MachineDetectionMaxWordLength": machine_detection_max_word_length, + "MachineDetectionWordsSilence": machine_detection_words_silence, + "MachineDetectionMaxNumOfWords": machine_detection_max_num_of_words, + "MachineDetectionSilenceThreshold": machine_detection_silence_threshold, "Trim": trim, "CallToken": call_token, "ClientNotificationUrl": client_notification_url, @@ -1611,6 +1678,7 @@ async def create_async( caller_id: Union[str, object] = values.unset, call_reason: Union[str, object] = values.unset, recording_track: Union[str, object] = values.unset, + recording_configuration_id: Union[str, object] = values.unset, time_limit: Union[int, object] = values.unset, machine_detection: Union[str, object] = values.unset, machine_detection_timeout: Union[int, object] = values.unset, @@ -1619,6 +1687,12 @@ async def create_async( machine_detection_silence_timeout: Union[int, object] = values.unset, amd_status_callback: Union[str, object] = values.unset, amd_status_callback_method: Union[str, object] = values.unset, + machine_detection_engine: Union[str, object] = values.unset, + machine_detection_min_word_length: Union[int, object] = values.unset, + machine_detection_max_word_length: Union[int, object] = values.unset, + machine_detection_words_silence: Union[int, object] = values.unset, + machine_detection_max_num_of_words: Union[int, object] = values.unset, + machine_detection_silence_threshold: Union[int, object] = values.unset, trim: Union[str, object] = values.unset, call_token: Union[str, object] = values.unset, client_notification_url: Union[str, object] = values.unset, @@ -1665,6 +1739,7 @@ async def create_async( :param caller_id: The phone number, Client identifier, or username portion of SIP address that made this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). Client identifiers are formatted `client:name`. If using a phone number, it must be a Twilio number or a Verified [outgoing caller id](https://www.twilio.com/docs/voice/api/outgoing-caller-ids) for your account. If the `to` parameter is a phone number, `callerId` must also be a phone number. If `to` is sip address, this value of `callerId` should be a username portion to be used to populate the From header that is passed to the SIP endpoint. :param call_reason: The Reason for the outgoing call. Use it to specify the purpose of the call that is presented on the called party's phone. (Branded Calls Beta) :param recording_track: The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is sent from Twilio. `both` records the audio that is received and sent by Twilio. + :param recording_configuration_id: The identifier of the configuration to be used when creating and processing the recording :param time_limit: The maximum duration of the call in seconds. Constraints depend on account and configuration. :param machine_detection: Whether to detect if a human, answering machine, or fax has picked up the call. Can be: `Enable` or `DetectMessageEnd`. Use `Enable` if you would like us to return `AnsweredBy` as soon as the called party is identified. Use `DetectMessageEnd`, if you would like to leave a message on an answering machine. For more information, see [Answering Machine Detection](https://www.twilio.com/docs/voice/answering-machine-detection). :param machine_detection_timeout: The number of seconds that we should attempt to detect an answering machine before timing out and sending a voice request with `AnsweredBy` of `unknown`. The default timeout is 30 seconds. @@ -1673,6 +1748,12 @@ async def create_async( :param machine_detection_silence_timeout: The number of milliseconds of initial silence after which an `unknown` AnsweredBy result will be returned. Possible Values: 2000-10000. Default: 5000. :param amd_status_callback: The URL that we should call using the `amd_status_callback_method` to notify customer application whether the call was answered by human, machine or fax. :param amd_status_callback_method: The HTTP method we should use when calling the `amd_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. + :param machine_detection_engine: Select answering machine detection engine. Can be: `Lumenvox` or `Asterisk`. Default: `Lumenvox`. + :param machine_detection_min_word_length: The minimum duration in milliseconds of voice to be considered as a word. Default: 100. + :param machine_detection_max_word_length: The maximum duration in milliseconds of a word to accept. Default: 5000. + :param machine_detection_words_silence: The minimum duration in milliseconds of silence after a word to consider the audio what follows as a new word. Default: 50. + :param machine_detection_max_num_of_words: The maximum number of words in the greeting. If exceeded, then it's considered as MACHINE. Default: 5. + :param machine_detection_silence_threshold: The silence threshold. Default: 256. :param trim: Whether to trim any leading and trailing silence from the participant recording. Can be: `trim-silence` or `do-not-trim` and the default is `trim-silence`. :param call_token: A token string needed to invoke a forwarded call. A call_token is generated when an incoming call is received on a Twilio number. Pass an incoming call's call_token value to a forwarded call via the call_token parameter when creating a new call. A forwarded call should bear the same CallerID of the original incoming call. :param client_notification_url: The URL that we should use to deliver `push call notification`. @@ -1719,6 +1800,7 @@ async def create_async( caller_id=caller_id, call_reason=call_reason, recording_track=recording_track, + recording_configuration_id=recording_configuration_id, time_limit=time_limit, machine_detection=machine_detection, machine_detection_timeout=machine_detection_timeout, @@ -1727,6 +1809,12 @@ async def create_async( machine_detection_silence_timeout=machine_detection_silence_timeout, amd_status_callback=amd_status_callback, amd_status_callback_method=amd_status_callback_method, + machine_detection_engine=machine_detection_engine, + machine_detection_min_word_length=machine_detection_min_word_length, + machine_detection_max_word_length=machine_detection_max_word_length, + machine_detection_words_silence=machine_detection_words_silence, + machine_detection_max_num_of_words=machine_detection_max_num_of_words, + machine_detection_silence_threshold=machine_detection_silence_threshold, trim=trim, call_token=call_token, client_notification_url=client_notification_url, @@ -1781,6 +1869,7 @@ async def create_with_http_info_async( caller_id: Union[str, object] = values.unset, call_reason: Union[str, object] = values.unset, recording_track: Union[str, object] = values.unset, + recording_configuration_id: Union[str, object] = values.unset, time_limit: Union[int, object] = values.unset, machine_detection: Union[str, object] = values.unset, machine_detection_timeout: Union[int, object] = values.unset, @@ -1789,6 +1878,12 @@ async def create_with_http_info_async( machine_detection_silence_timeout: Union[int, object] = values.unset, amd_status_callback: Union[str, object] = values.unset, amd_status_callback_method: Union[str, object] = values.unset, + machine_detection_engine: Union[str, object] = values.unset, + machine_detection_min_word_length: Union[int, object] = values.unset, + machine_detection_max_word_length: Union[int, object] = values.unset, + machine_detection_words_silence: Union[int, object] = values.unset, + machine_detection_max_num_of_words: Union[int, object] = values.unset, + machine_detection_silence_threshold: Union[int, object] = values.unset, trim: Union[str, object] = values.unset, call_token: Union[str, object] = values.unset, client_notification_url: Union[str, object] = values.unset, @@ -1835,6 +1930,7 @@ async def create_with_http_info_async( :param caller_id: The phone number, Client identifier, or username portion of SIP address that made this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). Client identifiers are formatted `client:name`. If using a phone number, it must be a Twilio number or a Verified [outgoing caller id](https://www.twilio.com/docs/voice/api/outgoing-caller-ids) for your account. If the `to` parameter is a phone number, `callerId` must also be a phone number. If `to` is sip address, this value of `callerId` should be a username portion to be used to populate the From header that is passed to the SIP endpoint. :param call_reason: The Reason for the outgoing call. Use it to specify the purpose of the call that is presented on the called party's phone. (Branded Calls Beta) :param recording_track: The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is sent from Twilio. `both` records the audio that is received and sent by Twilio. + :param recording_configuration_id: The identifier of the configuration to be used when creating and processing the recording :param time_limit: The maximum duration of the call in seconds. Constraints depend on account and configuration. :param machine_detection: Whether to detect if a human, answering machine, or fax has picked up the call. Can be: `Enable` or `DetectMessageEnd`. Use `Enable` if you would like us to return `AnsweredBy` as soon as the called party is identified. Use `DetectMessageEnd`, if you would like to leave a message on an answering machine. For more information, see [Answering Machine Detection](https://www.twilio.com/docs/voice/answering-machine-detection). :param machine_detection_timeout: The number of seconds that we should attempt to detect an answering machine before timing out and sending a voice request with `AnsweredBy` of `unknown`. The default timeout is 30 seconds. @@ -1843,6 +1939,12 @@ async def create_with_http_info_async( :param machine_detection_silence_timeout: The number of milliseconds of initial silence after which an `unknown` AnsweredBy result will be returned. Possible Values: 2000-10000. Default: 5000. :param amd_status_callback: The URL that we should call using the `amd_status_callback_method` to notify customer application whether the call was answered by human, machine or fax. :param amd_status_callback_method: The HTTP method we should use when calling the `amd_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. + :param machine_detection_engine: Select answering machine detection engine. Can be: `Lumenvox` or `Asterisk`. Default: `Lumenvox`. + :param machine_detection_min_word_length: The minimum duration in milliseconds of voice to be considered as a word. Default: 100. + :param machine_detection_max_word_length: The maximum duration in milliseconds of a word to accept. Default: 5000. + :param machine_detection_words_silence: The minimum duration in milliseconds of silence after a word to consider the audio what follows as a new word. Default: 50. + :param machine_detection_max_num_of_words: The maximum number of words in the greeting. If exceeded, then it's considered as MACHINE. Default: 5. + :param machine_detection_silence_threshold: The silence threshold. Default: 256. :param trim: Whether to trim any leading and trailing silence from the participant recording. Can be: `trim-silence` or `do-not-trim` and the default is `trim-silence`. :param call_token: A token string needed to invoke a forwarded call. A call_token is generated when an incoming call is received on a Twilio number. Pass an incoming call's call_token value to a forwarded call via the call_token parameter when creating a new call. A forwarded call should bear the same CallerID of the original incoming call. :param client_notification_url: The URL that we should use to deliver `push call notification`. @@ -1889,6 +1991,7 @@ async def create_with_http_info_async( caller_id=caller_id, call_reason=call_reason, recording_track=recording_track, + recording_configuration_id=recording_configuration_id, time_limit=time_limit, machine_detection=machine_detection, machine_detection_timeout=machine_detection_timeout, @@ -1897,6 +2000,12 @@ async def create_with_http_info_async( machine_detection_silence_timeout=machine_detection_silence_timeout, amd_status_callback=amd_status_callback, amd_status_callback_method=amd_status_callback_method, + machine_detection_engine=machine_detection_engine, + machine_detection_min_word_length=machine_detection_min_word_length, + machine_detection_max_word_length=machine_detection_max_word_length, + machine_detection_words_silence=machine_detection_words_silence, + machine_detection_max_num_of_words=machine_detection_max_num_of_words, + machine_detection_silence_threshold=machine_detection_silence_threshold, trim=trim, call_token=call_token, client_notification_url=client_notification_url, @@ -2343,10 +2452,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ParticipantPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/conference/recording.py b/twilio/rest/api/v2010/account/conference/recording.py index 4cf3a713e..72c3dfa37 100644 --- a/twilio/rest/api/v2010/account/conference/recording.py +++ b/twilio/rest/api/v2010/account/conference/recording.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import date, datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values @@ -24,7 +25,6 @@ class RecordingInstance(InstanceResource): - class Source(object): DIALVERB = "DialVerb" CONFERENCE = "Conference" @@ -198,72 +198,84 @@ def update( self, status: "RecordingInstance.Status", pause_behavior: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, ) -> "RecordingInstance": """ Update the RecordingInstance :param status: :param pause_behavior: Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`. + :param play_beep: :returns: The updated RecordingInstance """ return self._proxy.update( status=status, pause_behavior=pause_behavior, + play_beep=play_beep, ) async def update_async( self, status: "RecordingInstance.Status", pause_behavior: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, ) -> "RecordingInstance": """ Asynchronous coroutine to update the RecordingInstance :param status: :param pause_behavior: Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`. + :param play_beep: :returns: The updated RecordingInstance """ return await self._proxy.update_async( status=status, pause_behavior=pause_behavior, + play_beep=play_beep, ) def update_with_http_info( self, status: "RecordingInstance.Status", pause_behavior: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, ) -> ApiResponse: """ Update the RecordingInstance with HTTP info :param status: :param pause_behavior: Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`. + :param play_beep: :returns: ApiResponse with instance, status code, and headers """ return self._proxy.update_with_http_info( status=status, pause_behavior=pause_behavior, + play_beep=play_beep, ) async def update_with_http_info_async( self, status: "RecordingInstance.Status", pause_behavior: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, ) -> ApiResponse: """ Asynchronous coroutine to update the RecordingInstance with HTTP info :param status: :param pause_behavior: Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`. + :param play_beep: :returns: ApiResponse with instance, status code, and headers """ return await self._proxy.update_with_http_info_async( status=status, pause_behavior=pause_behavior, + play_beep=play_beep, ) def __repr__(self) -> str: @@ -277,7 +289,6 @@ def __repr__(self) -> str: class RecordingContext(InstanceContext): - def __init__( self, version: Version, account_sid: str, conference_sid: str, sid: str ): @@ -471,6 +482,7 @@ def _update( self, status: "RecordingInstance.Status", pause_behavior: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, ) -> tuple: """ Internal helper for update operation @@ -483,6 +495,7 @@ def _update( { "Status": status, "PauseBehavior": pause_behavior, + "PlayBeep": serialize.boolean_to_string(play_beep), } ) headers = values.of({}) @@ -499,16 +512,20 @@ def update( self, status: "RecordingInstance.Status", pause_behavior: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, ) -> RecordingInstance: """ Update the RecordingInstance :param status: :param pause_behavior: Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`. + :param play_beep: :returns: The updated RecordingInstance """ - payload, _, _ = self._update(status=status, pause_behavior=pause_behavior) + payload, _, _ = self._update( + status=status, pause_behavior=pause_behavior, play_beep=play_beep + ) return RecordingInstance( self._version, payload, @@ -521,17 +538,19 @@ def update_with_http_info( self, status: "RecordingInstance.Status", pause_behavior: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, ) -> ApiResponse: """ Update the RecordingInstance and return response metadata :param status: :param pause_behavior: Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`. + :param play_beep: :returns: ApiResponse with instance, status code, and headers """ payload, status_code, headers = self._update( - status=status, pause_behavior=pause_behavior + status=status, pause_behavior=pause_behavior, play_beep=play_beep ) instance = RecordingInstance( self._version, @@ -546,6 +565,7 @@ async def _update_async( self, status: "RecordingInstance.Status", pause_behavior: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, ) -> tuple: """ Internal async helper for update operation @@ -558,6 +578,7 @@ async def _update_async( { "Status": status, "PauseBehavior": pause_behavior, + "PlayBeep": serialize.boolean_to_string(play_beep), } ) headers = values.of({}) @@ -574,17 +595,19 @@ async def update_async( self, status: "RecordingInstance.Status", pause_behavior: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, ) -> RecordingInstance: """ Asynchronous coroutine to update the RecordingInstance :param status: :param pause_behavior: Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`. + :param play_beep: :returns: The updated RecordingInstance """ payload, _, _ = await self._update_async( - status=status, pause_behavior=pause_behavior + status=status, pause_behavior=pause_behavior, play_beep=play_beep ) return RecordingInstance( self._version, @@ -598,17 +621,19 @@ async def update_with_http_info_async( self, status: "RecordingInstance.Status", pause_behavior: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, ) -> ApiResponse: """ Asynchronous coroutine to update the RecordingInstance and return response metadata :param status: :param pause_behavior: Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`. + :param play_beep: :returns: ApiResponse with instance, status code, and headers """ payload, status_code, headers = await self._update_async( - status=status, pause_behavior=pause_behavior + status=status, pause_behavior=pause_behavior, play_beep=play_beep ) instance = RecordingInstance( self._version, @@ -630,7 +655,6 @@ def __repr__(self) -> str: class RecordingPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> RecordingInstance: """ Build an instance of RecordingInstance @@ -654,7 +678,6 @@ def __repr__(self) -> str: class RecordingList(ListResource): - def __init__(self, version: Version, account_sid: str, conference_sid: str): """ Initialize the RecordingList @@ -675,6 +698,228 @@ def __init__(self, version: Version, account_sid: str, conference_sid: str): **self._solution ) + def _create( + self, + recording_status_callback_event: Union[List[str], object] = values.unset, + recording_status_callback: Union[str, object] = values.unset, + recording_status_callback_method: Union[str, object] = values.unset, + trim: Union[str, object] = values.unset, + recording_configuration_id: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, + ) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "RecordingStatusCallbackEvent": serialize.map( + recording_status_callback_event, lambda e: e + ), + "RecordingStatusCallback": recording_status_callback, + "RecordingStatusCallbackMethod": recording_status_callback_method, + "Trim": trim, + "RecordingConfigurationId": recording_configuration_id, + "PlayBeep": serialize.boolean_to_string(play_beep), + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, + recording_status_callback_event: Union[List[str], object] = values.unset, + recording_status_callback: Union[str, object] = values.unset, + recording_status_callback_method: Union[str, object] = values.unset, + trim: Union[str, object] = values.unset, + recording_configuration_id: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, + ) -> RecordingInstance: + """ + Create the RecordingInstance + + :param recording_status_callback_event: The recording status events on which we should call the `recording_status_callback` URL. Can be: `in-progress`, `completed` and `absent` and the default is `completed`. Separate multiple event values with a space. + :param recording_status_callback: The URL we should call when the recording events specified in parameter `recording_status_callback_event` occur. + :param recording_status_callback_method: The HTTP method we should use to call `recording_status_callback`. Can be: `GET` or `POST` and the default is `POST`. + :param trim: Whether to trim any leading and trailing silence in the recording. Can be: `trim-silence` or `do-not-trim` and the default is `do-not-trim`. `trim-silence` trims the silence from the beginning and end of the recording and `do-not-trim` does not. + :param recording_configuration_id: The identifier of the configuration to be used when creating and processing the recording + :param play_beep: + + :returns: The created RecordingInstance + """ + payload, _, _ = self._create( + recording_status_callback_event=recording_status_callback_event, + recording_status_callback=recording_status_callback, + recording_status_callback_method=recording_status_callback_method, + trim=trim, + recording_configuration_id=recording_configuration_id, + play_beep=play_beep, + ) + return RecordingInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + conference_sid=self._solution["conference_sid"], + ) + + def create_with_http_info( + self, + recording_status_callback_event: Union[List[str], object] = values.unset, + recording_status_callback: Union[str, object] = values.unset, + recording_status_callback_method: Union[str, object] = values.unset, + trim: Union[str, object] = values.unset, + recording_configuration_id: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, + ) -> ApiResponse: + """ + Create the RecordingInstance and return response metadata + + :param recording_status_callback_event: The recording status events on which we should call the `recording_status_callback` URL. Can be: `in-progress`, `completed` and `absent` and the default is `completed`. Separate multiple event values with a space. + :param recording_status_callback: The URL we should call when the recording events specified in parameter `recording_status_callback_event` occur. + :param recording_status_callback_method: The HTTP method we should use to call `recording_status_callback`. Can be: `GET` or `POST` and the default is `POST`. + :param trim: Whether to trim any leading and trailing silence in the recording. Can be: `trim-silence` or `do-not-trim` and the default is `do-not-trim`. `trim-silence` trims the silence from the beginning and end of the recording and `do-not-trim` does not. + :param recording_configuration_id: The identifier of the configuration to be used when creating and processing the recording + :param play_beep: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create( + recording_status_callback_event=recording_status_callback_event, + recording_status_callback=recording_status_callback, + recording_status_callback_method=recording_status_callback_method, + trim=trim, + recording_configuration_id=recording_configuration_id, + play_beep=play_beep, + ) + instance = RecordingInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + conference_sid=self._solution["conference_sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async( + self, + recording_status_callback_event: Union[List[str], object] = values.unset, + recording_status_callback: Union[str, object] = values.unset, + recording_status_callback_method: Union[str, object] = values.unset, + trim: Union[str, object] = values.unset, + recording_configuration_id: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, + ) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "RecordingStatusCallbackEvent": serialize.map( + recording_status_callback_event, lambda e: e + ), + "RecordingStatusCallback": recording_status_callback, + "RecordingStatusCallbackMethod": recording_status_callback_method, + "Trim": trim, + "RecordingConfigurationId": recording_configuration_id, + "PlayBeep": serialize.boolean_to_string(play_beep), + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, + recording_status_callback_event: Union[List[str], object] = values.unset, + recording_status_callback: Union[str, object] = values.unset, + recording_status_callback_method: Union[str, object] = values.unset, + trim: Union[str, object] = values.unset, + recording_configuration_id: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, + ) -> RecordingInstance: + """ + Asynchronously create the RecordingInstance + + :param recording_status_callback_event: The recording status events on which we should call the `recording_status_callback` URL. Can be: `in-progress`, `completed` and `absent` and the default is `completed`. Separate multiple event values with a space. + :param recording_status_callback: The URL we should call when the recording events specified in parameter `recording_status_callback_event` occur. + :param recording_status_callback_method: The HTTP method we should use to call `recording_status_callback`. Can be: `GET` or `POST` and the default is `POST`. + :param trim: Whether to trim any leading and trailing silence in the recording. Can be: `trim-silence` or `do-not-trim` and the default is `do-not-trim`. `trim-silence` trims the silence from the beginning and end of the recording and `do-not-trim` does not. + :param recording_configuration_id: The identifier of the configuration to be used when creating and processing the recording + :param play_beep: + + :returns: The created RecordingInstance + """ + payload, _, _ = await self._create_async( + recording_status_callback_event=recording_status_callback_event, + recording_status_callback=recording_status_callback, + recording_status_callback_method=recording_status_callback_method, + trim=trim, + recording_configuration_id=recording_configuration_id, + play_beep=play_beep, + ) + return RecordingInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + conference_sid=self._solution["conference_sid"], + ) + + async def create_with_http_info_async( + self, + recording_status_callback_event: Union[List[str], object] = values.unset, + recording_status_callback: Union[str, object] = values.unset, + recording_status_callback_method: Union[str, object] = values.unset, + trim: Union[str, object] = values.unset, + recording_configuration_id: Union[str, object] = values.unset, + play_beep: Union[bool, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously create the RecordingInstance and return response metadata + + :param recording_status_callback_event: The recording status events on which we should call the `recording_status_callback` URL. Can be: `in-progress`, `completed` and `absent` and the default is `completed`. Separate multiple event values with a space. + :param recording_status_callback: The URL we should call when the recording events specified in parameter `recording_status_callback_event` occur. + :param recording_status_callback_method: The HTTP method we should use to call `recording_status_callback`. Can be: `GET` or `POST` and the default is `POST`. + :param trim: Whether to trim any leading and trailing silence in the recording. Can be: `trim-silence` or `do-not-trim` and the default is `do-not-trim`. `trim-silence` trims the silence from the beginning and end of the recording and `do-not-trim` does not. + :param recording_configuration_id: The identifier of the configuration to be used when creating and processing the recording + :param play_beep: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + recording_status_callback_event=recording_status_callback_event, + recording_status_callback=recording_status_callback, + recording_status_callback_method=recording_status_callback_method, + trim=trim, + recording_configuration_id=recording_configuration_id, + play_beep=play_beep, + ) + instance = RecordingInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + conference_sid=self._solution["conference_sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + def stream( self, date_created: Union[date, object] = values.unset, @@ -1120,10 +1365,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = RecordingPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/connect_app.py b/twilio/rest/api/v2010/account/connect_app.py index 3173986bd..000525372 100644 --- a/twilio/rest/api/v2010/account/connect_app.py +++ b/twilio/rest/api/v2010/account/connect_app.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -23,7 +24,6 @@ class ConnectAppInstance(InstanceResource): - class Permission(object): GET_ALL = "get-all" POST_ALL = "post-all" @@ -328,7 +328,6 @@ def __repr__(self) -> str: class ConnectAppContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the ConnectAppContext @@ -783,7 +782,6 @@ def __repr__(self) -> str: class ConnectAppPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ConnectAppInstance: """ Build an instance of ConnectAppInstance @@ -804,7 +802,6 @@ def __repr__(self) -> str: class ConnectAppList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the ConnectAppList @@ -1152,10 +1149,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ConnectAppPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py b/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py index a159a0e51..25aeb79de 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py @@ -12,6 +12,7 @@ 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 @@ -30,7 +31,6 @@ class IncomingPhoneNumberInstance(InstanceResource): - class AddressRequirement(object): NONE = "none" ANY = "any" @@ -89,6 +89,7 @@ class VoiceReceiveMode(object): :ivar bundle_sid: The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. :ivar status: :ivar type: The phone number type. + :ivar subresource_uris: """ def __init__( @@ -151,6 +152,9 @@ def __init__( self.bundle_sid: Optional[str] = payload.get("bundle_sid") self.status: Optional[str] = payload.get("status") self.type: Optional[str] = payload.get("type") + self.subresource_uris: Optional[Dict[str, object]] = payload.get( + "subresource_uris" + ) self._solution = { "account_sid": account_sid, @@ -604,7 +608,6 @@ def __repr__(self) -> str: class IncomingPhoneNumberContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the IncomingPhoneNumberContext @@ -1330,7 +1333,6 @@ def __repr__(self) -> str: class IncomingPhoneNumberPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> IncomingPhoneNumberInstance: """ Build an instance of IncomingPhoneNumberInstance @@ -1351,7 +1353,6 @@ def __repr__(self) -> str: class IncomingPhoneNumberList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the IncomingPhoneNumberList @@ -2377,10 +2378,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = IncomingPhoneNumberPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__init__.py b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__init__.py index e1edda848..8582fcd5e 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__init__.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__init__.py @@ -12,6 +12,7 @@ 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 @@ -27,6 +28,7 @@ class AssignedAddOnInstance(InstanceResource): + """ :ivar sid: The unique string that that we created to identify the resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. @@ -183,7 +185,6 @@ def __repr__(self) -> str: class AssignedAddOnContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, resource_sid: str, sid: str): """ Initialize the AssignedAddOnContext @@ -398,7 +399,6 @@ def __repr__(self) -> str: class AssignedAddOnPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> AssignedAddOnInstance: """ Build an instance of AssignedAddOnInstance @@ -422,7 +422,6 @@ def __repr__(self) -> str: class AssignedAddOnList(ListResource): - def __init__(self, version: Version, account_sid: str, resource_sid: str): """ Initialize the AssignedAddOnList @@ -894,10 +893,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AssignedAddOnPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py index 92212408e..561301a76 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class AssignedAddOnExtensionInstance(InstanceResource): + """ :ivar sid: The unique string that that we created to identify the resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. @@ -129,7 +131,6 @@ def __repr__(self) -> str: class AssignedAddOnExtensionContext(InstanceContext): - def __init__( self, version: Version, @@ -273,7 +274,6 @@ def __repr__(self) -> str: class AssignedAddOnExtensionPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> AssignedAddOnExtensionInstance: """ Build an instance of AssignedAddOnExtensionInstance @@ -298,7 +298,6 @@ def __repr__(self) -> str: class AssignedAddOnExtensionList(ListResource): - def __init__( self, version: Version, @@ -658,10 +657,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AssignedAddOnExtensionPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/local.py b/twilio/rest/api/v2010/account/incoming_phone_number/local.py index 062c3bea6..a7f1c556f 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/local.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/local.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class LocalInstance(InstanceResource): - class AddressRequirement(object): NONE = "none" ANY = "any" @@ -89,9 +89,9 @@ def __init__(self, version: Version, payload: Dict[str, Any], account_sid: str): self.account_sid: Optional[str] = payload.get("account_sid") self.address_sid: Optional[str] = payload.get("address_sid") - self.address_requirements: Optional["LocalInstance.AddressRequirement"] = ( - payload.get("address_requirements") - ) + self.address_requirements: Optional[ + "LocalInstance.AddressRequirement" + ] = payload.get("address_requirements") self.api_version: Optional[str] = payload.get("api_version") self.beta: Optional[bool] = payload.get("beta") self.capabilities: Optional[str] = payload.get("capabilities") @@ -117,9 +117,9 @@ def __init__(self, version: Version, payload: Dict[str, Any], account_sid: str): ) self.trunk_sid: Optional[str] = payload.get("trunk_sid") self.uri: Optional[str] = payload.get("uri") - self.voice_receive_mode: Optional["LocalInstance.VoiceReceiveMode"] = ( - payload.get("voice_receive_mode") - ) + self.voice_receive_mode: Optional[ + "LocalInstance.VoiceReceiveMode" + ] = payload.get("voice_receive_mode") self.voice_application_sid: Optional[str] = payload.get("voice_application_sid") self.voice_caller_id_lookup: Optional[bool] = payload.get( "voice_caller_id_lookup" @@ -153,7 +153,6 @@ def __repr__(self) -> str: class LocalPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> LocalInstance: """ Build an instance of LocalInstance @@ -174,7 +173,6 @@ def __repr__(self) -> str: class LocalList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the LocalList @@ -1168,10 +1166,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = LocalPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py b/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py index 0d7597fd0..f92307630 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class MobileInstance(InstanceResource): - class AddressRequirement(object): NONE = "none" ANY = "any" @@ -89,9 +89,9 @@ def __init__(self, version: Version, payload: Dict[str, Any], account_sid: str): self.account_sid: Optional[str] = payload.get("account_sid") self.address_sid: Optional[str] = payload.get("address_sid") - self.address_requirements: Optional["MobileInstance.AddressRequirement"] = ( - payload.get("address_requirements") - ) + self.address_requirements: Optional[ + "MobileInstance.AddressRequirement" + ] = payload.get("address_requirements") self.api_version: Optional[str] = payload.get("api_version") self.beta: Optional[bool] = payload.get("beta") self.capabilities: Optional[str] = payload.get("capabilities") @@ -117,9 +117,9 @@ def __init__(self, version: Version, payload: Dict[str, Any], account_sid: str): ) self.trunk_sid: Optional[str] = payload.get("trunk_sid") self.uri: Optional[str] = payload.get("uri") - self.voice_receive_mode: Optional["MobileInstance.VoiceReceiveMode"] = ( - payload.get("voice_receive_mode") - ) + self.voice_receive_mode: Optional[ + "MobileInstance.VoiceReceiveMode" + ] = payload.get("voice_receive_mode") self.voice_application_sid: Optional[str] = payload.get("voice_application_sid") self.voice_caller_id_lookup: Optional[bool] = payload.get( "voice_caller_id_lookup" @@ -153,7 +153,6 @@ def __repr__(self) -> str: class MobilePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> MobileInstance: """ Build an instance of MobileInstance @@ -174,7 +173,6 @@ def __repr__(self) -> str: class MobileList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the MobileList @@ -1180,10 +1178,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = MobilePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py b/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py index 9458a318e..3a6bfe5bb 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class TollFreeInstance(InstanceResource): - class AddressRequirement(object): NONE = "none" ANY = "any" @@ -89,9 +89,9 @@ def __init__(self, version: Version, payload: Dict[str, Any], account_sid: str): self.account_sid: Optional[str] = payload.get("account_sid") self.address_sid: Optional[str] = payload.get("address_sid") - self.address_requirements: Optional["TollFreeInstance.AddressRequirement"] = ( - payload.get("address_requirements") - ) + self.address_requirements: Optional[ + "TollFreeInstance.AddressRequirement" + ] = payload.get("address_requirements") self.api_version: Optional[str] = payload.get("api_version") self.beta: Optional[bool] = payload.get("beta") self.capabilities: Optional[str] = payload.get("capabilities") @@ -117,9 +117,9 @@ def __init__(self, version: Version, payload: Dict[str, Any], account_sid: str): ) self.trunk_sid: Optional[str] = payload.get("trunk_sid") self.uri: Optional[str] = payload.get("uri") - self.voice_receive_mode: Optional["TollFreeInstance.VoiceReceiveMode"] = ( - payload.get("voice_receive_mode") - ) + self.voice_receive_mode: Optional[ + "TollFreeInstance.VoiceReceiveMode" + ] = payload.get("voice_receive_mode") self.voice_application_sid: Optional[str] = payload.get("voice_application_sid") self.voice_caller_id_lookup: Optional[bool] = payload.get( "voice_caller_id_lookup" @@ -128,9 +128,9 @@ def __init__(self, version: Version, payload: Dict[str, Any], account_sid: str): self.voice_fallback_url: Optional[str] = payload.get("voice_fallback_url") self.voice_method: Optional[str] = payload.get("voice_method") self.voice_url: Optional[str] = payload.get("voice_url") - self.emergency_status: Optional["TollFreeInstance.EmergencyStatus"] = ( - payload.get("emergency_status") - ) + self.emergency_status: Optional[ + "TollFreeInstance.EmergencyStatus" + ] = payload.get("emergency_status") self.emergency_address_sid: Optional[str] = payload.get("emergency_address_sid") self.emergency_address_status: Optional[ "TollFreeInstance.EmergencyAddressStatus" @@ -153,7 +153,6 @@ def __repr__(self) -> str: class TollFreePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> TollFreeInstance: """ Build an instance of TollFreeInstance @@ -174,7 +173,6 @@ def __repr__(self) -> str: class TollFreeList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the TollFreeList @@ -1180,10 +1178,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = TollFreePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/key.py b/twilio/rest/api/v2010/account/key.py index 68b6d82d6..1ea6b350b 100644 --- a/twilio/rest/api/v2010/account/key.py +++ b/twilio/rest/api/v2010/account/key.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class KeyInstance(InstanceResource): + """ :ivar sid: The unique string that that we created to identify the Key resource. :ivar friendly_name: The string that you assigned to describe the resource. @@ -208,7 +210,6 @@ def __repr__(self) -> str: class KeyContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the KeyContext @@ -521,7 +522,6 @@ def __repr__(self) -> str: class KeyPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> KeyInstance: """ Build an instance of KeyInstance @@ -542,7 +542,6 @@ def __repr__(self) -> str: class KeyList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the KeyList @@ -890,10 +889,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = KeyPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/message/__init__.py b/twilio/rest/api/v2010/account/message/__init__.py index 36366f090..e720ea462 100644 --- a/twilio/rest/api/v2010/account/message/__init__.py +++ b/twilio/rest/api/v2010/account/message/__init__.py @@ -12,6 +12,7 @@ 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 @@ -26,7 +27,6 @@ class MessageInstance(InstanceResource): - class AddressRetention(object): RETAIN = "retain" OBFUSCATE = "obfuscate" @@ -90,6 +90,7 @@ class UpdateStatus(object): :ivar price_unit: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). :ivar api_version: The API version used to process the Message :ivar subresource_uris: A list of related resources identified by their URIs relative to `https://api.twilio.com` + :ivar tags: A string containing a JSON map of key value pairs of tags to be recorded as metadata for the message. """ def __init__( @@ -129,6 +130,7 @@ def __init__( self.subresource_uris: Optional[Dict[str, object]] = payload.get( "subresource_uris" ) + self.tags: Optional[Dict[str, object]] = payload.get("tags") self._solution = { "account_sid": account_sid, @@ -321,7 +323,6 @@ def __repr__(self) -> str: class MessageContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the MessageContext @@ -687,7 +688,6 @@ def __repr__(self) -> str: class MessagePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> MessageInstance: """ Build an instance of MessageInstance @@ -708,7 +708,6 @@ def __repr__(self) -> str: class MessageList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the MessageList @@ -734,7 +733,9 @@ def _create( provide_feedback: Union[bool, object] = values.unset, attempt: Union[int, object] = values.unset, validity_period: Union[int, object] = values.unset, + max_rate: Union[str, object] = values.unset, force_delivery: Union[bool, object] = values.unset, + provider_sid: Union[str, object] = values.unset, content_retention: Union[ "MessageInstance.ContentRetention", object ] = values.unset, @@ -743,12 +744,22 @@ def _create( ] = values.unset, smart_encoded: Union[bool, object] = values.unset, persistent_action: Union[List[str], object] = values.unset, + interactive_data: Union[str, object] = values.unset, + force_opt_in: Union[bool, object] = values.unset, traffic_type: Union["MessageInstance.TrafficType", object] = values.unset, shorten_urls: Union[bool, object] = values.unset, schedule_type: Union["MessageInstance.ScheduleType", object] = values.unset, send_at: Union[datetime, object] = values.unset, + optimize_start_at: Union[datetime, object] = values.unset, + optimize_end_at: Union[datetime, object] = values.unset, + invoice_tag: Union[str, object] = values.unset, send_as_mms: Union[bool, object] = values.unset, content_variables: Union[str, object] = values.unset, + message_intent: Union[str, object] = values.unset, + dlt_pe_id: Union[str, object] = values.unset, + dlt_template_id: Union[str, object] = values.unset, + subject: Union[str, object] = values.unset, + tags: Union[str, object] = values.unset, risk_check: Union["MessageInstance.RiskCheck", object] = values.unset, from_: Union[str, object] = values.unset, messaging_service_sid: Union[str, object] = values.unset, @@ -772,17 +783,29 @@ def _create( "ProvideFeedback": serialize.boolean_to_string(provide_feedback), "Attempt": attempt, "ValidityPeriod": validity_period, + "MaxRate": max_rate, "ForceDelivery": serialize.boolean_to_string(force_delivery), + "ProviderSid": provider_sid, "ContentRetention": content_retention, "AddressRetention": address_retention, "SmartEncoded": serialize.boolean_to_string(smart_encoded), "PersistentAction": serialize.map(persistent_action, lambda e: e), + "InteractiveData": interactive_data, + "ForceOptIn": serialize.boolean_to_string(force_opt_in), "TrafficType": traffic_type, "ShortenUrls": serialize.boolean_to_string(shorten_urls), "ScheduleType": schedule_type, "SendAt": serialize.iso8601_datetime(send_at), + "OptimizeStartAt": serialize.iso8601_datetime(optimize_start_at), + "OptimizeEndAt": serialize.iso8601_datetime(optimize_end_at), + "InvoiceTag": invoice_tag, "SendAsMms": serialize.boolean_to_string(send_as_mms), "ContentVariables": content_variables, + "MessageIntent": message_intent, + "DltPEId": dlt_pe_id, + "DltTemplateId": dlt_template_id, + "Subject": subject, + "Tags": tags, "RiskCheck": risk_check, "From": from_, "MessagingServiceSid": messaging_service_sid, @@ -810,7 +833,9 @@ def create( provide_feedback: Union[bool, object] = values.unset, attempt: Union[int, object] = values.unset, validity_period: Union[int, object] = values.unset, + max_rate: Union[str, object] = values.unset, force_delivery: Union[bool, object] = values.unset, + provider_sid: Union[str, object] = values.unset, content_retention: Union[ "MessageInstance.ContentRetention", object ] = values.unset, @@ -819,12 +844,22 @@ def create( ] = values.unset, smart_encoded: Union[bool, object] = values.unset, persistent_action: Union[List[str], object] = values.unset, + interactive_data: Union[str, object] = values.unset, + force_opt_in: Union[bool, object] = values.unset, traffic_type: Union["MessageInstance.TrafficType", object] = values.unset, shorten_urls: Union[bool, object] = values.unset, schedule_type: Union["MessageInstance.ScheduleType", object] = values.unset, send_at: Union[datetime, object] = values.unset, + optimize_start_at: Union[datetime, object] = values.unset, + optimize_end_at: Union[datetime, object] = values.unset, + invoice_tag: Union[str, object] = values.unset, send_as_mms: Union[bool, object] = values.unset, content_variables: Union[str, object] = values.unset, + message_intent: Union[str, object] = values.unset, + dlt_pe_id: Union[str, object] = values.unset, + dlt_template_id: Union[str, object] = values.unset, + subject: Union[str, object] = values.unset, + tags: Union[str, object] = values.unset, risk_check: Union["MessageInstance.RiskCheck", object] = values.unset, from_: Union[str, object] = values.unset, messaging_service_sid: Union[str, object] = values.unset, @@ -842,17 +877,29 @@ def create( :param provide_feedback: Boolean indicating whether or not you intend to provide delivery confirmation feedback to Twilio (used in conjunction with the [Message Feedback subresource](https://www.twilio.com/docs/sms/api/message-feedback-resource)). Default value is `false`. :param attempt: Total number of attempts made (including this request) to send the message regardless of the provider used :param validity_period: The maximum length in seconds that the Message can remain in Twilio's outgoing message queue. If a queued Message exceeds the `validity_period`, the Message is not sent. Accepted values are integers from `1` to `36000`. Default value is `36000`. A `validity_period` greater than `5` is recommended. [Learn more about the validity period](https://www.twilio.com/blog/take-more-control-of-outbound-messages-using-validity-period-html) + :param max_rate: :param force_delivery: Reserved + :param provider_sid: :param content_retention: :param address_retention: :param smart_encoded: Whether to detect Unicode characters that have a similar GSM-7 character and replace them. Can be: `true` or `false`. :param persistent_action: Rich actions for non-SMS/MMS channels. Used for [sending location in WhatsApp messages](https://www.twilio.com/docs/whatsapp/message-features#location-messages-with-whatsapp). + :param interactive_data: + :param force_opt_in: :param traffic_type: :param shorten_urls: For Messaging Services with [Link Shortening configured](https://www.twilio.com/docs/messaging/features/link-shortening) only: A Boolean indicating whether or not Twilio should shorten links in the `body` of the Message. Default value is `false`. If `true`, the `messaging_service_sid` parameter must also be provided. :param schedule_type: :param send_at: The time that Twilio will send the message. Must be in ISO 8601 format. + :param optimize_start_at: + :param optimize_end_at: + :param invoice_tag: :param send_as_mms: If set to `true`, Twilio delivers the message as a single MMS message, regardless of the presence of media. :param content_variables: For [Content Editor/API](https://www.twilio.com/docs/content) only: Key-value pairs of [Template variables](https://www.twilio.com/docs/content/using-variables-with-content-api) and their substitution values. `content_sid` parameter must also be provided. If values are not defined in the `content_variables` parameter, the [Template's default placeholder values](https://www.twilio.com/docs/content/content-api-resources#create-templates) are used. + :param message_intent: + :param dlt_pe_id: + :param dlt_template_id: + :param subject: + :param tags: A string containing a JSON map of key value pairs of tags to be recorded as metadata for the message. The object may contain up to 10 tags. Keys and values can each be up to 128 characters in length. :param risk_check: :param from_: The sender's Twilio phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format), [alphanumeric sender ID](https://www.twilio.com/docs/sms/quickstart), [Wireless SIM](https://www.twilio.com/docs/iot/wireless/programmable-wireless-send-machine-machine-sms-commands), [short code](https://www.twilio.com/en-us/messaging/channels/sms/short-codes), or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g., `whatsapp:+15554449999`). The value of the `from` parameter must be a sender that is hosted within Twilio and belongs to the Account creating the Message. If you are using `messaging_service_sid`, this parameter can be empty (Twilio assigns a `from` value from the Messaging Service's Sender Pool) or you can provide a specific sender from your Sender Pool. :param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/services) you want to associate with the Message. When this parameter is provided and the `from` parameter is omitted, Twilio selects the optimal sender from the Messaging Service's Sender Pool. You may also provide a `from` parameter if you want to use a specific Sender from the Sender Pool. @@ -870,17 +917,29 @@ def create( provide_feedback=provide_feedback, attempt=attempt, validity_period=validity_period, + max_rate=max_rate, force_delivery=force_delivery, + provider_sid=provider_sid, content_retention=content_retention, address_retention=address_retention, smart_encoded=smart_encoded, persistent_action=persistent_action, + interactive_data=interactive_data, + force_opt_in=force_opt_in, traffic_type=traffic_type, shorten_urls=shorten_urls, schedule_type=schedule_type, send_at=send_at, + optimize_start_at=optimize_start_at, + optimize_end_at=optimize_end_at, + invoice_tag=invoice_tag, send_as_mms=send_as_mms, content_variables=content_variables, + message_intent=message_intent, + dlt_pe_id=dlt_pe_id, + dlt_template_id=dlt_template_id, + subject=subject, + tags=tags, risk_check=risk_check, from_=from_, messaging_service_sid=messaging_service_sid, @@ -901,7 +960,9 @@ def create_with_http_info( provide_feedback: Union[bool, object] = values.unset, attempt: Union[int, object] = values.unset, validity_period: Union[int, object] = values.unset, + max_rate: Union[str, object] = values.unset, force_delivery: Union[bool, object] = values.unset, + provider_sid: Union[str, object] = values.unset, content_retention: Union[ "MessageInstance.ContentRetention", object ] = values.unset, @@ -910,12 +971,22 @@ def create_with_http_info( ] = values.unset, smart_encoded: Union[bool, object] = values.unset, persistent_action: Union[List[str], object] = values.unset, + interactive_data: Union[str, object] = values.unset, + force_opt_in: Union[bool, object] = values.unset, traffic_type: Union["MessageInstance.TrafficType", object] = values.unset, shorten_urls: Union[bool, object] = values.unset, schedule_type: Union["MessageInstance.ScheduleType", object] = values.unset, send_at: Union[datetime, object] = values.unset, + optimize_start_at: Union[datetime, object] = values.unset, + optimize_end_at: Union[datetime, object] = values.unset, + invoice_tag: Union[str, object] = values.unset, send_as_mms: Union[bool, object] = values.unset, content_variables: Union[str, object] = values.unset, + message_intent: Union[str, object] = values.unset, + dlt_pe_id: Union[str, object] = values.unset, + dlt_template_id: Union[str, object] = values.unset, + subject: Union[str, object] = values.unset, + tags: Union[str, object] = values.unset, risk_check: Union["MessageInstance.RiskCheck", object] = values.unset, from_: Union[str, object] = values.unset, messaging_service_sid: Union[str, object] = values.unset, @@ -933,17 +1004,29 @@ def create_with_http_info( :param provide_feedback: Boolean indicating whether or not you intend to provide delivery confirmation feedback to Twilio (used in conjunction with the [Message Feedback subresource](https://www.twilio.com/docs/sms/api/message-feedback-resource)). Default value is `false`. :param attempt: Total number of attempts made (including this request) to send the message regardless of the provider used :param validity_period: The maximum length in seconds that the Message can remain in Twilio's outgoing message queue. If a queued Message exceeds the `validity_period`, the Message is not sent. Accepted values are integers from `1` to `36000`. Default value is `36000`. A `validity_period` greater than `5` is recommended. [Learn more about the validity period](https://www.twilio.com/blog/take-more-control-of-outbound-messages-using-validity-period-html) + :param max_rate: :param force_delivery: Reserved + :param provider_sid: :param content_retention: :param address_retention: :param smart_encoded: Whether to detect Unicode characters that have a similar GSM-7 character and replace them. Can be: `true` or `false`. :param persistent_action: Rich actions for non-SMS/MMS channels. Used for [sending location in WhatsApp messages](https://www.twilio.com/docs/whatsapp/message-features#location-messages-with-whatsapp). + :param interactive_data: + :param force_opt_in: :param traffic_type: :param shorten_urls: For Messaging Services with [Link Shortening configured](https://www.twilio.com/docs/messaging/features/link-shortening) only: A Boolean indicating whether or not Twilio should shorten links in the `body` of the Message. Default value is `false`. If `true`, the `messaging_service_sid` parameter must also be provided. :param schedule_type: :param send_at: The time that Twilio will send the message. Must be in ISO 8601 format. + :param optimize_start_at: + :param optimize_end_at: + :param invoice_tag: :param send_as_mms: If set to `true`, Twilio delivers the message as a single MMS message, regardless of the presence of media. :param content_variables: For [Content Editor/API](https://www.twilio.com/docs/content) only: Key-value pairs of [Template variables](https://www.twilio.com/docs/content/using-variables-with-content-api) and their substitution values. `content_sid` parameter must also be provided. If values are not defined in the `content_variables` parameter, the [Template's default placeholder values](https://www.twilio.com/docs/content/content-api-resources#create-templates) are used. + :param message_intent: + :param dlt_pe_id: + :param dlt_template_id: + :param subject: + :param tags: A string containing a JSON map of key value pairs of tags to be recorded as metadata for the message. The object may contain up to 10 tags. Keys and values can each be up to 128 characters in length. :param risk_check: :param from_: The sender's Twilio phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format), [alphanumeric sender ID](https://www.twilio.com/docs/sms/quickstart), [Wireless SIM](https://www.twilio.com/docs/iot/wireless/programmable-wireless-send-machine-machine-sms-commands), [short code](https://www.twilio.com/en-us/messaging/channels/sms/short-codes), or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g., `whatsapp:+15554449999`). The value of the `from` parameter must be a sender that is hosted within Twilio and belongs to the Account creating the Message. If you are using `messaging_service_sid`, this parameter can be empty (Twilio assigns a `from` value from the Messaging Service's Sender Pool) or you can provide a specific sender from your Sender Pool. :param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/services) you want to associate with the Message. When this parameter is provided and the `from` parameter is omitted, Twilio selects the optimal sender from the Messaging Service's Sender Pool. You may also provide a `from` parameter if you want to use a specific Sender from the Sender Pool. @@ -961,17 +1044,29 @@ def create_with_http_info( provide_feedback=provide_feedback, attempt=attempt, validity_period=validity_period, + max_rate=max_rate, force_delivery=force_delivery, + provider_sid=provider_sid, content_retention=content_retention, address_retention=address_retention, smart_encoded=smart_encoded, persistent_action=persistent_action, + interactive_data=interactive_data, + force_opt_in=force_opt_in, traffic_type=traffic_type, shorten_urls=shorten_urls, schedule_type=schedule_type, send_at=send_at, + optimize_start_at=optimize_start_at, + optimize_end_at=optimize_end_at, + invoice_tag=invoice_tag, send_as_mms=send_as_mms, content_variables=content_variables, + message_intent=message_intent, + dlt_pe_id=dlt_pe_id, + dlt_template_id=dlt_template_id, + subject=subject, + tags=tags, risk_check=risk_check, from_=from_, messaging_service_sid=messaging_service_sid, @@ -993,7 +1088,9 @@ async def _create_async( provide_feedback: Union[bool, object] = values.unset, attempt: Union[int, object] = values.unset, validity_period: Union[int, object] = values.unset, + max_rate: Union[str, object] = values.unset, force_delivery: Union[bool, object] = values.unset, + provider_sid: Union[str, object] = values.unset, content_retention: Union[ "MessageInstance.ContentRetention", object ] = values.unset, @@ -1002,12 +1099,22 @@ async def _create_async( ] = values.unset, smart_encoded: Union[bool, object] = values.unset, persistent_action: Union[List[str], object] = values.unset, + interactive_data: Union[str, object] = values.unset, + force_opt_in: Union[bool, object] = values.unset, traffic_type: Union["MessageInstance.TrafficType", object] = values.unset, shorten_urls: Union[bool, object] = values.unset, schedule_type: Union["MessageInstance.ScheduleType", object] = values.unset, send_at: Union[datetime, object] = values.unset, + optimize_start_at: Union[datetime, object] = values.unset, + optimize_end_at: Union[datetime, object] = values.unset, + invoice_tag: Union[str, object] = values.unset, send_as_mms: Union[bool, object] = values.unset, content_variables: Union[str, object] = values.unset, + message_intent: Union[str, object] = values.unset, + dlt_pe_id: Union[str, object] = values.unset, + dlt_template_id: Union[str, object] = values.unset, + subject: Union[str, object] = values.unset, + tags: Union[str, object] = values.unset, risk_check: Union["MessageInstance.RiskCheck", object] = values.unset, from_: Union[str, object] = values.unset, messaging_service_sid: Union[str, object] = values.unset, @@ -1031,17 +1138,29 @@ async def _create_async( "ProvideFeedback": serialize.boolean_to_string(provide_feedback), "Attempt": attempt, "ValidityPeriod": validity_period, + "MaxRate": max_rate, "ForceDelivery": serialize.boolean_to_string(force_delivery), + "ProviderSid": provider_sid, "ContentRetention": content_retention, "AddressRetention": address_retention, "SmartEncoded": serialize.boolean_to_string(smart_encoded), "PersistentAction": serialize.map(persistent_action, lambda e: e), + "InteractiveData": interactive_data, + "ForceOptIn": serialize.boolean_to_string(force_opt_in), "TrafficType": traffic_type, "ShortenUrls": serialize.boolean_to_string(shorten_urls), "ScheduleType": schedule_type, "SendAt": serialize.iso8601_datetime(send_at), + "OptimizeStartAt": serialize.iso8601_datetime(optimize_start_at), + "OptimizeEndAt": serialize.iso8601_datetime(optimize_end_at), + "InvoiceTag": invoice_tag, "SendAsMms": serialize.boolean_to_string(send_as_mms), "ContentVariables": content_variables, + "MessageIntent": message_intent, + "DltPEId": dlt_pe_id, + "DltTemplateId": dlt_template_id, + "Subject": subject, + "Tags": tags, "RiskCheck": risk_check, "From": from_, "MessagingServiceSid": messaging_service_sid, @@ -1069,7 +1188,9 @@ async def create_async( provide_feedback: Union[bool, object] = values.unset, attempt: Union[int, object] = values.unset, validity_period: Union[int, object] = values.unset, + max_rate: Union[str, object] = values.unset, force_delivery: Union[bool, object] = values.unset, + provider_sid: Union[str, object] = values.unset, content_retention: Union[ "MessageInstance.ContentRetention", object ] = values.unset, @@ -1078,12 +1199,22 @@ async def create_async( ] = values.unset, smart_encoded: Union[bool, object] = values.unset, persistent_action: Union[List[str], object] = values.unset, + interactive_data: Union[str, object] = values.unset, + force_opt_in: Union[bool, object] = values.unset, traffic_type: Union["MessageInstance.TrafficType", object] = values.unset, shorten_urls: Union[bool, object] = values.unset, schedule_type: Union["MessageInstance.ScheduleType", object] = values.unset, send_at: Union[datetime, object] = values.unset, + optimize_start_at: Union[datetime, object] = values.unset, + optimize_end_at: Union[datetime, object] = values.unset, + invoice_tag: Union[str, object] = values.unset, send_as_mms: Union[bool, object] = values.unset, content_variables: Union[str, object] = values.unset, + message_intent: Union[str, object] = values.unset, + dlt_pe_id: Union[str, object] = values.unset, + dlt_template_id: Union[str, object] = values.unset, + subject: Union[str, object] = values.unset, + tags: Union[str, object] = values.unset, risk_check: Union["MessageInstance.RiskCheck", object] = values.unset, from_: Union[str, object] = values.unset, messaging_service_sid: Union[str, object] = values.unset, @@ -1101,17 +1232,29 @@ async def create_async( :param provide_feedback: Boolean indicating whether or not you intend to provide delivery confirmation feedback to Twilio (used in conjunction with the [Message Feedback subresource](https://www.twilio.com/docs/sms/api/message-feedback-resource)). Default value is `false`. :param attempt: Total number of attempts made (including this request) to send the message regardless of the provider used :param validity_period: The maximum length in seconds that the Message can remain in Twilio's outgoing message queue. If a queued Message exceeds the `validity_period`, the Message is not sent. Accepted values are integers from `1` to `36000`. Default value is `36000`. A `validity_period` greater than `5` is recommended. [Learn more about the validity period](https://www.twilio.com/blog/take-more-control-of-outbound-messages-using-validity-period-html) + :param max_rate: :param force_delivery: Reserved + :param provider_sid: :param content_retention: :param address_retention: :param smart_encoded: Whether to detect Unicode characters that have a similar GSM-7 character and replace them. Can be: `true` or `false`. :param persistent_action: Rich actions for non-SMS/MMS channels. Used for [sending location in WhatsApp messages](https://www.twilio.com/docs/whatsapp/message-features#location-messages-with-whatsapp). + :param interactive_data: + :param force_opt_in: :param traffic_type: :param shorten_urls: For Messaging Services with [Link Shortening configured](https://www.twilio.com/docs/messaging/features/link-shortening) only: A Boolean indicating whether or not Twilio should shorten links in the `body` of the Message. Default value is `false`. If `true`, the `messaging_service_sid` parameter must also be provided. :param schedule_type: :param send_at: The time that Twilio will send the message. Must be in ISO 8601 format. + :param optimize_start_at: + :param optimize_end_at: + :param invoice_tag: :param send_as_mms: If set to `true`, Twilio delivers the message as a single MMS message, regardless of the presence of media. :param content_variables: For [Content Editor/API](https://www.twilio.com/docs/content) only: Key-value pairs of [Template variables](https://www.twilio.com/docs/content/using-variables-with-content-api) and their substitution values. `content_sid` parameter must also be provided. If values are not defined in the `content_variables` parameter, the [Template's default placeholder values](https://www.twilio.com/docs/content/content-api-resources#create-templates) are used. + :param message_intent: + :param dlt_pe_id: + :param dlt_template_id: + :param subject: + :param tags: A string containing a JSON map of key value pairs of tags to be recorded as metadata for the message. The object may contain up to 10 tags. Keys and values can each be up to 128 characters in length. :param risk_check: :param from_: The sender's Twilio phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format), [alphanumeric sender ID](https://www.twilio.com/docs/sms/quickstart), [Wireless SIM](https://www.twilio.com/docs/iot/wireless/programmable-wireless-send-machine-machine-sms-commands), [short code](https://www.twilio.com/en-us/messaging/channels/sms/short-codes), or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g., `whatsapp:+15554449999`). The value of the `from` parameter must be a sender that is hosted within Twilio and belongs to the Account creating the Message. If you are using `messaging_service_sid`, this parameter can be empty (Twilio assigns a `from` value from the Messaging Service's Sender Pool) or you can provide a specific sender from your Sender Pool. :param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/services) you want to associate with the Message. When this parameter is provided and the `from` parameter is omitted, Twilio selects the optimal sender from the Messaging Service's Sender Pool. You may also provide a `from` parameter if you want to use a specific Sender from the Sender Pool. @@ -1129,17 +1272,29 @@ async def create_async( provide_feedback=provide_feedback, attempt=attempt, validity_period=validity_period, + max_rate=max_rate, force_delivery=force_delivery, + provider_sid=provider_sid, content_retention=content_retention, address_retention=address_retention, smart_encoded=smart_encoded, persistent_action=persistent_action, + interactive_data=interactive_data, + force_opt_in=force_opt_in, traffic_type=traffic_type, shorten_urls=shorten_urls, schedule_type=schedule_type, send_at=send_at, + optimize_start_at=optimize_start_at, + optimize_end_at=optimize_end_at, + invoice_tag=invoice_tag, send_as_mms=send_as_mms, content_variables=content_variables, + message_intent=message_intent, + dlt_pe_id=dlt_pe_id, + dlt_template_id=dlt_template_id, + subject=subject, + tags=tags, risk_check=risk_check, from_=from_, messaging_service_sid=messaging_service_sid, @@ -1160,7 +1315,9 @@ async def create_with_http_info_async( provide_feedback: Union[bool, object] = values.unset, attempt: Union[int, object] = values.unset, validity_period: Union[int, object] = values.unset, + max_rate: Union[str, object] = values.unset, force_delivery: Union[bool, object] = values.unset, + provider_sid: Union[str, object] = values.unset, content_retention: Union[ "MessageInstance.ContentRetention", object ] = values.unset, @@ -1169,12 +1326,22 @@ async def create_with_http_info_async( ] = values.unset, smart_encoded: Union[bool, object] = values.unset, persistent_action: Union[List[str], object] = values.unset, + interactive_data: Union[str, object] = values.unset, + force_opt_in: Union[bool, object] = values.unset, traffic_type: Union["MessageInstance.TrafficType", object] = values.unset, shorten_urls: Union[bool, object] = values.unset, schedule_type: Union["MessageInstance.ScheduleType", object] = values.unset, send_at: Union[datetime, object] = values.unset, + optimize_start_at: Union[datetime, object] = values.unset, + optimize_end_at: Union[datetime, object] = values.unset, + invoice_tag: Union[str, object] = values.unset, send_as_mms: Union[bool, object] = values.unset, content_variables: Union[str, object] = values.unset, + message_intent: Union[str, object] = values.unset, + dlt_pe_id: Union[str, object] = values.unset, + dlt_template_id: Union[str, object] = values.unset, + subject: Union[str, object] = values.unset, + tags: Union[str, object] = values.unset, risk_check: Union["MessageInstance.RiskCheck", object] = values.unset, from_: Union[str, object] = values.unset, messaging_service_sid: Union[str, object] = values.unset, @@ -1192,17 +1359,29 @@ async def create_with_http_info_async( :param provide_feedback: Boolean indicating whether or not you intend to provide delivery confirmation feedback to Twilio (used in conjunction with the [Message Feedback subresource](https://www.twilio.com/docs/sms/api/message-feedback-resource)). Default value is `false`. :param attempt: Total number of attempts made (including this request) to send the message regardless of the provider used :param validity_period: The maximum length in seconds that the Message can remain in Twilio's outgoing message queue. If a queued Message exceeds the `validity_period`, the Message is not sent. Accepted values are integers from `1` to `36000`. Default value is `36000`. A `validity_period` greater than `5` is recommended. [Learn more about the validity period](https://www.twilio.com/blog/take-more-control-of-outbound-messages-using-validity-period-html) + :param max_rate: :param force_delivery: Reserved + :param provider_sid: :param content_retention: :param address_retention: :param smart_encoded: Whether to detect Unicode characters that have a similar GSM-7 character and replace them. Can be: `true` or `false`. :param persistent_action: Rich actions for non-SMS/MMS channels. Used for [sending location in WhatsApp messages](https://www.twilio.com/docs/whatsapp/message-features#location-messages-with-whatsapp). + :param interactive_data: + :param force_opt_in: :param traffic_type: :param shorten_urls: For Messaging Services with [Link Shortening configured](https://www.twilio.com/docs/messaging/features/link-shortening) only: A Boolean indicating whether or not Twilio should shorten links in the `body` of the Message. Default value is `false`. If `true`, the `messaging_service_sid` parameter must also be provided. :param schedule_type: :param send_at: The time that Twilio will send the message. Must be in ISO 8601 format. + :param optimize_start_at: + :param optimize_end_at: + :param invoice_tag: :param send_as_mms: If set to `true`, Twilio delivers the message as a single MMS message, regardless of the presence of media. :param content_variables: For [Content Editor/API](https://www.twilio.com/docs/content) only: Key-value pairs of [Template variables](https://www.twilio.com/docs/content/using-variables-with-content-api) and their substitution values. `content_sid` parameter must also be provided. If values are not defined in the `content_variables` parameter, the [Template's default placeholder values](https://www.twilio.com/docs/content/content-api-resources#create-templates) are used. + :param message_intent: + :param dlt_pe_id: + :param dlt_template_id: + :param subject: + :param tags: A string containing a JSON map of key value pairs of tags to be recorded as metadata for the message. The object may contain up to 10 tags. Keys and values can each be up to 128 characters in length. :param risk_check: :param from_: The sender's Twilio phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format), [alphanumeric sender ID](https://www.twilio.com/docs/sms/quickstart), [Wireless SIM](https://www.twilio.com/docs/iot/wireless/programmable-wireless-send-machine-machine-sms-commands), [short code](https://www.twilio.com/en-us/messaging/channels/sms/short-codes), or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g., `whatsapp:+15554449999`). The value of the `from` parameter must be a sender that is hosted within Twilio and belongs to the Account creating the Message. If you are using `messaging_service_sid`, this parameter can be empty (Twilio assigns a `from` value from the Messaging Service's Sender Pool) or you can provide a specific sender from your Sender Pool. :param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/services) you want to associate with the Message. When this parameter is provided and the `from` parameter is omitted, Twilio selects the optimal sender from the Messaging Service's Sender Pool. You may also provide a `from` parameter if you want to use a specific Sender from the Sender Pool. @@ -1220,17 +1399,29 @@ async def create_with_http_info_async( provide_feedback=provide_feedback, attempt=attempt, validity_period=validity_period, + max_rate=max_rate, force_delivery=force_delivery, + provider_sid=provider_sid, content_retention=content_retention, address_retention=address_retention, smart_encoded=smart_encoded, persistent_action=persistent_action, + interactive_data=interactive_data, + force_opt_in=force_opt_in, traffic_type=traffic_type, shorten_urls=shorten_urls, schedule_type=schedule_type, send_at=send_at, + optimize_start_at=optimize_start_at, + optimize_end_at=optimize_end_at, + invoice_tag=invoice_tag, send_as_mms=send_as_mms, content_variables=content_variables, + message_intent=message_intent, + dlt_pe_id=dlt_pe_id, + dlt_template_id=dlt_template_id, + subject=subject, + tags=tags, risk_check=risk_check, from_=from_, messaging_service_sid=messaging_service_sid, @@ -1760,10 +1951,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = MessagePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/message/feedback.py b/twilio/rest/api/v2010/account/message/feedback.py index 5922ead4e..7f04c992f 100644 --- a/twilio/rest/api/v2010/account/message/feedback.py +++ b/twilio/rest/api/v2010/account/message/feedback.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, values @@ -23,7 +24,6 @@ class FeedbackInstance(InstanceResource): - class Outcome(object): CONFIRMED = "confirmed" UNCONFIRMED = "unconfirmed" @@ -73,7 +73,6 @@ def __repr__(self) -> str: class FeedbackList(ListResource): - def __init__(self, version: Version, account_sid: str, message_sid: str): """ Initialize the FeedbackList diff --git a/twilio/rest/api/v2010/account/message/media.py b/twilio/rest/api/v2010/account/message/media.py index 3948561b7..fb6fdb649 100644 --- a/twilio/rest/api/v2010/account/message/media.py +++ b/twilio/rest/api/v2010/account/message/media.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class MediaInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with this Media resource. :ivar content_type: The default [MIME type](https://en.wikipedia.org/wiki/Internet_media_type) of the media, for example `image/jpeg`, `image/png`, or `image/gif`. @@ -163,7 +165,6 @@ def __repr__(self) -> str: class MediaContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, message_sid: str, sid: str): """ Initialize the MediaContext @@ -364,7 +365,6 @@ def __repr__(self) -> str: class MediaPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> MediaInstance: """ Build an instance of MediaInstance @@ -388,7 +388,6 @@ def __repr__(self) -> str: class MediaList(ListResource): - def __init__(self, version: Version, account_sid: str, message_sid: str): """ Initialize the MediaList @@ -854,10 +853,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = MediaPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/new_key.py b/twilio/rest/api/v2010/account/new_key.py index 525891af5..ba7831fd9 100644 --- a/twilio/rest/api/v2010/account/new_key.py +++ b/twilio/rest/api/v2010/account/new_key.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, values @@ -23,6 +24,7 @@ class NewKeyInstance(InstanceResource): + """ :ivar sid: The unique string that that we created to identify the NewKey resource. You will use this as the basic-auth `user` when authenticating to the API. :ivar friendly_name: The string that you assigned to describe the resource. @@ -59,7 +61,6 @@ def __repr__(self) -> str: class NewKeyList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the NewKeyList diff --git a/twilio/rest/api/v2010/account/new_signing_key.py b/twilio/rest/api/v2010/account/new_signing_key.py index ebbb68095..e714fa8e8 100644 --- a/twilio/rest/api/v2010/account/new_signing_key.py +++ b/twilio/rest/api/v2010/account/new_signing_key.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, values @@ -23,6 +24,7 @@ class NewSigningKeyInstance(InstanceResource): + """ :ivar sid: The unique string that that we created to identify the NewSigningKey resource. :ivar friendly_name: The string that you assigned to describe the resource. @@ -59,7 +61,6 @@ def __repr__(self) -> str: class NewSigningKeyList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the NewSigningKeyList diff --git a/twilio/rest/api/v2010/account/notification.py b/twilio/rest/api/v2010/account/notification.py index 934b394cd..cb3843dda 100644 --- a/twilio/rest/api/v2010/account/notification.py +++ b/twilio/rest/api/v2010/account/notification.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import date, datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values @@ -24,6 +25,7 @@ class NotificationInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Notification resource. :ivar api_version: The API version used to generate the notification. Can be empty for events that don't have a specific API version, such as incoming phone calls. @@ -146,7 +148,6 @@ def __repr__(self) -> str: class NotificationContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the NotificationContext @@ -271,7 +272,6 @@ def __repr__(self) -> str: class NotificationPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> NotificationInstance: """ Build an instance of NotificationInstance @@ -292,7 +292,6 @@ def __repr__(self) -> str: class NotificationList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the NotificationList @@ -792,10 +791,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = NotificationPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/outgoing_caller_id.py b/twilio/rest/api/v2010/account/outgoing_caller_id.py index 5d283abdf..21ce2e95a 100644 --- a/twilio/rest/api/v2010/account/outgoing_caller_id.py +++ b/twilio/rest/api/v2010/account/outgoing_caller_id.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class OutgoingCallerIdInstance(InstanceResource): + """ :ivar sid: The unique string that that we created to identify the OutgoingCallerId resource. :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. @@ -216,7 +218,6 @@ def __repr__(self) -> str: class OutgoingCallerIdContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the OutgoingCallerIdContext @@ -533,7 +534,6 @@ def __repr__(self) -> str: class OutgoingCallerIdPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> OutgoingCallerIdInstance: """ Build an instance of OutgoingCallerIdInstance @@ -554,7 +554,6 @@ def __repr__(self) -> str: class OutgoingCallerIdList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the OutgoingCallerIdList @@ -982,10 +981,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = OutgoingCallerIdPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/queue/__init__.py b/twilio/rest/api/v2010/account/queue/__init__.py index fa1d323c1..c3439e8a1 100644 --- a/twilio/rest/api/v2010/account/queue/__init__.py +++ b/twilio/rest/api/v2010/account/queue/__init__.py @@ -12,6 +12,7 @@ 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 @@ -25,6 +26,7 @@ class QueueInstance(InstanceResource): + """ :ivar date_updated: The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. :ivar current_size: The number of calls currently in the queue. @@ -35,6 +37,7 @@ class QueueInstance(InstanceResource): :ivar sid: The unique string that that we created to identify this Queue resource. :ivar date_created: The date and time in GMT that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. :ivar max_size: The maximum number of calls that can be in the queue. The default is 1000 and the maximum is 5000. + :ivar subresource_uris: """ def __init__( @@ -63,6 +66,9 @@ def __init__( payload.get("date_created") ) self.max_size: Optional[int] = deserialize.integer(payload.get("max_size")) + self.subresource_uris: Optional[Dict[str, object]] = payload.get( + "subresource_uris" + ) self._solution = { "account_sid": account_sid, @@ -248,7 +254,6 @@ def __repr__(self) -> str: class QueueContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the QueueContext @@ -602,7 +607,6 @@ def __repr__(self) -> str: class QueuePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> QueueInstance: """ Build an instance of QueueInstance @@ -623,7 +627,6 @@ def __repr__(self) -> str: class QueueList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the QueueList @@ -1095,10 +1098,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = QueuePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/queue/member.py b/twilio/rest/api/v2010/account/queue/member.py index b58ae7781..1f62990b3 100644 --- a/twilio/rest/api/v2010/account/queue/member.py +++ b/twilio/rest/api/v2010/account/queue/member.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class MemberInstance(InstanceResource): + """ :ivar call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Member resource is associated with. :ivar date_enqueued: The date that the member was enqueued, given in RFC 2822 format. @@ -187,7 +189,6 @@ def __repr__(self) -> str: class MemberContext(InstanceContext): - def __init__( self, version: Version, account_sid: str, queue_sid: str, call_sid: str ): @@ -454,7 +455,6 @@ def __repr__(self) -> str: class MemberPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> MemberInstance: """ Build an instance of MemberInstance @@ -478,7 +478,6 @@ def __repr__(self) -> str: class MemberList(ListResource): - def __init__(self, version: Version, account_sid: str, queue_sid: str): """ Initialize the MemberList @@ -830,10 +829,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = MemberPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/recording/__init__.py b/twilio/rest/api/v2010/account/recording/__init__.py index 48b255a19..7abe359ad 100644 --- a/twilio/rest/api/v2010/account/recording/__init__.py +++ b/twilio/rest/api/v2010/account/recording/__init__.py @@ -12,6 +12,7 @@ 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 @@ -26,7 +27,6 @@ class RecordingInstance(InstanceResource): - class Source(object): DIALVERB = "DialVerb" CONFERENCE = "Conference" @@ -245,7 +245,6 @@ def __repr__(self) -> str: class RecordingContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the RecordingContext @@ -499,7 +498,6 @@ def __repr__(self) -> str: class RecordingPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> RecordingInstance: """ Build an instance of RecordingInstance @@ -520,7 +518,6 @@ def __repr__(self) -> str: class RecordingList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the RecordingList @@ -1090,10 +1087,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = RecordingPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py b/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py index ac0afe5f7..44471c79b 100644 --- a/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py +++ b/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py @@ -12,6 +12,7 @@ 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 @@ -25,7 +26,6 @@ class AddOnResultInstance(InstanceResource): - class Status(object): CANCELED = "canceled" COMPLETED = "completed" @@ -194,7 +194,6 @@ def __repr__(self) -> str: class AddOnResultContext(InstanceContext): - def __init__( self, version: Version, account_sid: str, reference_sid: str, sid: str ): @@ -411,7 +410,6 @@ def __repr__(self) -> str: class AddOnResultPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> AddOnResultInstance: """ Build an instance of AddOnResultInstance @@ -435,7 +433,6 @@ def __repr__(self) -> str: class AddOnResultList(ListResource): - def __init__(self, version: Version, account_sid: str, reference_sid: str): """ Initialize the AddOnResultList @@ -787,10 +784,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AddOnResultPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/recording/add_on_result/payload/__init__.py b/twilio/rest/api/v2010/account/recording/add_on_result/payload/__init__.py index aad48b60d..c6cf7500d 100644 --- a/twilio/rest/api/v2010/account/recording/add_on_result/payload/__init__.py +++ b/twilio/rest/api/v2010/account/recording/add_on_result/payload/__init__.py @@ -12,6 +12,7 @@ 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 @@ -25,6 +26,7 @@ class PayloadInstance(InstanceResource): + """ :ivar sid: The unique string that that we created to identify the Recording AddOnResult Payload resource. :ivar add_on_result_sid: The SID of the AddOnResult to which the payload belongs. @@ -186,7 +188,6 @@ def __repr__(self) -> str: class PayloadContext(InstanceContext): - def __init__( self, version: Version, @@ -415,7 +416,6 @@ def __repr__(self) -> str: class PayloadPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> PayloadInstance: """ Build an instance of PayloadInstance @@ -440,7 +440,6 @@ def __repr__(self) -> str: class PayloadList(ListResource): - def __init__( self, version: Version, @@ -800,10 +799,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = PayloadPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/recording/add_on_result/payload/data.py b/twilio/rest/api/v2010/account/recording/add_on_result/payload/data.py index 780c4fcd0..3c3bb184b 100644 --- a/twilio/rest/api/v2010/account/recording/add_on_result/payload/data.py +++ b/twilio/rest/api/v2010/account/recording/add_on_result/payload/data.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class DataInstance(InstanceResource): + """ :ivar redirect_to: The URL to redirect to to get the data returned by the AddOn that was previously stored. """ @@ -112,7 +114,6 @@ def __repr__(self) -> str: class DataContext(InstanceContext): - def __init__( self, version: Version, @@ -256,7 +257,6 @@ def __repr__(self) -> str: class DataList(ListResource): - def __init__( self, version: Version, diff --git a/twilio/rest/api/v2010/account/recording/transcription.py b/twilio/rest/api/v2010/account/recording/transcription.py index 584afa5d0..e815a88bc 100644 --- a/twilio/rest/api/v2010/account/recording/transcription.py +++ b/twilio/rest/api/v2010/account/recording/transcription.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class TranscriptionInstance(InstanceResource): - class Status(object): IN_PROGRESS = "in-progress" COMPLETED = "completed" @@ -181,7 +181,6 @@ def __repr__(self) -> str: class TranscriptionContext(InstanceContext): - def __init__( self, version: Version, account_sid: str, recording_sid: str, sid: str ): @@ -382,7 +381,6 @@ def __repr__(self) -> str: class TranscriptionPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> TranscriptionInstance: """ Build an instance of TranscriptionInstance @@ -406,7 +404,6 @@ def __repr__(self) -> str: class TranscriptionList(ListResource): - def __init__(self, version: Version, account_sid: str, recording_sid: str): """ Initialize the TranscriptionList @@ -758,10 +755,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = TranscriptionPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/short_code.py b/twilio/rest/api/v2010/account/short_code.py index 412a64f19..dafcfdbfe 100644 --- a/twilio/rest/api/v2010/account/short_code.py +++ b/twilio/rest/api/v2010/account/short_code.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class ShortCodeInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this ShortCode resource. :ivar api_version: The API version used to start a new TwiML session when an SMS message is sent to this short code. @@ -254,7 +256,6 @@ def __repr__(self) -> str: class ShortCodeContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the ShortCodeContext @@ -597,7 +598,6 @@ def __repr__(self) -> str: class ShortCodePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ShortCodeInstance: """ Build an instance of ShortCodeInstance @@ -618,7 +618,6 @@ def __repr__(self) -> str: class ShortCodeList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the ShortCodeList @@ -1046,10 +1045,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ShortCodePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/signing_key.py b/twilio/rest/api/v2010/account/signing_key.py index 1f8c2ee5e..30c2f7f2d 100644 --- a/twilio/rest/api/v2010/account/signing_key.py +++ b/twilio/rest/api/v2010/account/signing_key.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class SigningKeyInstance(InstanceResource): + """ :ivar sid: :ivar friendly_name: @@ -210,7 +212,6 @@ def __repr__(self) -> str: class SigningKeyContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the SigningKeyContext @@ -527,7 +528,6 @@ def __repr__(self) -> str: class SigningKeyPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SigningKeyInstance: """ Build an instance of SigningKeyInstance @@ -548,7 +548,6 @@ def __repr__(self) -> str: class SigningKeyList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the SigningKeyList @@ -896,10 +895,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SigningKeyPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/sip/__init__.py b/twilio/rest/api/v2010/account/sip/__init__.py index 12c695ff7..a0780cb1e 100644 --- a/twilio/rest/api/v2010/account/sip/__init__.py +++ b/twilio/rest/api/v2010/account/sip/__init__.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Optional @@ -26,7 +27,6 @@ class SipList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the SipList diff --git a/twilio/rest/api/v2010/account/sip/credential_list/__init__.py b/twilio/rest/api/v2010/account/sip/credential_list/__init__.py index 82de5202d..1db7ac1db 100644 --- a/twilio/rest/api/v2010/account/sip/credential_list/__init__.py +++ b/twilio/rest/api/v2010/account/sip/credential_list/__init__.py @@ -12,6 +12,7 @@ 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 @@ -25,6 +26,7 @@ class CredentialListInstance(InstanceResource): + """ :ivar account_sid: The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) that owns this resource. :ivar date_created: The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. @@ -218,7 +220,6 @@ def __repr__(self) -> str: class CredentialListContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the CredentialListContext @@ -540,7 +541,6 @@ def __repr__(self) -> str: class CredentialListPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> CredentialListInstance: """ Build an instance of CredentialListInstance @@ -561,7 +561,6 @@ def __repr__(self) -> str: class CredentialListList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the CredentialListList @@ -1013,10 +1012,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CredentialListPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/sip/credential_list/credential.py b/twilio/rest/api/v2010/account/sip/credential_list/credential.py index 8f32d2cce..465f657f6 100644 --- a/twilio/rest/api/v2010/account/sip/credential_list/credential.py +++ b/twilio/rest/api/v2010/account/sip/credential_list/credential.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class CredentialInstance(InstanceResource): + """ :ivar sid: A 34 character string that uniquely identifies this resource. :ivar account_sid: The unique id of the Account that is responsible for this resource. @@ -219,7 +221,6 @@ def __repr__(self) -> str: class CredentialContext(InstanceContext): - def __init__( self, version: Version, account_sid: str, credential_list_sid: str, sid: str ): @@ -542,7 +543,6 @@ def __repr__(self) -> str: class CredentialPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> CredentialInstance: """ Build an instance of CredentialInstance @@ -566,7 +566,6 @@ def __repr__(self) -> str: class CredentialList(ListResource): - def __init__(self, version: Version, account_sid: str, credential_list_sid: str): """ Initialize the CredentialList @@ -1042,10 +1041,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CredentialPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/sip/domain/__init__.py b/twilio/rest/api/v2010/account/sip/domain/__init__.py index 62932c200..41a393df4 100644 --- a/twilio/rest/api/v2010/account/sip/domain/__init__.py +++ b/twilio/rest/api/v2010/account/sip/domain/__init__.py @@ -12,6 +12,7 @@ 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 @@ -31,6 +32,7 @@ class DomainInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the SipDomain resource. :ivar api_version: The API version used to process the call. @@ -428,7 +430,6 @@ def __repr__(self) -> str: class DomainContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the DomainContext @@ -1000,7 +1001,6 @@ def __repr__(self) -> str: class DomainPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> DomainInstance: """ Build an instance of DomainInstance @@ -1021,7 +1021,6 @@ def __repr__(self) -> str: class DomainList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the DomainList @@ -1691,10 +1690,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = DomainPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/__init__.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/__init__.py index 73a81ac90..282d3b64e 100644 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types/__init__.py +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types/__init__.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Optional @@ -27,7 +28,6 @@ class AuthTypesList(ListResource): - def __init__(self, version: Version, account_sid: str, domain_sid: str): """ Initialize the AuthTypesList diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/__init__.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/__init__.py index 79a42fa01..9d822b4fe 100644 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/__init__.py +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/__init__.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Optional @@ -27,7 +28,6 @@ class AuthTypeCallsList(ListResource): - def __init__(self, version: Version, account_sid: str, domain_sid: str): """ Initialize the AuthTypeCallsList @@ -50,9 +50,9 @@ def __init__(self, version: Version, account_sid: str, domain_sid: str): ) ) - self._credential_list_mappings: Optional[AuthCallsCredentialListMappingList] = ( - None - ) + self._credential_list_mappings: Optional[ + AuthCallsCredentialListMappingList + ] = None self._ip_access_control_list_mappings: Optional[ AuthCallsIpAccessControlListMappingList ] = None diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_credential_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_credential_list_mapping.py index d71efb711..ba9c65a6d 100644 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_credential_list_mapping.py +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_credential_list_mapping.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class AuthCallsCredentialListMappingInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialListMapping resource. :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. @@ -161,7 +163,6 @@ def __repr__(self) -> str: class AuthCallsCredentialListMappingContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, domain_sid: str, sid: str): """ Initialize the AuthCallsCredentialListMappingContext @@ -362,7 +363,6 @@ def __repr__(self) -> str: class AuthCallsCredentialListMappingPage(Page): - def get_instance( self, payload: Dict[str, Any] ) -> AuthCallsCredentialListMappingInstance: @@ -388,7 +388,6 @@ def __repr__(self) -> str: class AuthCallsCredentialListMappingList(ListResource): - def __init__(self, version: Version, account_sid: str, domain_sid: str): """ Initialize the AuthCallsCredentialListMappingList @@ -870,10 +869,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AuthCallsCredentialListMappingPage( self._version, response, self._solution diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_ip_access_control_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_ip_access_control_list_mapping.py index 1fc4116bc..7af378114 100644 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_ip_access_control_list_mapping.py +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_ip_access_control_list_mapping.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class AuthCallsIpAccessControlListMappingInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IpAccessControlListMapping resource. :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. @@ -163,7 +165,6 @@ def __repr__(self) -> str: class AuthCallsIpAccessControlListMappingContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, domain_sid: str, sid: str): """ Initialize the AuthCallsIpAccessControlListMappingContext @@ -366,7 +367,6 @@ def __repr__(self) -> str: class AuthCallsIpAccessControlListMappingPage(Page): - def get_instance( self, payload: Dict[str, Any] ) -> AuthCallsIpAccessControlListMappingInstance: @@ -392,7 +392,6 @@ def __repr__(self) -> str: class AuthCallsIpAccessControlListMappingList(ListResource): - def __init__(self, version: Version, account_sid: str, domain_sid: str): """ Initialize the AuthCallsIpAccessControlListMappingList @@ -876,10 +875,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AuthCallsIpAccessControlListMappingPage( self._version, response, self._solution diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/__init__.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/__init__.py index c10c74737..41c1805ff 100644 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/__init__.py +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/__init__.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Optional @@ -24,7 +25,6 @@ class AuthTypeRegistrationsList(ListResource): - def __init__(self, version: Version, account_sid: str, domain_sid: str): """ Initialize the AuthTypeRegistrationsList diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/auth_registrations_credential_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/auth_registrations_credential_list_mapping.py index dc3059bb0..a010ba578 100644 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/auth_registrations_credential_list_mapping.py +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/auth_registrations_credential_list_mapping.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class AuthRegistrationsCredentialListMappingInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialListMapping resource. :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. @@ -161,7 +163,6 @@ def __repr__(self) -> str: class AuthRegistrationsCredentialListMappingContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, domain_sid: str, sid: str): """ Initialize the AuthRegistrationsCredentialListMappingContext @@ -362,7 +363,6 @@ def __repr__(self) -> str: class AuthRegistrationsCredentialListMappingPage(Page): - def get_instance( self, payload: Dict[str, Any] ) -> AuthRegistrationsCredentialListMappingInstance: @@ -388,7 +388,6 @@ def __repr__(self) -> str: class AuthRegistrationsCredentialListMappingList(ListResource): - def __init__(self, version: Version, account_sid: str, domain_sid: str): """ Initialize the AuthRegistrationsCredentialListMappingList @@ -870,10 +869,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AuthRegistrationsCredentialListMappingPage( self._version, response, self._solution diff --git a/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py index 965a82a70..7b566e30c 100644 --- a/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py +++ b/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class CredentialListMappingInstance(InstanceResource): + """ :ivar account_sid: The unique id of the Account that is responsible for this resource. :ivar date_created: The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. @@ -163,7 +165,6 @@ def __repr__(self) -> str: class CredentialListMappingContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, domain_sid: str, sid: str): """ Initialize the CredentialListMappingContext @@ -362,7 +363,6 @@ def __repr__(self) -> str: class CredentialListMappingPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> CredentialListMappingInstance: """ Build an instance of CredentialListMappingInstance @@ -386,7 +386,6 @@ def __repr__(self) -> str: class CredentialListMappingList(ListResource): - def __init__(self, version: Version, account_sid: str, domain_sid: str): """ Initialize the CredentialListMappingList @@ -860,10 +859,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CredentialListMappingPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py index 9b1aec112..974ec4153 100644 --- a/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py +++ b/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class IpAccessControlListMappingInstance(InstanceResource): + """ :ivar account_sid: The unique id of the Account that is responsible for this resource. :ivar date_created: The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. @@ -165,7 +167,6 @@ def __repr__(self) -> str: class IpAccessControlListMappingContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, domain_sid: str, sid: str): """ Initialize the IpAccessControlListMappingContext @@ -364,7 +365,6 @@ def __repr__(self) -> str: class IpAccessControlListMappingPage(Page): - def get_instance( self, payload: Dict[str, Any] ) -> IpAccessControlListMappingInstance: @@ -390,7 +390,6 @@ def __repr__(self) -> str: class IpAccessControlListMappingList(ListResource): - def __init__(self, version: Version, account_sid: str, domain_sid: str): """ Initialize the IpAccessControlListMappingList @@ -868,10 +867,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = IpAccessControlListMappingPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py b/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py index 0bc3b6aa0..c7dbdf963 100644 --- a/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py +++ b/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py @@ -12,6 +12,7 @@ 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 @@ -27,6 +28,7 @@ class IpAccessControlListInstance(InstanceResource): + """ :ivar sid: A 34 character string that uniquely identifies this resource. :ivar account_sid: The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) that owns this resource. @@ -220,7 +222,6 @@ def __repr__(self) -> str: class IpAccessControlListContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the IpAccessControlListContext @@ -544,7 +545,6 @@ def __repr__(self) -> str: class IpAccessControlListPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> IpAccessControlListInstance: """ Build an instance of IpAccessControlListInstance @@ -565,7 +565,6 @@ def __repr__(self) -> str: class IpAccessControlListList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the IpAccessControlListList @@ -1017,10 +1016,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = IpAccessControlListPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py b/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py index 368ec6ced..348e122d0 100644 --- a/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py +++ b/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class IpAddressInstance(InstanceResource): + """ :ivar sid: A 34 character string that uniquely identifies this resource. :ivar account_sid: The unique id of the Account that is responsible for this resource. @@ -255,7 +257,6 @@ def __repr__(self) -> str: class IpAddressContext(InstanceContext): - def __init__( self, version: Version, @@ -634,7 +635,6 @@ def __repr__(self) -> str: class IpAddressPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> IpAddressInstance: """ Build an instance of IpAddressInstance @@ -658,7 +658,6 @@ def __repr__(self) -> str: class IpAddressList(ListResource): - def __init__( self, version: Version, account_sid: str, ip_access_control_list_sid: str ): @@ -1182,10 +1181,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = IpAddressPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/token.py b/twilio/rest/api/v2010/account/token.py index 4cc10f702..2112386b4 100644 --- a/twilio/rest/api/v2010/account/token.py +++ b/twilio/rest/api/v2010/account/token.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, List, Optional, Union from twilio.base import deserialize, values @@ -23,6 +24,7 @@ class TokenInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Token resource. :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. @@ -63,7 +65,6 @@ def __repr__(self) -> str: class TokenList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the TokenList diff --git a/twilio/rest/api/v2010/account/transcription.py b/twilio/rest/api/v2010/account/transcription.py index 94bbebeb3..ea2643807 100644 --- a/twilio/rest/api/v2010/account/transcription.py +++ b/twilio/rest/api/v2010/account/transcription.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class TranscriptionInstance(InstanceResource): - class Status(object): IN_PROGRESS = "in-progress" COMPLETED = "completed" @@ -178,7 +178,6 @@ def __repr__(self) -> str: class TranscriptionContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the TranscriptionContext @@ -371,7 +370,6 @@ def __repr__(self) -> str: class TranscriptionPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> TranscriptionInstance: """ Build an instance of TranscriptionInstance @@ -392,7 +390,6 @@ def __repr__(self) -> str: class TranscriptionList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the TranscriptionList @@ -742,10 +739,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = TranscriptionPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/usage/__init__.py b/twilio/rest/api/v2010/account/usage/__init__.py index 8fe80f64b..3f3f2c76f 100644 --- a/twilio/rest/api/v2010/account/usage/__init__.py +++ b/twilio/rest/api/v2010/account/usage/__init__.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Optional @@ -23,7 +24,6 @@ class UsageList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the UsageList diff --git a/twilio/rest/api/v2010/account/usage/record/__init__.py b/twilio/rest/api/v2010/account/usage/record/__init__.py index b46952c5d..484c004bd 100644 --- a/twilio/rest/api/v2010/account/usage/record/__init__.py +++ b/twilio/rest/api/v2010/account/usage/record/__init__.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import date from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values @@ -32,6 +33,7 @@ class RecordInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. :ivar api_version: The API version used to create the resource. @@ -90,7 +92,6 @@ def __repr__(self) -> str: class RecordPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> RecordInstance: """ Build an instance of RecordInstance @@ -111,7 +112,6 @@ def __repr__(self) -> str: class RecordList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the RecordList @@ -620,10 +620,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = RecordPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/usage/record/all_time.py b/twilio/rest/api/v2010/account/usage/record/all_time.py index 549ff92a6..8f63d2e2b 100644 --- a/twilio/rest/api/v2010/account/usage/record/all_time.py +++ b/twilio/rest/api/v2010/account/usage/record/all_time.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import date from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values @@ -24,6 +25,7 @@ class AllTimeInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. :ivar api_version: The API version used to create the resource. @@ -82,7 +84,6 @@ def __repr__(self) -> str: class AllTimePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> AllTimeInstance: """ Build an instance of AllTimeInstance @@ -103,7 +104,6 @@ def __repr__(self) -> str: class AllTimeList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the AllTimeList @@ -603,10 +603,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AllTimePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/usage/record/daily.py b/twilio/rest/api/v2010/account/usage/record/daily.py index 9b6c4794d..2fce8800e 100644 --- a/twilio/rest/api/v2010/account/usage/record/daily.py +++ b/twilio/rest/api/v2010/account/usage/record/daily.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import date from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values @@ -24,6 +25,7 @@ class DailyInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. :ivar api_version: The API version used to create the resource. @@ -82,7 +84,6 @@ def __repr__(self) -> str: class DailyPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> DailyInstance: """ Build an instance of DailyInstance @@ -103,7 +104,6 @@ def __repr__(self) -> str: class DailyList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the DailyList @@ -603,10 +603,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = DailyPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/usage/record/last_month.py b/twilio/rest/api/v2010/account/usage/record/last_month.py index 30ce94563..87300feb7 100644 --- a/twilio/rest/api/v2010/account/usage/record/last_month.py +++ b/twilio/rest/api/v2010/account/usage/record/last_month.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import date from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values @@ -24,6 +25,7 @@ class LastMonthInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. :ivar api_version: The API version used to create the resource. @@ -82,7 +84,6 @@ def __repr__(self) -> str: class LastMonthPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> LastMonthInstance: """ Build an instance of LastMonthInstance @@ -103,7 +104,6 @@ def __repr__(self) -> str: class LastMonthList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the LastMonthList @@ -603,10 +603,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = LastMonthPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/usage/record/monthly.py b/twilio/rest/api/v2010/account/usage/record/monthly.py index 12407eaef..a854575e5 100644 --- a/twilio/rest/api/v2010/account/usage/record/monthly.py +++ b/twilio/rest/api/v2010/account/usage/record/monthly.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import date from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values @@ -24,6 +25,7 @@ class MonthlyInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. :ivar api_version: The API version used to create the resource. @@ -82,7 +84,6 @@ def __repr__(self) -> str: class MonthlyPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> MonthlyInstance: """ Build an instance of MonthlyInstance @@ -103,7 +104,6 @@ def __repr__(self) -> str: class MonthlyList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the MonthlyList @@ -603,10 +603,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = MonthlyPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/usage/record/this_month.py b/twilio/rest/api/v2010/account/usage/record/this_month.py index 820c2478c..381ae250c 100644 --- a/twilio/rest/api/v2010/account/usage/record/this_month.py +++ b/twilio/rest/api/v2010/account/usage/record/this_month.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import date from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values @@ -24,6 +25,7 @@ class ThisMonthInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. :ivar api_version: The API version used to create the resource. @@ -82,7 +84,6 @@ def __repr__(self) -> str: class ThisMonthPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ThisMonthInstance: """ Build an instance of ThisMonthInstance @@ -103,7 +104,6 @@ def __repr__(self) -> str: class ThisMonthList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the ThisMonthList @@ -603,10 +603,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ThisMonthPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/usage/record/today.py b/twilio/rest/api/v2010/account/usage/record/today.py index 7dd13b2a0..e286315bf 100644 --- a/twilio/rest/api/v2010/account/usage/record/today.py +++ b/twilio/rest/api/v2010/account/usage/record/today.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import date from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values @@ -24,6 +25,7 @@ class TodayInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. :ivar api_version: The API version used to create the resource. @@ -82,7 +84,6 @@ def __repr__(self) -> str: class TodayPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> TodayInstance: """ Build an instance of TodayInstance @@ -103,7 +104,6 @@ def __repr__(self) -> str: class TodayList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the TodayList @@ -603,10 +603,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = TodayPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/usage/record/yearly.py b/twilio/rest/api/v2010/account/usage/record/yearly.py index ff2423d27..284f5095e 100644 --- a/twilio/rest/api/v2010/account/usage/record/yearly.py +++ b/twilio/rest/api/v2010/account/usage/record/yearly.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import date from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values @@ -24,6 +25,7 @@ class YearlyInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. :ivar api_version: The API version used to create the resource. @@ -82,7 +84,6 @@ def __repr__(self) -> str: class YearlyPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> YearlyInstance: """ Build an instance of YearlyInstance @@ -103,7 +104,6 @@ def __repr__(self) -> str: class YearlyList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the YearlyList @@ -603,10 +603,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = YearlyPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/usage/record/yesterday.py b/twilio/rest/api/v2010/account/usage/record/yesterday.py index dc176f860..ec77e937d 100644 --- a/twilio/rest/api/v2010/account/usage/record/yesterday.py +++ b/twilio/rest/api/v2010/account/usage/record/yesterday.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import date from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values @@ -24,6 +25,7 @@ class YesterdayInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. :ivar api_version: The API version used to create the resource. @@ -82,7 +84,6 @@ def __repr__(self) -> str: class YesterdayPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> YesterdayInstance: """ Build an instance of YesterdayInstance @@ -103,7 +104,6 @@ def __repr__(self) -> str: class YesterdayList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the YesterdayList @@ -603,10 +603,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = YesterdayPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/usage/trigger.py b/twilio/rest/api/v2010/account/usage/trigger.py index e35477999..e4a3ae367 100644 --- a/twilio/rest/api/v2010/account/usage/trigger.py +++ b/twilio/rest/api/v2010/account/usage/trigger.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class TriggerInstance(InstanceResource): - class Recurring(object): DAILY = "daily" MONTHLY = "monthly" @@ -278,7 +278,6 @@ def __repr__(self) -> str: class TriggerContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the TriggerContext @@ -641,7 +640,6 @@ def __repr__(self) -> str: class TriggerPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> TriggerInstance: """ Build an instance of TriggerInstance @@ -662,7 +660,6 @@ def __repr__(self) -> str: class TriggerList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the TriggerList @@ -1348,10 +1345,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = TriggerPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/api/v2010/account/validation_request.py b/twilio/rest/api/v2010/account/validation_request.py index 9594e19cc..df74c2b2f 100644 --- a/twilio/rest/api/v2010/account/validation_request.py +++ b/twilio/rest/api/v2010/account/validation_request.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class ValidationRequestInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for the Caller ID. :ivar call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Caller ID is associated with. @@ -54,7 +56,6 @@ def __repr__(self) -> str: class ValidationRequestList(ListResource): - def __init__(self, version: Version, account_sid: str): """ Initialize the ValidationRequestList diff --git a/twilio/rest/api/v2010/sms_feedback.py b/twilio/rest/api/v2010/sms_feedback.py new file mode 100644 index 000000000..1bfd69d03 --- /dev/null +++ b/twilio/rest/api/v2010/sms_feedback.py @@ -0,0 +1,231 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from datetime import datetime +from typing import Any, Dict, Optional, Union +from twilio.base import deserialize, values +from twilio.base.api_response import ApiResponse + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class SmsFeedbackInstance(InstanceResource): + class Outcome(object): + CONFIRMED = "confirmed" + UNCONFIRMED = "unconfirmed" + RECEIVED = "received" + NOT_RECEIVED = "not-received" + DELAYED = "delayed" + + """ + :ivar account_sid: + :ivar message_sid: + :ivar outcome: + :ivar date_created: + :ivar date_updated: + :ivar uri: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: Optional[str] = None, + message_sid: Optional[str] = None, + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.message_sid: Optional[str] = payload.get("message_sid") + self.outcome: Optional["SmsFeedbackInstance.Outcome"] = payload.get("outcome") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.uri: Optional[str] = payload.get("uri") + + self._solution = { + "account_sid": account_sid or self.account_sid, + "message_sid": message_sid or self.message_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 SmsFeedbackList(ListResource): + def __init__(self, version: Version, account_sid: str, message_sid: str): + """ + Initialize the SmsFeedbackList + + :param version: Version that contains the resource + :param account_sid: + :param message_sid: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "account_sid": account_sid, + "message_sid": message_sid, + } + self._uri = ( + "/Accounts/{account_sid}/SMS/Messages/{message_sid}/Feedback.json".format( + **self._solution + ) + ) + + def _create( + self, outcome: Union["SmsFeedbackInstance.Outcome", object] = values.unset + ) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "Outcome": outcome, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, outcome: Union["SmsFeedbackInstance.Outcome", object] = values.unset + ) -> SmsFeedbackInstance: + """ + Create the SmsFeedbackInstance + + :param outcome: + + :returns: The created SmsFeedbackInstance + """ + payload, _, _ = self._create(outcome=outcome) + return SmsFeedbackInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + message_sid=self._solution["message_sid"], + ) + + def create_with_http_info( + self, outcome: Union["SmsFeedbackInstance.Outcome", object] = values.unset + ) -> ApiResponse: + """ + Create the SmsFeedbackInstance and return response metadata + + :param outcome: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create(outcome=outcome) + instance = SmsFeedbackInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + message_sid=self._solution["message_sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async( + self, outcome: Union["SmsFeedbackInstance.Outcome", object] = values.unset + ) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "Outcome": outcome, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, outcome: Union["SmsFeedbackInstance.Outcome", object] = values.unset + ) -> SmsFeedbackInstance: + """ + Asynchronously create the SmsFeedbackInstance + + :param outcome: + + :returns: The created SmsFeedbackInstance + """ + payload, _, _ = await self._create_async(outcome=outcome) + return SmsFeedbackInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + message_sid=self._solution["message_sid"], + ) + + async def create_with_http_info_async( + self, outcome: Union["SmsFeedbackInstance.Outcome", object] = values.unset + ) -> ApiResponse: + """ + Asynchronously create the SmsFeedbackInstance and return response metadata + + :param outcome: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async(outcome=outcome) + instance = SmsFeedbackInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + message_sid=self._solution["message_sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/api/v2010/twiml_session.py b/twilio/rest/api/v2010/twiml_session.py new file mode 100644 index 000000000..4bfa13da5 --- /dev/null +++ b/twilio/rest/api/v2010/twiml_session.py @@ -0,0 +1,1200 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.api_response import ApiResponse +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 TwimlSessionInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TwiML Session resource. + :ivar call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the TwiML Session resource is associated with. + :ivar sid: The unique string that we created to identify the TwiML Session resource. + :ivar date_updated: The date and time in GMT that the resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_created: The date and time in GMT that the resource was created, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar session_input: The input direction provided to the TwiML Session. + :ivar session_output: The output direction generated by the TwiML Session. + :ivar name: The name of the TwiML Session resource. + :ivar status: The status of the TwiML Session. Possible values include `in-progress` or `completed`. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: Optional[str] = None, + call_sid: Optional[str] = None, + sid: Optional[str] = None, + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.call_sid: Optional[str] = payload.get("call_sid") + self.sid: Optional[str] = payload.get("sid") + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.session_input: Optional[str] = payload.get("session_input") + self.session_output: Optional[str] = payload.get("session_output") + self.name: Optional[str] = payload.get("name") + self.status: Optional[str] = payload.get("status") + + self._solution = { + "account_sid": account_sid or self.account_sid, + "call_sid": call_sid or self.call_sid, + "sid": sid or self.sid, + } + self._context: Optional[TwimlSessionContext] = None + + @property + def _proxy(self) -> "TwimlSessionContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: TwimlSessionContext for this TwimlSessionInstance + """ + if self._context is None: + self._context = TwimlSessionContext( + self._version, + account_sid=self._solution["account_sid"], + call_sid=self._solution["call_sid"], + sid=self._solution["sid"], + ) + return self._context + + def fetch(self) -> "TwimlSessionInstance": + """ + Fetch the TwimlSessionInstance + + + :returns: The fetched TwimlSessionInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "TwimlSessionInstance": + """ + Asynchronous coroutine to fetch the TwimlSessionInstance + + + :returns: The fetched TwimlSessionInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the TwimlSessionInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the TwimlSessionInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_async() + + def update( + self, + url: Union[str, object] = values.unset, + method: Union[str, object] = values.unset, + twiml: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + ) -> "TwimlSessionInstance": + """ + Update the TwimlSessionInstance + + :param url: The URL to fetch TwiML instructions from during the session. + :param method: The HTTP method to use when fetching the TwiML instructions from the URL. Possible values are `GET` or `POST`. + :param twiml: The TwiML instructions to execute during the session. + :param status: The new status of the TwiML Session. Possible values include `stopped`. + + :returns: The updated TwimlSessionInstance + """ + return self._proxy.update( + url=url, + method=method, + twiml=twiml, + status=status, + ) + + async def update_async( + self, + url: Union[str, object] = values.unset, + method: Union[str, object] = values.unset, + twiml: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + ) -> "TwimlSessionInstance": + """ + Asynchronous coroutine to update the TwimlSessionInstance + + :param url: The URL to fetch TwiML instructions from during the session. + :param method: The HTTP method to use when fetching the TwiML instructions from the URL. Possible values are `GET` or `POST`. + :param twiml: The TwiML instructions to execute during the session. + :param status: The new status of the TwiML Session. Possible values include `stopped`. + + :returns: The updated TwimlSessionInstance + """ + return await self._proxy.update_async( + url=url, + method=method, + twiml=twiml, + status=status, + ) + + def update_with_http_info( + self, + url: Union[str, object] = values.unset, + method: Union[str, object] = values.unset, + twiml: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Update the TwimlSessionInstance with HTTP info + + :param url: The URL to fetch TwiML instructions from during the session. + :param method: The HTTP method to use when fetching the TwiML instructions from the URL. Possible values are `GET` or `POST`. + :param twiml: The TwiML instructions to execute during the session. + :param status: The new status of the TwiML Session. Possible values include `stopped`. + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.update_with_http_info( + url=url, + method=method, + twiml=twiml, + status=status, + ) + + async def update_with_http_info_async( + self, + url: Union[str, object] = values.unset, + method: Union[str, object] = values.unset, + twiml: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to update the TwimlSessionInstance with HTTP info + + :param url: The URL to fetch TwiML instructions from during the session. + :param method: The HTTP method to use when fetching the TwiML instructions from the URL. Possible values are `GET` or `POST`. + :param twiml: The TwiML instructions to execute during the session. + :param status: The new status of the TwiML Session. Possible values include `stopped`. + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.update_with_http_info_async( + url=url, + method=method, + twiml=twiml, + status=status, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class TwimlSessionContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, call_sid: str, sid: str): + """ + Initialize the TwimlSessionContext + + :param version: Version that contains the resource + :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TwiML Session resource to update. + :param call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) associated with the TwiML Session resource to update. + :param sid: The unique string that identifies the TwiML Session resource to update. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "account_sid": account_sid, + "call_sid": call_sid, + "sid": sid, + } + self._uri = ( + "/Accounts/{account_sid}/Calls/{call_sid}/TwimlSessions/{sid}.json".format( + **self._solution + ) + ) + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> TwimlSessionInstance: + """ + Fetch the TwimlSessionInstance + + + :returns: The fetched TwimlSessionInstance + """ + payload, _, _ = self._fetch() + return TwimlSessionInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + call_sid=self._solution["call_sid"], + sid=self._solution["sid"], + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the TwimlSessionInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = TwimlSessionInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + call_sid=self._solution["call_sid"], + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> TwimlSessionInstance: + """ + Asynchronous coroutine to fetch the TwimlSessionInstance + + + :returns: The fetched TwimlSessionInstance + """ + payload, _, _ = await self._fetch_async() + return TwimlSessionInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + call_sid=self._solution["call_sid"], + sid=self._solution["sid"], + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the TwimlSessionInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = TwimlSessionInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + call_sid=self._solution["call_sid"], + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def _update( + self, + url: Union[str, object] = values.unset, + method: Union[str, object] = values.unset, + twiml: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + ) -> tuple: + """ + Internal helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "Url": url, + "Method": method, + "Twiml": twiml, + "Status": status, + } + ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return self._version.update_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def update( + self, + url: Union[str, object] = values.unset, + method: Union[str, object] = values.unset, + twiml: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + ) -> TwimlSessionInstance: + """ + Update the TwimlSessionInstance + + :param url: The URL to fetch TwiML instructions from during the session. + :param method: The HTTP method to use when fetching the TwiML instructions from the URL. Possible values are `GET` or `POST`. + :param twiml: The TwiML instructions to execute during the session. + :param status: The new status of the TwiML Session. Possible values include `stopped`. + + :returns: The updated TwimlSessionInstance + """ + payload, _, _ = self._update(url=url, method=method, twiml=twiml, status=status) + return TwimlSessionInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + call_sid=self._solution["call_sid"], + sid=self._solution["sid"], + ) + + def update_with_http_info( + self, + url: Union[str, object] = values.unset, + method: Union[str, object] = values.unset, + twiml: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Update the TwimlSessionInstance and return response metadata + + :param url: The URL to fetch TwiML instructions from during the session. + :param method: The HTTP method to use when fetching the TwiML instructions from the URL. Possible values are `GET` or `POST`. + :param twiml: The TwiML instructions to execute during the session. + :param status: The new status of the TwiML Session. Possible values include `stopped`. + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._update( + url=url, method=method, twiml=twiml, status=status + ) + instance = TwimlSessionInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + call_sid=self._solution["call_sid"], + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _update_async( + self, + url: Union[str, object] = values.unset, + method: Union[str, object] = values.unset, + twiml: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + ) -> tuple: + """ + Internal async helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "Url": url, + "Method": method, + "Twiml": twiml, + "Status": status, + } + ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return await self._version.update_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def update_async( + self, + url: Union[str, object] = values.unset, + method: Union[str, object] = values.unset, + twiml: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + ) -> TwimlSessionInstance: + """ + Asynchronous coroutine to update the TwimlSessionInstance + + :param url: The URL to fetch TwiML instructions from during the session. + :param method: The HTTP method to use when fetching the TwiML instructions from the URL. Possible values are `GET` or `POST`. + :param twiml: The TwiML instructions to execute during the session. + :param status: The new status of the TwiML Session. Possible values include `stopped`. + + :returns: The updated TwimlSessionInstance + """ + payload, _, _ = await self._update_async( + url=url, method=method, twiml=twiml, status=status + ) + return TwimlSessionInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + call_sid=self._solution["call_sid"], + sid=self._solution["sid"], + ) + + async def update_with_http_info_async( + self, + url: Union[str, object] = values.unset, + method: Union[str, object] = values.unset, + twiml: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to update the TwimlSessionInstance and return response metadata + + :param url: The URL to fetch TwiML instructions from during the session. + :param method: The HTTP method to use when fetching the TwiML instructions from the URL. Possible values are `GET` or `POST`. + :param twiml: The TwiML instructions to execute during the session. + :param status: The new status of the TwiML Session. Possible values include `stopped`. + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._update_async( + url=url, method=method, twiml=twiml, status=status + ) + instance = TwimlSessionInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + call_sid=self._solution["call_sid"], + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class TwimlSessionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> TwimlSessionInstance: + """ + Build an instance of TwimlSessionInstance + + :param payload: Payload response from the API + """ + return TwimlSessionInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + call_sid=self._solution["call_sid"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class TwimlSessionList(ListResource): + def __init__(self, version: Version, account_sid: str, call_sid: str): + """ + Initialize the TwimlSessionList + + :param version: Version that contains the resource + :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TwiML Session resources to read. + :param call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) associated with the TwiML Session resources to read. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "account_sid": account_sid, + "call_sid": call_sid, + } + self._uri = ( + "/Accounts/{account_sid}/Calls/{call_sid}/TwimlSessions.json".format( + **self._solution + ) + ) + + def _create( + self, + url: Union[str, object] = values.unset, + method: Union[str, object] = values.unset, + twiml: Union[str, object] = values.unset, + session_input: Union[str, object] = values.unset, + session_output: Union[str, object] = values.unset, + name: Union[str, object] = values.unset, + ) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "Url": url, + "Method": method, + "Twiml": twiml, + "SessionInput": session_input, + "SessionOutput": session_output, + "Name": name, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, + url: Union[str, object] = values.unset, + method: Union[str, object] = values.unset, + twiml: Union[str, object] = values.unset, + session_input: Union[str, object] = values.unset, + session_output: Union[str, object] = values.unset, + name: Union[str, object] = values.unset, + ) -> TwimlSessionInstance: + """ + Create the TwimlSessionInstance + + :param url: The URL to fetch TwiML instructions from during the session. + :param method: The HTTP method to use when fetching the TwiML instructions from the URL. Possible values are `GET` or `POST`. + :param twiml: The TwiML instructions to execute during the session. + :param session_input: The input direction to provide to the TwiML Session. + :param session_output: The output direction to generate from the TwiML Session. + :param name: The name of the TwiML Session resource. + + :returns: The created TwimlSessionInstance + """ + payload, _, _ = self._create( + url=url, + method=method, + twiml=twiml, + session_input=session_input, + session_output=session_output, + name=name, + ) + return TwimlSessionInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + call_sid=self._solution["call_sid"], + ) + + def create_with_http_info( + self, + url: Union[str, object] = values.unset, + method: Union[str, object] = values.unset, + twiml: Union[str, object] = values.unset, + session_input: Union[str, object] = values.unset, + session_output: Union[str, object] = values.unset, + name: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Create the TwimlSessionInstance and return response metadata + + :param url: The URL to fetch TwiML instructions from during the session. + :param method: The HTTP method to use when fetching the TwiML instructions from the URL. Possible values are `GET` or `POST`. + :param twiml: The TwiML instructions to execute during the session. + :param session_input: The input direction to provide to the TwiML Session. + :param session_output: The output direction to generate from the TwiML Session. + :param name: The name of the TwiML Session resource. + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create( + url=url, + method=method, + twiml=twiml, + session_input=session_input, + session_output=session_output, + name=name, + ) + instance = TwimlSessionInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + call_sid=self._solution["call_sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async( + self, + url: Union[str, object] = values.unset, + method: Union[str, object] = values.unset, + twiml: Union[str, object] = values.unset, + session_input: Union[str, object] = values.unset, + session_output: Union[str, object] = values.unset, + name: Union[str, object] = values.unset, + ) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "Url": url, + "Method": method, + "Twiml": twiml, + "SessionInput": session_input, + "SessionOutput": session_output, + "Name": name, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, + url: Union[str, object] = values.unset, + method: Union[str, object] = values.unset, + twiml: Union[str, object] = values.unset, + session_input: Union[str, object] = values.unset, + session_output: Union[str, object] = values.unset, + name: Union[str, object] = values.unset, + ) -> TwimlSessionInstance: + """ + Asynchronously create the TwimlSessionInstance + + :param url: The URL to fetch TwiML instructions from during the session. + :param method: The HTTP method to use when fetching the TwiML instructions from the URL. Possible values are `GET` or `POST`. + :param twiml: The TwiML instructions to execute during the session. + :param session_input: The input direction to provide to the TwiML Session. + :param session_output: The output direction to generate from the TwiML Session. + :param name: The name of the TwiML Session resource. + + :returns: The created TwimlSessionInstance + """ + payload, _, _ = await self._create_async( + url=url, + method=method, + twiml=twiml, + session_input=session_input, + session_output=session_output, + name=name, + ) + return TwimlSessionInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + call_sid=self._solution["call_sid"], + ) + + async def create_with_http_info_async( + self, + url: Union[str, object] = values.unset, + method: Union[str, object] = values.unset, + twiml: Union[str, object] = values.unset, + session_input: Union[str, object] = values.unset, + session_output: Union[str, object] = values.unset, + name: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously create the TwimlSessionInstance and return response metadata + + :param url: The URL to fetch TwiML instructions from during the session. + :param method: The HTTP method to use when fetching the TwiML instructions from the URL. Possible values are `GET` or `POST`. + :param twiml: The TwiML instructions to execute during the session. + :param session_input: The input direction to provide to the TwiML Session. + :param session_output: The output direction to generate from the TwiML Session. + :param name: The name of the TwiML Session resource. + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + url=url, + method=method, + twiml=twiml, + session_input=session_input, + session_output=session_output, + name=name, + ) + instance = TwimlSessionInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + call_sid=self._solution["call_sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[TwimlSessionInstance]: + """ + Streams TwimlSessionInstance 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[TwimlSessionInstance]: + """ + Asynchronously streams TwimlSessionInstance 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 stream_with_http_info( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams TwimlSessionInstance and returns headers from first page + + + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info(page_size=limits["page_size"]) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams TwimlSessionInstance and returns headers from first page + + + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + page_size=limits["page_size"] + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[TwimlSessionInstance]: + """ + Lists TwimlSessionInstance 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[TwimlSessionInstance]: + """ + Asynchronously lists TwimlSessionInstance 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 list_with_http_info( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists TwimlSessionInstance and returns headers from first page + + + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists TwimlSessionInstance and returns headers from first page + + + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> TwimlSessionPage: + """ + Retrieve a single page of TwimlSessionInstance 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 TwimlSessionInstance + """ + 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 TwimlSessionPage(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, + ) -> TwimlSessionPage: + """ + Asynchronously retrieve a single page of TwimlSessionInstance 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 TwimlSessionInstance + """ + 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 TwimlSessionPage(self._version, response, self._solution) + + def page_with_http_info( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :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: ApiResponse with TwimlSessionPage, status code, and headers + """ + 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, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = TwimlSessionPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :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: ApiResponse with TwimlSessionPage, status code, and headers + """ + 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, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = TwimlSessionPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> TwimlSessionPage: + """ + Retrieve a specific page of TwimlSessionInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of TwimlSessionInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return TwimlSessionPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> TwimlSessionPage: + """ + Asynchronously retrieve a specific page of TwimlSessionInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of TwimlSessionInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return TwimlSessionPage(self._version, response, self._solution) + + def get(self, account_sid: str, call_sid: str, sid: str) -> TwimlSessionContext: + """ + Constructs a TwimlSessionContext + + :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TwiML Session resource to update. + :param call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) associated with the TwiML Session resource to update. + :param sid: The unique string that identifies the TwiML Session resource to update. + """ + return TwimlSessionContext( + self._version, account_sid=account_sid, call_sid=call_sid, sid=sid + ) + + def __call__( + self, account_sid: str, call_sid: str, sid: str + ) -> TwimlSessionContext: + """ + Constructs a TwimlSessionContext + + :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TwiML Session resource to update. + :param call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) associated with the TwiML Session resource to update. + :param sid: The unique string that identifies the TwiML Session resource to update. + """ + return TwimlSessionContext( + self._version, account_sid=account_sid, call_sid=call_sid, sid=sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/api/v2010/usage_record_time_parameterized.py b/twilio/rest/api/v2010/usage_record_time_parameterized.py new file mode 100644 index 000000000..457091851 --- /dev/null +++ b/twilio/rest/api/v2010/usage_record_time_parameterized.py @@ -0,0 +1,662 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from datetime import date +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, serialize, values +from twilio.base.api_response import ApiResponse + +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 UsageRecordTimeParameterizedInstance(InstanceResource): + + """ + :ivar account_sid: + :ivar api_version: + :ivar as_of: + :ivar category: + :ivar count: + :ivar count_unit: + :ivar description: + :ivar end_date: + :ivar price: + :ivar price_unit: + :ivar start_date: + :ivar subresource_uris: + :ivar uri: + :ivar usage: + :ivar usage_unit: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: Optional[str] = None, + time_window: Optional[str] = None, + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.api_version: Optional[str] = payload.get("api_version") + self.as_of: Optional[str] = payload.get("as_of") + self.category: Optional[str] = payload.get("category") + self.count: Optional[str] = payload.get("count") + self.count_unit: Optional[str] = payload.get("count_unit") + self.description: Optional[str] = payload.get("description") + self.end_date: Optional[date] = deserialize.iso8601_date( + payload.get("end_date") + ) + self.price: Optional[float] = deserialize.decimal(payload.get("price")) + self.price_unit: Optional[str] = payload.get("price_unit") + self.start_date: Optional[date] = deserialize.iso8601_date( + payload.get("start_date") + ) + self.subresource_uris: Optional[Dict[str, object]] = payload.get( + "subresource_uris" + ) + self.uri: Optional[str] = payload.get("uri") + self.usage: Optional[str] = payload.get("usage") + self.usage_unit: Optional[str] = payload.get("usage_unit") + + self._solution = { + "account_sid": account_sid or self.account_sid, + "time_window": time_window or self.time_window, + } + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format( + context + ) + + +class UsageRecordTimeParameterizedPage(Page): + def get_instance( + self, payload: Dict[str, Any] + ) -> UsageRecordTimeParameterizedInstance: + """ + Build an instance of UsageRecordTimeParameterizedInstance + + :param payload: Payload response from the API + """ + return UsageRecordTimeParameterizedInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + time_window=self._solution["time_window"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class UsageRecordTimeParameterizedList(ListResource): + def __init__(self, version: Version, account_sid: str, time_window: str): + """ + Initialize the UsageRecordTimeParameterizedList + + :param version: Version that contains the resource + :param account_sid: + :param time_window: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "account_sid": account_sid, + "time_window": time_window, + } + self._uri = "/Accounts/{account_sid}/Usage/Records/{time_window}.json".format( + **self._solution + ) + + def stream( + self, + category: Union[str, object] = values.unset, + start_date: Union[date, object] = values.unset, + end_date: Union[date, object] = values.unset, + include_subaccounts: Union[bool, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[UsageRecordTimeParameterizedInstance]: + """ + Streams UsageRecordTimeParameterizedInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str category: + :param date start_date: + :param date end_date: + :param bool include_subaccounts: + :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( + category=category, + start_date=start_date, + end_date=end_date, + include_subaccounts=include_subaccounts, + page_size=limits["page_size"], + ) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + category: Union[str, object] = values.unset, + start_date: Union[date, object] = values.unset, + end_date: Union[date, object] = values.unset, + include_subaccounts: Union[bool, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[UsageRecordTimeParameterizedInstance]: + """ + Asynchronously streams UsageRecordTimeParameterizedInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str category: + :param date start_date: + :param date end_date: + :param bool include_subaccounts: + :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( + category=category, + start_date=start_date, + end_date=end_date, + include_subaccounts=include_subaccounts, + page_size=limits["page_size"], + ) + + return self._version.stream_async(page, limits["limit"]) + + def stream_with_http_info( + self, + category: Union[str, object] = values.unset, + start_date: Union[date, object] = values.unset, + end_date: Union[date, object] = values.unset, + include_subaccounts: Union[bool, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams UsageRecordTimeParameterizedInstance and returns headers from first page + + + :param str category: + :param date start_date: + :param date end_date: + :param bool include_subaccounts: + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info( + category=category, + start_date=start_date, + end_date=end_date, + include_subaccounts=include_subaccounts, + page_size=limits["page_size"], + ) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + category: Union[str, object] = values.unset, + start_date: Union[date, object] = values.unset, + end_date: Union[date, object] = values.unset, + include_subaccounts: Union[bool, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams UsageRecordTimeParameterizedInstance and returns headers from first page + + + :param str category: + :param date start_date: + :param date end_date: + :param bool include_subaccounts: + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + category=category, + start_date=start_date, + end_date=end_date, + include_subaccounts=include_subaccounts, + page_size=limits["page_size"], + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + category: Union[str, object] = values.unset, + start_date: Union[date, object] = values.unset, + end_date: Union[date, object] = values.unset, + include_subaccounts: Union[bool, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[UsageRecordTimeParameterizedInstance]: + """ + Lists UsageRecordTimeParameterizedInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str category: + :param date start_date: + :param date end_date: + :param bool include_subaccounts: + :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( + category=category, + start_date=start_date, + end_date=end_date, + include_subaccounts=include_subaccounts, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + category: Union[str, object] = values.unset, + start_date: Union[date, object] = values.unset, + end_date: Union[date, object] = values.unset, + include_subaccounts: Union[bool, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[UsageRecordTimeParameterizedInstance]: + """ + Asynchronously lists UsageRecordTimeParameterizedInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str category: + :param date start_date: + :param date end_date: + :param bool include_subaccounts: + :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( + category=category, + start_date=start_date, + end_date=end_date, + include_subaccounts=include_subaccounts, + limit=limit, + page_size=page_size, + ) + ] + + def list_with_http_info( + self, + category: Union[str, object] = values.unset, + start_date: Union[date, object] = values.unset, + end_date: Union[date, object] = values.unset, + include_subaccounts: Union[bool, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists UsageRecordTimeParameterizedInstance and returns headers from first page + + + :param str category: + :param date start_date: + :param date end_date: + :param bool include_subaccounts: + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + category=category, + start_date=start_date, + end_date=end_date, + include_subaccounts=include_subaccounts, + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + category: Union[str, object] = values.unset, + start_date: Union[date, object] = values.unset, + end_date: Union[date, object] = values.unset, + include_subaccounts: Union[bool, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists UsageRecordTimeParameterizedInstance and returns headers from first page + + + :param str category: + :param date start_date: + :param date end_date: + :param bool include_subaccounts: + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + category=category, + start_date=start_date, + end_date=end_date, + include_subaccounts=include_subaccounts, + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + category: Union[str, object] = values.unset, + start_date: Union[date, object] = values.unset, + end_date: Union[date, object] = values.unset, + include_subaccounts: Union[bool, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> UsageRecordTimeParameterizedPage: + """ + Retrieve a single page of UsageRecordTimeParameterizedInstance records from the API. + Request is executed immediately + + :param category: + :param start_date: + :param end_date: + :param include_subaccounts: + :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 UsageRecordTimeParameterizedInstance + """ + data = values.of( + { + "Category": category, + "StartDate": serialize.iso8601_date(start_date), + "EndDate": serialize.iso8601_date(end_date), + "IncludeSubaccounts": serialize.boolean_to_string(include_subaccounts), + "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 UsageRecordTimeParameterizedPage(self._version, response, self._solution) + + async def page_async( + self, + category: Union[str, object] = values.unset, + start_date: Union[date, object] = values.unset, + end_date: Union[date, object] = values.unset, + include_subaccounts: Union[bool, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> UsageRecordTimeParameterizedPage: + """ + Asynchronously retrieve a single page of UsageRecordTimeParameterizedInstance records from the API. + Request is executed immediately + + :param category: + :param start_date: + :param end_date: + :param include_subaccounts: + :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 UsageRecordTimeParameterizedInstance + """ + data = values.of( + { + "Category": category, + "StartDate": serialize.iso8601_date(start_date), + "EndDate": serialize.iso8601_date(end_date), + "IncludeSubaccounts": serialize.boolean_to_string(include_subaccounts), + "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 UsageRecordTimeParameterizedPage(self._version, response, self._solution) + + def page_with_http_info( + self, + category: Union[str, object] = values.unset, + start_date: Union[date, object] = values.unset, + end_date: Union[date, object] = values.unset, + include_subaccounts: Union[bool, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :param category: + :param start_date: + :param end_date: + :param include_subaccounts: + :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: ApiResponse with UsageRecordTimeParameterizedPage, status code, and headers + """ + data = values.of( + { + "Category": category, + "StartDate": serialize.iso8601_date(start_date), + "EndDate": serialize.iso8601_date(end_date), + "IncludeSubaccounts": serialize.boolean_to_string(include_subaccounts), + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = UsageRecordTimeParameterizedPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + category: Union[str, object] = values.unset, + start_date: Union[date, object] = values.unset, + end_date: Union[date, object] = values.unset, + include_subaccounts: Union[bool, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :param category: + :param start_date: + :param end_date: + :param include_subaccounts: + :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: ApiResponse with UsageRecordTimeParameterizedPage, status code, and headers + """ + data = values.of( + { + "Category": category, + "StartDate": serialize.iso8601_date(start_date), + "EndDate": serialize.iso8601_date(end_date), + "IncludeSubaccounts": serialize.boolean_to_string(include_subaccounts), + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = UsageRecordTimeParameterizedPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> UsageRecordTimeParameterizedPage: + """ + Retrieve a specific page of UsageRecordTimeParameterizedInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of UsageRecordTimeParameterizedInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return UsageRecordTimeParameterizedPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> UsageRecordTimeParameterizedPage: + """ + Asynchronously retrieve a specific page of UsageRecordTimeParameterizedInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of UsageRecordTimeParameterizedInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return UsageRecordTimeParameterizedPage(self._version, response, self._solution) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/assistants/AssistantsBase.py b/twilio/rest/assistants/AssistantsBase.py index a9c9e9afc..cda903c70 100644 --- a/twilio/rest/assistants/AssistantsBase.py +++ b/twilio/rest/assistants/AssistantsBase.py @@ -17,7 +17,6 @@ class AssistantsBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Assistants Domain diff --git a/twilio/rest/assistants/__init__.py b/twilio/rest/assistants/__init__.py index 889daf9d2..b6942d7bf 100644 --- a/twilio/rest/assistants/__init__.py +++ b/twilio/rest/assistants/__init__.py @@ -9,7 +9,6 @@ class Assistants(AssistantsBase): - @property def assistants(self) -> AssistantList: warn( diff --git a/twilio/rest/assistants/v1/__init__.py b/twilio/rest/assistants/v1/__init__.py index 546ad1455..2dab57a0a 100644 --- a/twilio/rest/assistants/v1/__init__.py +++ b/twilio/rest/assistants/v1/__init__.py @@ -23,7 +23,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Assistants diff --git a/twilio/rest/assistants/v1/assistant/__init__.py b/twilio/rest/assistants/v1/assistant/__init__.py index ac8ba32c6..906d43de5 100644 --- a/twilio/rest/assistants/v1/assistant/__init__.py +++ b/twilio/rest/assistants/v1/assistant/__init__.py @@ -12,6 +12,7 @@ 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 @@ -30,7 +31,6 @@ class AssistantInstance(InstanceResource): - class AssistantsV1ServiceCreateAssistantRequest(object): """ :ivar customer_ai: @@ -41,10 +41,9 @@ class AssistantsV1ServiceCreateAssistantRequest(object): """ def __init__(self, payload: Dict[str, Any]): - - self.customer_ai: Optional[AssistantList.AssistantsV1ServiceCustomerAi] = ( - payload.get("customer_ai") - ) + self.customer_ai: Optional[ + AssistantList.AssistantsV1ServiceCustomerAi + ] = payload.get("customer_ai") self.name: Optional[str] = payload.get("name") self.owner: Optional[str] = payload.get("owner") self.personality_prompt: Optional[str] = payload.get("personality_prompt") @@ -54,17 +53,15 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { - "customer_ai": ( - self.customer_ai.to_dict() if self.customer_ai is not None else None - ), + "customer_ai": self.customer_ai.to_dict() + if self.customer_ai is not None + else None, "name": self.name, "owner": self.owner, "personality_prompt": self.personality_prompt, - "segment_credential": ( - self.segment_credential.to_dict() - if self.segment_credential is not None - else None - ), + "segment_credential": self.segment_credential.to_dict() + if self.segment_credential is not None + else None, } class AssistantsV1ServiceCustomerAi(object): @@ -74,7 +71,6 @@ class AssistantsV1ServiceCustomerAi(object): """ def __init__(self, payload: Dict[str, Any]): - self.perception_engine_enabled: Optional[bool] = payload.get( "perception_engine_enabled" ) @@ -96,7 +92,6 @@ class AssistantsV1ServiceSegmentCredential(object): """ def __init__(self, payload: Dict[str, Any]): - self.profile_api_key: Optional[str] = payload.get("profile_api_key") self.space_id: Optional[str] = payload.get("space_id") self.write_key: Optional[str] = payload.get("write_key") @@ -118,10 +113,9 @@ class AssistantsV1ServiceUpdateAssistantRequest(object): """ def __init__(self, payload: Dict[str, Any]): - - self.customer_ai: Optional[AssistantList.AssistantsV1ServiceCustomerAi] = ( - payload.get("customer_ai") - ) + self.customer_ai: Optional[ + AssistantList.AssistantsV1ServiceCustomerAi + ] = payload.get("customer_ai") self.name: Optional[str] = payload.get("name") self.owner: Optional[str] = payload.get("owner") self.personality_prompt: Optional[str] = payload.get("personality_prompt") @@ -131,17 +125,15 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { - "customer_ai": ( - self.customer_ai.to_dict() if self.customer_ai is not None else None - ), + "customer_ai": self.customer_ai.to_dict() + if self.customer_ai is not None + else None, "name": self.name, "owner": self.owner, "personality_prompt": self.personality_prompt, - "segment_credential": ( - self.segment_credential.to_dict() - if self.segment_credential is not None - else None - ), + "segment_credential": self.segment_credential.to_dict() + if self.segment_credential is not None + else None, } """ @@ -380,7 +372,6 @@ def __repr__(self) -> str: class AssistantContext(InstanceContext): - class AssistantsV1ServiceCreateAssistantRequest(object): """ :ivar customer_ai: @@ -391,10 +382,9 @@ class AssistantsV1ServiceCreateAssistantRequest(object): """ def __init__(self, payload: Dict[str, Any]): - - self.customer_ai: Optional[AssistantList.AssistantsV1ServiceCustomerAi] = ( - payload.get("customer_ai") - ) + self.customer_ai: Optional[ + AssistantList.AssistantsV1ServiceCustomerAi + ] = payload.get("customer_ai") self.name: Optional[str] = payload.get("name") self.owner: Optional[str] = payload.get("owner") self.personality_prompt: Optional[str] = payload.get("personality_prompt") @@ -404,17 +394,15 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { - "customer_ai": ( - self.customer_ai.to_dict() if self.customer_ai is not None else None - ), + "customer_ai": self.customer_ai.to_dict() + if self.customer_ai is not None + else None, "name": self.name, "owner": self.owner, "personality_prompt": self.personality_prompt, - "segment_credential": ( - self.segment_credential.to_dict() - if self.segment_credential is not None - else None - ), + "segment_credential": self.segment_credential.to_dict() + if self.segment_credential is not None + else None, } class AssistantsV1ServiceCustomerAi(object): @@ -424,7 +412,6 @@ class AssistantsV1ServiceCustomerAi(object): """ def __init__(self, payload: Dict[str, Any]): - self.perception_engine_enabled: Optional[bool] = payload.get( "perception_engine_enabled" ) @@ -446,7 +433,6 @@ class AssistantsV1ServiceSegmentCredential(object): """ def __init__(self, payload: Dict[str, Any]): - self.profile_api_key: Optional[str] = payload.get("profile_api_key") self.space_id: Optional[str] = payload.get("space_id") self.write_key: Optional[str] = payload.get("write_key") @@ -468,10 +454,9 @@ class AssistantsV1ServiceUpdateAssistantRequest(object): """ def __init__(self, payload: Dict[str, Any]): - - self.customer_ai: Optional[AssistantList.AssistantsV1ServiceCustomerAi] = ( - payload.get("customer_ai") - ) + self.customer_ai: Optional[ + AssistantList.AssistantsV1ServiceCustomerAi + ] = payload.get("customer_ai") self.name: Optional[str] = payload.get("name") self.owner: Optional[str] = payload.get("owner") self.personality_prompt: Optional[str] = payload.get("personality_prompt") @@ -481,17 +466,15 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { - "customer_ai": ( - self.customer_ai.to_dict() if self.customer_ai is not None else None - ), + "customer_ai": self.customer_ai.to_dict() + if self.customer_ai is not None + else None, "name": self.name, "owner": self.owner, "personality_prompt": self.personality_prompt, - "segment_credential": ( - self.segment_credential.to_dict() - if self.segment_credential is not None - else None - ), + "segment_credential": self.segment_credential.to_dict() + if self.segment_credential is not None + else None, } def __init__(self, version: Version, id: str): @@ -853,7 +836,6 @@ def __repr__(self) -> str: class AssistantPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> AssistantInstance: """ Build an instance of AssistantInstance @@ -872,7 +854,6 @@ def __repr__(self) -> str: class AssistantList(ListResource): - class AssistantsV1ServiceCreateAssistantRequest(object): """ :ivar customer_ai: @@ -883,10 +864,9 @@ class AssistantsV1ServiceCreateAssistantRequest(object): """ def __init__(self, payload: Dict[str, Any]): - - self.customer_ai: Optional[AssistantList.AssistantsV1ServiceCustomerAi] = ( - payload.get("customer_ai") - ) + self.customer_ai: Optional[ + AssistantList.AssistantsV1ServiceCustomerAi + ] = payload.get("customer_ai") self.name: Optional[str] = payload.get("name") self.owner: Optional[str] = payload.get("owner") self.personality_prompt: Optional[str] = payload.get("personality_prompt") @@ -896,17 +876,15 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { - "customer_ai": ( - self.customer_ai.to_dict() if self.customer_ai is not None else None - ), + "customer_ai": self.customer_ai.to_dict() + if self.customer_ai is not None + else None, "name": self.name, "owner": self.owner, "personality_prompt": self.personality_prompt, - "segment_credential": ( - self.segment_credential.to_dict() - if self.segment_credential is not None - else None - ), + "segment_credential": self.segment_credential.to_dict() + if self.segment_credential is not None + else None, } class AssistantsV1ServiceCustomerAi(object): @@ -916,7 +894,6 @@ class AssistantsV1ServiceCustomerAi(object): """ def __init__(self, payload: Dict[str, Any]): - self.perception_engine_enabled: Optional[bool] = payload.get( "perception_engine_enabled" ) @@ -938,7 +915,6 @@ class AssistantsV1ServiceSegmentCredential(object): """ def __init__(self, payload: Dict[str, Any]): - self.profile_api_key: Optional[str] = payload.get("profile_api_key") self.space_id: Optional[str] = payload.get("space_id") self.write_key: Optional[str] = payload.get("write_key") @@ -960,10 +936,9 @@ class AssistantsV1ServiceUpdateAssistantRequest(object): """ def __init__(self, payload: Dict[str, Any]): - - self.customer_ai: Optional[AssistantList.AssistantsV1ServiceCustomerAi] = ( - payload.get("customer_ai") - ) + self.customer_ai: Optional[ + AssistantList.AssistantsV1ServiceCustomerAi + ] = payload.get("customer_ai") self.name: Optional[str] = payload.get("name") self.owner: Optional[str] = payload.get("owner") self.personality_prompt: Optional[str] = payload.get("personality_prompt") @@ -973,17 +948,15 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { - "customer_ai": ( - self.customer_ai.to_dict() if self.customer_ai is not None else None - ), + "customer_ai": self.customer_ai.to_dict() + if self.customer_ai is not None + else None, "name": self.name, "owner": self.owner, "personality_prompt": self.personality_prompt, - "segment_credential": ( - self.segment_credential.to_dict() - if self.segment_credential is not None - else None - ), + "segment_credential": self.segment_credential.to_dict() + if self.segment_credential is not None + else None, } def __init__(self, version: Version): @@ -1438,10 +1411,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AssistantPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/assistants/v1/assistant/assistants_knowledge.py b/twilio/rest/assistants/v1/assistant/assistants_knowledge.py index ea8308d48..117f05e67 100644 --- a/twilio/rest/assistants/v1/assistant/assistants_knowledge.py +++ b/twilio/rest/assistants/v1/assistant/assistants_knowledge.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class AssistantsKnowledgeInstance(InstanceResource): + """ :ivar description: The type of knowledge source. :ivar id: The description of knowledge. @@ -170,7 +172,6 @@ def __repr__(self) -> str: class AssistantsKnowledgeContext(InstanceContext): - def __init__(self, version: Version, assistant_id: str, id: str): """ Initialize the AssistantsKnowledgeContext @@ -359,7 +360,6 @@ def __repr__(self) -> str: class AssistantsKnowledgePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> AssistantsKnowledgeInstance: """ Build an instance of AssistantsKnowledgeInstance @@ -380,7 +380,6 @@ def __repr__(self) -> str: class AssistantsKnowledgeList(ListResource): - def __init__(self, version: Version, assistant_id: str): """ Initialize the AssistantsKnowledgeList @@ -806,10 +805,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AssistantsKnowledgePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/assistants/v1/assistant/assistants_tool.py b/twilio/rest/assistants/v1/assistant/assistants_tool.py index d44c6af1f..4398c7e20 100644 --- a/twilio/rest/assistants/v1/assistant/assistants_tool.py +++ b/twilio/rest/assistants/v1/assistant/assistants_tool.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class AssistantsToolInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Tool resource. :ivar description: The description of the tool. @@ -168,7 +170,6 @@ def __repr__(self) -> str: class AssistantsToolContext(InstanceContext): - def __init__(self, version: Version, assistant_id: str, id: str): """ Initialize the AssistantsToolContext @@ -357,7 +358,6 @@ def __repr__(self) -> str: class AssistantsToolPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> AssistantsToolInstance: """ Build an instance of AssistantsToolInstance @@ -378,7 +378,6 @@ def __repr__(self) -> str: class AssistantsToolList(ListResource): - def __init__(self, version: Version, assistant_id: str): """ Initialize the AssistantsToolList @@ -804,10 +803,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AssistantsToolPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/assistants/v1/assistant/feedback.py b/twilio/rest/assistants/v1/assistant/feedback.py index e3410dbe9..989efc5d6 100644 --- a/twilio/rest/assistants/v1/assistant/feedback.py +++ b/twilio/rest/assistants/v1/assistant/feedback.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class FeedbackInstance(InstanceResource): - class AssistantsV1ServiceCreateFeedbackRequest(object): """ :ivar message_id: The message ID. @@ -34,7 +34,6 @@ class AssistantsV1ServiceCreateFeedbackRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.message_id: Optional[str] = payload.get("message_id") self.score: Optional[float] = payload.get("score") self.session_id: Optional[str] = payload.get("session_id") @@ -94,7 +93,6 @@ def __repr__(self) -> str: class FeedbackPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> FeedbackInstance: """ Build an instance of FeedbackInstance @@ -113,7 +111,6 @@ def __repr__(self) -> str: class FeedbackList(ListResource): - class AssistantsV1ServiceCreateFeedbackRequest(object): """ :ivar message_id: The message ID. @@ -123,7 +120,6 @@ class AssistantsV1ServiceCreateFeedbackRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.message_id: Optional[str] = payload.get("message_id") self.score: Optional[float] = payload.get("score") self.session_id: Optional[str] = payload.get("session_id") @@ -594,10 +590,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = FeedbackPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/assistants/v1/assistant/message.py b/twilio/rest/assistants/v1/assistant/message.py index 38adca4ce..dfe851cf2 100644 --- a/twilio/rest/assistants/v1/assistant/message.py +++ b/twilio/rest/assistants/v1/assistant/message.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,7 +23,6 @@ class MessageInstance(InstanceResource): - class AssistantsV1ServiceAssistantSendMessageRequest(object): """ :ivar identity: The unique identity of user for the session. @@ -33,7 +33,6 @@ class AssistantsV1ServiceAssistantSendMessageRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.identity: Optional[str] = payload.get("identity") self.session_id: Optional[str] = payload.get("session_id") self.body: Optional[str] = payload.get("body") @@ -85,7 +84,6 @@ def __repr__(self) -> str: class MessageList(ListResource): - class AssistantsV1ServiceAssistantSendMessageRequest(object): """ :ivar identity: The unique identity of user for the session. @@ -96,7 +94,6 @@ class AssistantsV1ServiceAssistantSendMessageRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.identity: Optional[str] = payload.get("identity") self.session_id: Optional[str] = payload.get("session_id") self.body: Optional[str] = payload.get("body") diff --git a/twilio/rest/assistants/v1/knowledge/__init__.py b/twilio/rest/assistants/v1/knowledge/__init__.py index 5b93f43dd..b7774070a 100644 --- a/twilio/rest/assistants/v1/knowledge/__init__.py +++ b/twilio/rest/assistants/v1/knowledge/__init__.py @@ -12,6 +12,7 @@ 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 @@ -26,7 +27,6 @@ class KnowledgeInstance(InstanceResource): - class AssistantsV1ServiceCreateKnowledgeRequest(object): """ :ivar assistant_id: The Assistant ID. @@ -39,7 +39,6 @@ class AssistantsV1ServiceCreateKnowledgeRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.assistant_id: Optional[str] = payload.get("assistant_id") self.description: Optional[str] = payload.get("description") self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( @@ -73,7 +72,6 @@ class AssistantsV1ServiceCreatePolicyRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.description: Optional[str] = payload.get("description") self.id: Optional[str] = payload.get("id") self.name: Optional[str] = payload.get("name") @@ -102,7 +100,6 @@ class AssistantsV1ServiceUpdateKnowledgeRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.description: Optional[str] = payload.get("description") self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( "knowledge_source_details" @@ -346,7 +343,6 @@ def __repr__(self) -> str: class KnowledgeContext(InstanceContext): - class AssistantsV1ServiceCreateKnowledgeRequest(object): """ :ivar assistant_id: The Assistant ID. @@ -359,7 +355,6 @@ class AssistantsV1ServiceCreateKnowledgeRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.assistant_id: Optional[str] = payload.get("assistant_id") self.description: Optional[str] = payload.get("description") self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( @@ -393,7 +388,6 @@ class AssistantsV1ServiceCreatePolicyRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.description: Optional[str] = payload.get("description") self.id: Optional[str] = payload.get("id") self.name: Optional[str] = payload.get("name") @@ -422,7 +416,6 @@ class AssistantsV1ServiceUpdateKnowledgeRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.description: Optional[str] = payload.get("description") self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( "knowledge_source_details" @@ -777,7 +770,6 @@ def __repr__(self) -> str: class KnowledgePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> KnowledgeInstance: """ Build an instance of KnowledgeInstance @@ -796,7 +788,6 @@ def __repr__(self) -> str: class KnowledgeList(ListResource): - class AssistantsV1ServiceCreateKnowledgeRequest(object): """ :ivar assistant_id: The Assistant ID. @@ -809,7 +800,6 @@ class AssistantsV1ServiceCreateKnowledgeRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.assistant_id: Optional[str] = payload.get("assistant_id") self.description: Optional[str] = payload.get("description") self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( @@ -843,7 +833,6 @@ class AssistantsV1ServiceCreatePolicyRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.description: Optional[str] = payload.get("description") self.id: Optional[str] = payload.get("id") self.name: Optional[str] = payload.get("name") @@ -872,7 +861,6 @@ class AssistantsV1ServiceUpdateKnowledgeRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.description: Optional[str] = payload.get("description") self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( "knowledge_source_details" @@ -1382,10 +1370,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = KnowledgePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/assistants/v1/knowledge/chunk.py b/twilio/rest/assistants/v1/knowledge/chunk.py index 2ef3f6d7f..5b646bfac 100644 --- a/twilio/rest/assistants/v1/knowledge/chunk.py +++ b/twilio/rest/assistants/v1/knowledge/chunk.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class ChunkInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource. :ivar content: The chunk content. @@ -60,7 +62,6 @@ def __repr__(self) -> str: class ChunkPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ChunkInstance: """ Build an instance of ChunkInstance @@ -79,7 +80,6 @@ def __repr__(self) -> str: class ChunkList(ListResource): - def __init__(self, version: Version, id: str): """ Initialize the ChunkList @@ -427,10 +427,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ChunkPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/assistants/v1/knowledge/knowledge_status.py b/twilio/rest/assistants/v1/knowledge/knowledge_status.py index 65c8c8b7c..625eac7e5 100644 --- a/twilio/rest/assistants/v1/knowledge/knowledge_status.py +++ b/twilio/rest/assistants/v1/knowledge/knowledge_status.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional from twilio.base import deserialize, values @@ -23,6 +24,7 @@ class KnowledgeStatusInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource. :ivar status: The status of processing the knowledge source ('QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED') @@ -107,7 +109,6 @@ def __repr__(self) -> str: class KnowledgeStatusContext(InstanceContext): - def __init__(self, version: Version, id: str): """ Initialize the KnowledgeStatusContext @@ -224,7 +225,6 @@ def __repr__(self) -> str: class KnowledgeStatusList(ListResource): - def __init__(self, version: Version, id: str): """ Initialize the KnowledgeStatusList diff --git a/twilio/rest/assistants/v1/policy.py b/twilio/rest/assistants/v1/policy.py index e0839b302..0c249ab25 100644 --- a/twilio/rest/assistants/v1/policy.py +++ b/twilio/rest/assistants/v1/policy.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class PolicyInstance(InstanceResource): + """ :ivar id: The Policy ID. :ivar name: The name of the policy. @@ -64,7 +66,6 @@ def __repr__(self) -> str: class PolicyPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> PolicyInstance: """ Build an instance of PolicyInstance @@ -83,7 +84,6 @@ def __repr__(self) -> str: class PolicyList(ListResource): - def __init__(self, version: Version): """ Initialize the PolicyList @@ -496,10 +496,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = PolicyPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/assistants/v1/session/__init__.py b/twilio/rest/assistants/v1/session/__init__.py index 08b12f504..fc99a1312 100644 --- a/twilio/rest/assistants/v1/session/__init__.py +++ b/twilio/rest/assistants/v1/session/__init__.py @@ -12,6 +12,7 @@ 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 @@ -25,6 +26,7 @@ class SessionInstance(InstanceResource): + """ :ivar id: The Session ID. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Session resource. @@ -126,7 +128,6 @@ def __repr__(self) -> str: class SessionContext(InstanceContext): - def __init__(self, version: Version, id: str): """ Initialize the SessionContext @@ -257,7 +258,6 @@ def __repr__(self) -> str: class SessionPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SessionInstance: """ Build an instance of SessionInstance @@ -276,7 +276,6 @@ def __repr__(self) -> str: class SessionList(ListResource): - def __init__(self, version: Version): """ Initialize the SessionList @@ -619,10 +618,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SessionPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/assistants/v1/session/message.py b/twilio/rest/assistants/v1/session/message.py index 97ee1bedf..9e2bc4226 100644 --- a/twilio/rest/assistants/v1/session/message.py +++ b/twilio/rest/assistants/v1/session/message.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class MessageInstance(InstanceResource): + """ :ivar id: The message ID. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Message resource. @@ -70,7 +72,6 @@ def __repr__(self) -> str: class MessagePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> MessageInstance: """ Build an instance of MessageInstance @@ -91,7 +92,6 @@ def __repr__(self) -> str: class MessageList(ListResource): - def __init__(self, version: Version, session_id: str): """ Initialize the MessageList @@ -439,10 +439,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = MessagePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/assistants/v1/tool.py b/twilio/rest/assistants/v1/tool.py index 269deb36d..80b134fe1 100644 --- a/twilio/rest/assistants/v1/tool.py +++ b/twilio/rest/assistants/v1/tool.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class ToolInstance(InstanceResource): - class AssistantsV1ServiceCreatePolicyRequest(object): """ :ivar description: The description of the policy. @@ -35,7 +35,6 @@ class AssistantsV1ServiceCreatePolicyRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.description: Optional[str] = payload.get("description") self.id: Optional[str] = payload.get("id") self.name: Optional[str] = payload.get("name") @@ -65,15 +64,14 @@ class AssistantsV1ServiceCreateToolRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.assistant_id: Optional[str] = payload.get("assistant_id") self.description: Optional[str] = payload.get("description") self.enabled: Optional[bool] = payload.get("enabled") self.meta: Optional[Dict[str, object]] = payload.get("meta") self.name: Optional[str] = payload.get("name") - self.policy: Optional[ToolList.AssistantsV1ServiceCreatePolicyRequest] = ( - payload.get("policy") - ) + self.policy: Optional[ + ToolList.AssistantsV1ServiceCreatePolicyRequest + ] = payload.get("policy") self.type: Optional[str] = payload.get("type") def to_dict(self): @@ -99,15 +97,14 @@ class AssistantsV1ServiceUpdateToolRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.assistant_id: Optional[str] = payload.get("assistant_id") self.description: Optional[str] = payload.get("description") self.enabled: Optional[bool] = payload.get("enabled") self.meta: Optional[Dict[str, object]] = payload.get("meta") self.name: Optional[str] = payload.get("name") - self.policy: Optional[ToolList.AssistantsV1ServiceCreatePolicyRequest] = ( - payload.get("policy") - ) + self.policy: Optional[ + ToolList.AssistantsV1ServiceCreatePolicyRequest + ] = payload.get("policy") self.type: Optional[str] = payload.get("type") def to_dict(self): @@ -329,7 +326,6 @@ def __repr__(self) -> str: class ToolContext(InstanceContext): - class AssistantsV1ServiceCreatePolicyRequest(object): """ :ivar description: The description of the policy. @@ -340,7 +336,6 @@ class AssistantsV1ServiceCreatePolicyRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.description: Optional[str] = payload.get("description") self.id: Optional[str] = payload.get("id") self.name: Optional[str] = payload.get("name") @@ -370,15 +365,14 @@ class AssistantsV1ServiceCreateToolRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.assistant_id: Optional[str] = payload.get("assistant_id") self.description: Optional[str] = payload.get("description") self.enabled: Optional[bool] = payload.get("enabled") self.meta: Optional[Dict[str, object]] = payload.get("meta") self.name: Optional[str] = payload.get("name") - self.policy: Optional[ToolList.AssistantsV1ServiceCreatePolicyRequest] = ( - payload.get("policy") - ) + self.policy: Optional[ + ToolList.AssistantsV1ServiceCreatePolicyRequest + ] = payload.get("policy") self.type: Optional[str] = payload.get("type") def to_dict(self): @@ -404,15 +398,14 @@ class AssistantsV1ServiceUpdateToolRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.assistant_id: Optional[str] = payload.get("assistant_id") self.description: Optional[str] = payload.get("description") self.enabled: Optional[bool] = payload.get("enabled") self.meta: Optional[Dict[str, object]] = payload.get("meta") self.name: Optional[str] = payload.get("name") - self.policy: Optional[ToolList.AssistantsV1ServiceCreatePolicyRequest] = ( - payload.get("policy") - ) + self.policy: Optional[ + ToolList.AssistantsV1ServiceCreatePolicyRequest + ] = payload.get("policy") self.type: Optional[str] = payload.get("type") def to_dict(self): @@ -732,7 +725,6 @@ def __repr__(self) -> str: class ToolPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ToolInstance: """ Build an instance of ToolInstance @@ -751,7 +743,6 @@ def __repr__(self) -> str: class ToolList(ListResource): - class AssistantsV1ServiceCreatePolicyRequest(object): """ :ivar description: The description of the policy. @@ -762,7 +753,6 @@ class AssistantsV1ServiceCreatePolicyRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.description: Optional[str] = payload.get("description") self.id: Optional[str] = payload.get("id") self.name: Optional[str] = payload.get("name") @@ -792,15 +782,14 @@ class AssistantsV1ServiceCreateToolRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.assistant_id: Optional[str] = payload.get("assistant_id") self.description: Optional[str] = payload.get("description") self.enabled: Optional[bool] = payload.get("enabled") self.meta: Optional[Dict[str, object]] = payload.get("meta") self.name: Optional[str] = payload.get("name") - self.policy: Optional[ToolList.AssistantsV1ServiceCreatePolicyRequest] = ( - payload.get("policy") - ) + self.policy: Optional[ + ToolList.AssistantsV1ServiceCreatePolicyRequest + ] = payload.get("policy") self.type: Optional[str] = payload.get("type") def to_dict(self): @@ -826,15 +815,14 @@ class AssistantsV1ServiceUpdateToolRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.assistant_id: Optional[str] = payload.get("assistant_id") self.description: Optional[str] = payload.get("description") self.enabled: Optional[bool] = payload.get("enabled") self.meta: Optional[Dict[str, object]] = payload.get("meta") self.name: Optional[str] = payload.get("name") - self.policy: Optional[ToolList.AssistantsV1ServiceCreatePolicyRequest] = ( - payload.get("policy") - ) + self.policy: Optional[ + ToolList.AssistantsV1ServiceCreatePolicyRequest + ] = payload.get("policy") self.type: Optional[str] = payload.get("type") def to_dict(self): @@ -1336,10 +1324,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ToolPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/bulkexports/BulkexportsBase.py b/twilio/rest/bulkexports/BulkexportsBase.py index cbca4c53e..d2efe642b 100644 --- a/twilio/rest/bulkexports/BulkexportsBase.py +++ b/twilio/rest/bulkexports/BulkexportsBase.py @@ -17,7 +17,6 @@ class BulkexportsBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Bulkexports Domain diff --git a/twilio/rest/bulkexports/v1/__init__.py b/twilio/rest/bulkexports/v1/__init__.py index a888fb484..e25eb3afc 100644 --- a/twilio/rest/bulkexports/v1/__init__.py +++ b/twilio/rest/bulkexports/v1/__init__.py @@ -20,7 +20,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Bulkexports diff --git a/twilio/rest/bulkexports/v1/export/__init__.py b/twilio/rest/bulkexports/v1/export/__init__.py index 92ec4d6bc..eb31be6d1 100644 --- a/twilio/rest/bulkexports/v1/export/__init__.py +++ b/twilio/rest/bulkexports/v1/export/__init__.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -26,6 +27,7 @@ class ExportInstance(InstanceResource): + """ :ivar resource_type: The type of communication – Messages, Calls, Conferences, and Participants :ivar url: The URL of this resource. @@ -125,7 +127,6 @@ def __repr__(self) -> str: class ExportContext(InstanceContext): - def __init__(self, version: Version, resource_type: str): """ Initialize the ExportContext @@ -269,7 +270,6 @@ def __repr__(self) -> str: class ExportList(ListResource): - def __init__(self, version: Version): """ Initialize the ExportList diff --git a/twilio/rest/bulkexports/v1/export/day.py b/twilio/rest/bulkexports/v1/export/day.py index 1c58666bd..a0b4364c2 100644 --- a/twilio/rest/bulkexports/v1/export/day.py +++ b/twilio/rest/bulkexports/v1/export/day.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class DayInstance(InstanceResource): + """ :ivar redirect_to: :ivar day: The ISO 8601 format date of the resources in the file, for a UTC day @@ -117,7 +119,6 @@ def __repr__(self) -> str: class DayContext(InstanceContext): - def __init__(self, version: Version, resource_type: str, day: str): """ Initialize the DayContext @@ -240,7 +241,6 @@ def __repr__(self) -> str: class DayPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> DayInstance: """ Build an instance of DayInstance @@ -261,7 +261,6 @@ def __repr__(self) -> str: class DayList(ListResource): - def __init__(self, version: Version, resource_type: str): """ Initialize the DayList @@ -609,10 +608,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = DayPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/bulkexports/v1/export/export_custom_job.py b/twilio/rest/bulkexports/v1/export/export_custom_job.py index 047514365..3dfe67e81 100644 --- a/twilio/rest/bulkexports/v1/export/export_custom_job.py +++ b/twilio/rest/bulkexports/v1/export/export_custom_job.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class ExportCustomJobInstance(InstanceResource): + """ :ivar friendly_name: The friendly name specified when creating the job :ivar resource_type: The type of communication – Messages, Calls, Conferences, and Participants @@ -69,7 +71,6 @@ def __repr__(self) -> str: class ExportCustomJobPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ExportCustomJobInstance: """ Build an instance of ExportCustomJobInstance @@ -90,7 +91,6 @@ def __repr__(self) -> str: class ExportCustomJobList(ListResource): - def __init__(self, version: Version, resource_type: str): """ Initialize the ExportCustomJobList @@ -644,10 +644,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ExportCustomJobPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/bulkexports/v1/export/job.py b/twilio/rest/bulkexports/v1/export/job.py index a02458cf8..4138cf904 100644 --- a/twilio/rest/bulkexports/v1/export/job.py +++ b/twilio/rest/bulkexports/v1/export/job.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class JobInstance(InstanceResource): + """ :ivar resource_type: The type of communication – Messages, Calls, Conferences, and Participants :ivar friendly_name: The friendly name specified when creating the job @@ -160,7 +162,6 @@ def __repr__(self) -> str: class JobContext(InstanceContext): - def __init__(self, version: Version, job_sid: str): """ Initialize the JobContext @@ -345,7 +346,6 @@ def __repr__(self) -> str: class JobList(ListResource): - def __init__(self, version: Version): """ Initialize the JobList diff --git a/twilio/rest/bulkexports/v1/export_configuration.py b/twilio/rest/bulkexports/v1/export_configuration.py index 0050f8e11..74a3bd0ed 100644 --- a/twilio/rest/bulkexports/v1/export_configuration.py +++ b/twilio/rest/bulkexports/v1/export_configuration.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class ExportConfigurationInstance(InstanceResource): + """ :ivar enabled: If true, Twilio will automatically generate every day's file when the day is over. :ivar webhook_url: Stores the URL destination for the method specified in webhook_method. @@ -195,7 +197,6 @@ def __repr__(self) -> str: class ExportConfigurationContext(InstanceContext): - def __init__(self, version: Version, resource_type: str): """ Initialize the ExportConfigurationContext @@ -462,7 +463,6 @@ def __repr__(self) -> str: class ExportConfigurationList(ListResource): - def __init__(self, version: Version): """ Initialize the ExportConfigurationList diff --git a/twilio/rest/chat/ChatBase.py b/twilio/rest/chat/ChatBase.py index 6d8656da1..a84b4eb33 100644 --- a/twilio/rest/chat/ChatBase.py +++ b/twilio/rest/chat/ChatBase.py @@ -19,7 +19,6 @@ class ChatBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Chat Domain diff --git a/twilio/rest/chat/v1/__init__.py b/twilio/rest/chat/v1/__init__.py index d0ade9eed..f01101f7d 100644 --- a/twilio/rest/chat/v1/__init__.py +++ b/twilio/rest/chat/v1/__init__.py @@ -20,7 +20,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Chat diff --git a/twilio/rest/chat/v1/credential.py b/twilio/rest/chat/v1/credential.py index 75251a579..0c30463df 100644 --- a/twilio/rest/chat/v1/credential.py +++ b/twilio/rest/chat/v1/credential.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class CredentialInstance(InstanceResource): - class PushService(object): GCM = "gcm" APN = "apn" @@ -282,7 +282,6 @@ def __repr__(self) -> str: class CredentialContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the CredentialContext @@ -665,7 +664,6 @@ def __repr__(self) -> str: class CredentialPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> CredentialInstance: """ Build an instance of CredentialInstance @@ -684,7 +682,6 @@ def __repr__(self) -> str: class CredentialList(ListResource): - def __init__(self, version: Version): """ Initialize the CredentialList @@ -1241,10 +1238,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CredentialPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/chat/v1/service/__init__.py b/twilio/rest/chat/v1/service/__init__.py index 9c445403c..ac5aea8bd 100644 --- a/twilio/rest/chat/v1/service/__init__.py +++ b/twilio/rest/chat/v1/service/__init__.py @@ -12,6 +12,7 @@ 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 @@ -27,6 +28,7 @@ class ServiceInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Service resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Service resource. @@ -208,36 +210,52 @@ def update( webhook_filters: Union[List[str], object] = values.unset, webhooks_on_message_send_url: Union[str, object] = values.unset, webhooks_on_message_send_method: Union[str, object] = values.unset, + webhooks_on_message_send_format: Union[str, object] = values.unset, webhooks_on_message_update_url: Union[str, object] = values.unset, webhooks_on_message_update_method: Union[str, object] = values.unset, + webhooks_on_message_update_format: Union[str, object] = values.unset, webhooks_on_message_remove_url: Union[str, object] = values.unset, webhooks_on_message_remove_method: Union[str, object] = values.unset, + webhooks_on_message_remove_format: Union[str, object] = values.unset, webhooks_on_channel_add_url: Union[str, object] = values.unset, webhooks_on_channel_add_method: Union[str, object] = values.unset, + webhooks_on_channel_add_format: Union[str, object] = values.unset, webhooks_on_channel_destroy_url: Union[str, object] = values.unset, webhooks_on_channel_destroy_method: Union[str, object] = values.unset, + webhooks_on_channel_destroy_format: Union[str, object] = values.unset, webhooks_on_channel_update_url: Union[str, object] = values.unset, webhooks_on_channel_update_method: Union[str, object] = values.unset, + webhooks_on_channel_update_format: Union[str, object] = values.unset, webhooks_on_member_add_url: Union[str, object] = values.unset, webhooks_on_member_add_method: Union[str, object] = values.unset, + webhooks_on_member_add_format: Union[str, object] = values.unset, webhooks_on_member_remove_url: Union[str, object] = values.unset, webhooks_on_member_remove_method: Union[str, object] = values.unset, + webhooks_on_member_remove_format: Union[str, object] = values.unset, webhooks_on_message_sent_url: Union[str, object] = values.unset, webhooks_on_message_sent_method: Union[str, object] = values.unset, + webhooks_on_message_sent_format: Union[str, object] = values.unset, webhooks_on_message_updated_url: Union[str, object] = values.unset, webhooks_on_message_updated_method: Union[str, object] = values.unset, + webhooks_on_message_updated_format: Union[str, object] = values.unset, webhooks_on_message_removed_url: Union[str, object] = values.unset, webhooks_on_message_removed_method: Union[str, object] = values.unset, + webhooks_on_message_removed_format: Union[str, object] = values.unset, webhooks_on_channel_added_url: Union[str, object] = values.unset, webhooks_on_channel_added_method: Union[str, object] = values.unset, + webhooks_on_channel_added_format: Union[str, object] = values.unset, webhooks_on_channel_destroyed_url: Union[str, object] = values.unset, webhooks_on_channel_destroyed_method: Union[str, object] = values.unset, + webhooks_on_channel_destroyed_format: Union[str, object] = values.unset, webhooks_on_channel_updated_url: Union[str, object] = values.unset, webhooks_on_channel_updated_method: Union[str, object] = values.unset, + webhooks_on_channel_updated_format: Union[str, object] = values.unset, webhooks_on_member_added_url: Union[str, object] = values.unset, webhooks_on_member_added_method: Union[str, object] = values.unset, + webhooks_on_member_added_format: Union[str, object] = values.unset, webhooks_on_member_removed_url: Union[str, object] = values.unset, webhooks_on_member_removed_method: Union[str, object] = values.unset, + webhooks_on_member_removed_format: Union[str, object] = values.unset, limits_channel_members: Union[int, object] = values.unset, limits_user_channels: Union[int, object] = values.unset, ) -> "ServiceInstance": @@ -266,36 +284,52 @@ def update( :param webhook_filters: The list of WebHook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. :param webhooks_on_message_send_url: The URL of the webhook to call in response to the `on_message_send` event using the `webhooks.on_message_send.method` HTTP method. :param webhooks_on_message_send_method: The HTTP method to use when calling the `webhooks.on_message_send.url`. + :param webhooks_on_message_send_format: :param webhooks_on_message_update_url: The URL of the webhook to call in response to the `on_message_update` event using the `webhooks.on_message_update.method` HTTP method. :param webhooks_on_message_update_method: The HTTP method to use when calling the `webhooks.on_message_update.url`. + :param webhooks_on_message_update_format: :param webhooks_on_message_remove_url: The URL of the webhook to call in response to the `on_message_remove` event using the `webhooks.on_message_remove.method` HTTP method. :param webhooks_on_message_remove_method: The HTTP method to use when calling the `webhooks.on_message_remove.url`. + :param webhooks_on_message_remove_format: :param webhooks_on_channel_add_url: The URL of the webhook to call in response to the `on_channel_add` event using the `webhooks.on_channel_add.method` HTTP method. :param webhooks_on_channel_add_method: The HTTP method to use when calling the `webhooks.on_channel_add.url`. + :param webhooks_on_channel_add_format: :param webhooks_on_channel_destroy_url: The URL of the webhook to call in response to the `on_channel_destroy` event using the `webhooks.on_channel_destroy.method` HTTP method. :param webhooks_on_channel_destroy_method: The HTTP method to use when calling the `webhooks.on_channel_destroy.url`. + :param webhooks_on_channel_destroy_format: :param webhooks_on_channel_update_url: The URL of the webhook to call in response to the `on_channel_update` event using the `webhooks.on_channel_update.method` HTTP method. :param webhooks_on_channel_update_method: The HTTP method to use when calling the `webhooks.on_channel_update.url`. + :param webhooks_on_channel_update_format: :param webhooks_on_member_add_url: The URL of the webhook to call in response to the `on_member_add` event using the `webhooks.on_member_add.method` HTTP method. :param webhooks_on_member_add_method: The HTTP method to use when calling the `webhooks.on_member_add.url`. + :param webhooks_on_member_add_format: :param webhooks_on_member_remove_url: The URL of the webhook to call in response to the `on_member_remove` event using the `webhooks.on_member_remove.method` HTTP method. :param webhooks_on_member_remove_method: The HTTP method to use when calling the `webhooks.on_member_remove.url`. + :param webhooks_on_member_remove_format: :param webhooks_on_message_sent_url: The URL of the webhook to call in response to the `on_message_sent` event using the `webhooks.on_message_sent.method` HTTP method. :param webhooks_on_message_sent_method: The URL of the webhook to call in response to the `on_message_sent` event`. + :param webhooks_on_message_sent_format: :param webhooks_on_message_updated_url: The URL of the webhook to call in response to the `on_message_updated` event using the `webhooks.on_message_updated.method` HTTP method. :param webhooks_on_message_updated_method: The HTTP method to use when calling the `webhooks.on_message_updated.url`. + :param webhooks_on_message_updated_format: :param webhooks_on_message_removed_url: The URL of the webhook to call in response to the `on_message_removed` event using the `webhooks.on_message_removed.method` HTTP method. :param webhooks_on_message_removed_method: The HTTP method to use when calling the `webhooks.on_message_removed.url`. + :param webhooks_on_message_removed_format: :param webhooks_on_channel_added_url: The URL of the webhook to call in response to the `on_channel_added` event using the `webhooks.on_channel_added.method` HTTP method. :param webhooks_on_channel_added_method: The URL of the webhook to call in response to the `on_channel_added` event`. + :param webhooks_on_channel_added_format: :param webhooks_on_channel_destroyed_url: The URL of the webhook to call in response to the `on_channel_added` event using the `webhooks.on_channel_destroyed.method` HTTP method. :param webhooks_on_channel_destroyed_method: The HTTP method to use when calling the `webhooks.on_channel_destroyed.url`. + :param webhooks_on_channel_destroyed_format: :param webhooks_on_channel_updated_url: The URL of the webhook to call in response to the `on_channel_updated` event using the `webhooks.on_channel_updated.method` HTTP method. :param webhooks_on_channel_updated_method: The HTTP method to use when calling the `webhooks.on_channel_updated.url`. + :param webhooks_on_channel_updated_format: :param webhooks_on_member_added_url: The URL of the webhook to call in response to the `on_channel_updated` event using the `webhooks.on_channel_updated.method` HTTP method. :param webhooks_on_member_added_method: The HTTP method to use when calling the `webhooks.on_channel_updated.url`. + :param webhooks_on_member_added_format: :param webhooks_on_member_removed_url: The URL of the webhook to call in response to the `on_member_removed` event using the `webhooks.on_member_removed.method` HTTP method. :param webhooks_on_member_removed_method: The HTTP method to use when calling the `webhooks.on_member_removed.url`. + :param webhooks_on_member_removed_format: :param limits_channel_members: The maximum number of Members that can be added to Channels within this Service. Can be up to 1,000. :param limits_user_channels: The maximum number of Channels Users can be a Member of within this Service. Can be up to 1,000. @@ -324,36 +358,52 @@ def update( webhook_filters=webhook_filters, webhooks_on_message_send_url=webhooks_on_message_send_url, webhooks_on_message_send_method=webhooks_on_message_send_method, + webhooks_on_message_send_format=webhooks_on_message_send_format, webhooks_on_message_update_url=webhooks_on_message_update_url, webhooks_on_message_update_method=webhooks_on_message_update_method, + webhooks_on_message_update_format=webhooks_on_message_update_format, webhooks_on_message_remove_url=webhooks_on_message_remove_url, webhooks_on_message_remove_method=webhooks_on_message_remove_method, + webhooks_on_message_remove_format=webhooks_on_message_remove_format, webhooks_on_channel_add_url=webhooks_on_channel_add_url, webhooks_on_channel_add_method=webhooks_on_channel_add_method, + webhooks_on_channel_add_format=webhooks_on_channel_add_format, webhooks_on_channel_destroy_url=webhooks_on_channel_destroy_url, webhooks_on_channel_destroy_method=webhooks_on_channel_destroy_method, + webhooks_on_channel_destroy_format=webhooks_on_channel_destroy_format, webhooks_on_channel_update_url=webhooks_on_channel_update_url, webhooks_on_channel_update_method=webhooks_on_channel_update_method, + webhooks_on_channel_update_format=webhooks_on_channel_update_format, webhooks_on_member_add_url=webhooks_on_member_add_url, webhooks_on_member_add_method=webhooks_on_member_add_method, + webhooks_on_member_add_format=webhooks_on_member_add_format, webhooks_on_member_remove_url=webhooks_on_member_remove_url, webhooks_on_member_remove_method=webhooks_on_member_remove_method, + webhooks_on_member_remove_format=webhooks_on_member_remove_format, webhooks_on_message_sent_url=webhooks_on_message_sent_url, webhooks_on_message_sent_method=webhooks_on_message_sent_method, + webhooks_on_message_sent_format=webhooks_on_message_sent_format, webhooks_on_message_updated_url=webhooks_on_message_updated_url, webhooks_on_message_updated_method=webhooks_on_message_updated_method, + webhooks_on_message_updated_format=webhooks_on_message_updated_format, webhooks_on_message_removed_url=webhooks_on_message_removed_url, webhooks_on_message_removed_method=webhooks_on_message_removed_method, + webhooks_on_message_removed_format=webhooks_on_message_removed_format, webhooks_on_channel_added_url=webhooks_on_channel_added_url, webhooks_on_channel_added_method=webhooks_on_channel_added_method, + webhooks_on_channel_added_format=webhooks_on_channel_added_format, webhooks_on_channel_destroyed_url=webhooks_on_channel_destroyed_url, webhooks_on_channel_destroyed_method=webhooks_on_channel_destroyed_method, + webhooks_on_channel_destroyed_format=webhooks_on_channel_destroyed_format, webhooks_on_channel_updated_url=webhooks_on_channel_updated_url, webhooks_on_channel_updated_method=webhooks_on_channel_updated_method, + webhooks_on_channel_updated_format=webhooks_on_channel_updated_format, webhooks_on_member_added_url=webhooks_on_member_added_url, webhooks_on_member_added_method=webhooks_on_member_added_method, + webhooks_on_member_added_format=webhooks_on_member_added_format, webhooks_on_member_removed_url=webhooks_on_member_removed_url, webhooks_on_member_removed_method=webhooks_on_member_removed_method, + webhooks_on_member_removed_format=webhooks_on_member_removed_format, limits_channel_members=limits_channel_members, limits_user_channels=limits_user_channels, ) @@ -382,36 +432,52 @@ async def update_async( webhook_filters: Union[List[str], object] = values.unset, webhooks_on_message_send_url: Union[str, object] = values.unset, webhooks_on_message_send_method: Union[str, object] = values.unset, + webhooks_on_message_send_format: Union[str, object] = values.unset, webhooks_on_message_update_url: Union[str, object] = values.unset, webhooks_on_message_update_method: Union[str, object] = values.unset, + webhooks_on_message_update_format: Union[str, object] = values.unset, webhooks_on_message_remove_url: Union[str, object] = values.unset, webhooks_on_message_remove_method: Union[str, object] = values.unset, + webhooks_on_message_remove_format: Union[str, object] = values.unset, webhooks_on_channel_add_url: Union[str, object] = values.unset, webhooks_on_channel_add_method: Union[str, object] = values.unset, + webhooks_on_channel_add_format: Union[str, object] = values.unset, webhooks_on_channel_destroy_url: Union[str, object] = values.unset, webhooks_on_channel_destroy_method: Union[str, object] = values.unset, + webhooks_on_channel_destroy_format: Union[str, object] = values.unset, webhooks_on_channel_update_url: Union[str, object] = values.unset, webhooks_on_channel_update_method: Union[str, object] = values.unset, + webhooks_on_channel_update_format: Union[str, object] = values.unset, webhooks_on_member_add_url: Union[str, object] = values.unset, webhooks_on_member_add_method: Union[str, object] = values.unset, + webhooks_on_member_add_format: Union[str, object] = values.unset, webhooks_on_member_remove_url: Union[str, object] = values.unset, webhooks_on_member_remove_method: Union[str, object] = values.unset, + webhooks_on_member_remove_format: Union[str, object] = values.unset, webhooks_on_message_sent_url: Union[str, object] = values.unset, webhooks_on_message_sent_method: Union[str, object] = values.unset, + webhooks_on_message_sent_format: Union[str, object] = values.unset, webhooks_on_message_updated_url: Union[str, object] = values.unset, webhooks_on_message_updated_method: Union[str, object] = values.unset, + webhooks_on_message_updated_format: Union[str, object] = values.unset, webhooks_on_message_removed_url: Union[str, object] = values.unset, webhooks_on_message_removed_method: Union[str, object] = values.unset, + webhooks_on_message_removed_format: Union[str, object] = values.unset, webhooks_on_channel_added_url: Union[str, object] = values.unset, webhooks_on_channel_added_method: Union[str, object] = values.unset, + webhooks_on_channel_added_format: Union[str, object] = values.unset, webhooks_on_channel_destroyed_url: Union[str, object] = values.unset, webhooks_on_channel_destroyed_method: Union[str, object] = values.unset, + webhooks_on_channel_destroyed_format: Union[str, object] = values.unset, webhooks_on_channel_updated_url: Union[str, object] = values.unset, webhooks_on_channel_updated_method: Union[str, object] = values.unset, + webhooks_on_channel_updated_format: Union[str, object] = values.unset, webhooks_on_member_added_url: Union[str, object] = values.unset, webhooks_on_member_added_method: Union[str, object] = values.unset, + webhooks_on_member_added_format: Union[str, object] = values.unset, webhooks_on_member_removed_url: Union[str, object] = values.unset, webhooks_on_member_removed_method: Union[str, object] = values.unset, + webhooks_on_member_removed_format: Union[str, object] = values.unset, limits_channel_members: Union[int, object] = values.unset, limits_user_channels: Union[int, object] = values.unset, ) -> "ServiceInstance": @@ -440,36 +506,52 @@ async def update_async( :param webhook_filters: The list of WebHook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. :param webhooks_on_message_send_url: The URL of the webhook to call in response to the `on_message_send` event using the `webhooks.on_message_send.method` HTTP method. :param webhooks_on_message_send_method: The HTTP method to use when calling the `webhooks.on_message_send.url`. + :param webhooks_on_message_send_format: :param webhooks_on_message_update_url: The URL of the webhook to call in response to the `on_message_update` event using the `webhooks.on_message_update.method` HTTP method. :param webhooks_on_message_update_method: The HTTP method to use when calling the `webhooks.on_message_update.url`. + :param webhooks_on_message_update_format: :param webhooks_on_message_remove_url: The URL of the webhook to call in response to the `on_message_remove` event using the `webhooks.on_message_remove.method` HTTP method. :param webhooks_on_message_remove_method: The HTTP method to use when calling the `webhooks.on_message_remove.url`. + :param webhooks_on_message_remove_format: :param webhooks_on_channel_add_url: The URL of the webhook to call in response to the `on_channel_add` event using the `webhooks.on_channel_add.method` HTTP method. :param webhooks_on_channel_add_method: The HTTP method to use when calling the `webhooks.on_channel_add.url`. + :param webhooks_on_channel_add_format: :param webhooks_on_channel_destroy_url: The URL of the webhook to call in response to the `on_channel_destroy` event using the `webhooks.on_channel_destroy.method` HTTP method. :param webhooks_on_channel_destroy_method: The HTTP method to use when calling the `webhooks.on_channel_destroy.url`. + :param webhooks_on_channel_destroy_format: :param webhooks_on_channel_update_url: The URL of the webhook to call in response to the `on_channel_update` event using the `webhooks.on_channel_update.method` HTTP method. :param webhooks_on_channel_update_method: The HTTP method to use when calling the `webhooks.on_channel_update.url`. + :param webhooks_on_channel_update_format: :param webhooks_on_member_add_url: The URL of the webhook to call in response to the `on_member_add` event using the `webhooks.on_member_add.method` HTTP method. :param webhooks_on_member_add_method: The HTTP method to use when calling the `webhooks.on_member_add.url`. + :param webhooks_on_member_add_format: :param webhooks_on_member_remove_url: The URL of the webhook to call in response to the `on_member_remove` event using the `webhooks.on_member_remove.method` HTTP method. :param webhooks_on_member_remove_method: The HTTP method to use when calling the `webhooks.on_member_remove.url`. + :param webhooks_on_member_remove_format: :param webhooks_on_message_sent_url: The URL of the webhook to call in response to the `on_message_sent` event using the `webhooks.on_message_sent.method` HTTP method. :param webhooks_on_message_sent_method: The URL of the webhook to call in response to the `on_message_sent` event`. + :param webhooks_on_message_sent_format: :param webhooks_on_message_updated_url: The URL of the webhook to call in response to the `on_message_updated` event using the `webhooks.on_message_updated.method` HTTP method. :param webhooks_on_message_updated_method: The HTTP method to use when calling the `webhooks.on_message_updated.url`. + :param webhooks_on_message_updated_format: :param webhooks_on_message_removed_url: The URL of the webhook to call in response to the `on_message_removed` event using the `webhooks.on_message_removed.method` HTTP method. :param webhooks_on_message_removed_method: The HTTP method to use when calling the `webhooks.on_message_removed.url`. + :param webhooks_on_message_removed_format: :param webhooks_on_channel_added_url: The URL of the webhook to call in response to the `on_channel_added` event using the `webhooks.on_channel_added.method` HTTP method. :param webhooks_on_channel_added_method: The URL of the webhook to call in response to the `on_channel_added` event`. + :param webhooks_on_channel_added_format: :param webhooks_on_channel_destroyed_url: The URL of the webhook to call in response to the `on_channel_added` event using the `webhooks.on_channel_destroyed.method` HTTP method. :param webhooks_on_channel_destroyed_method: The HTTP method to use when calling the `webhooks.on_channel_destroyed.url`. + :param webhooks_on_channel_destroyed_format: :param webhooks_on_channel_updated_url: The URL of the webhook to call in response to the `on_channel_updated` event using the `webhooks.on_channel_updated.method` HTTP method. :param webhooks_on_channel_updated_method: The HTTP method to use when calling the `webhooks.on_channel_updated.url`. + :param webhooks_on_channel_updated_format: :param webhooks_on_member_added_url: The URL of the webhook to call in response to the `on_channel_updated` event using the `webhooks.on_channel_updated.method` HTTP method. :param webhooks_on_member_added_method: The HTTP method to use when calling the `webhooks.on_channel_updated.url`. + :param webhooks_on_member_added_format: :param webhooks_on_member_removed_url: The URL of the webhook to call in response to the `on_member_removed` event using the `webhooks.on_member_removed.method` HTTP method. :param webhooks_on_member_removed_method: The HTTP method to use when calling the `webhooks.on_member_removed.url`. + :param webhooks_on_member_removed_format: :param limits_channel_members: The maximum number of Members that can be added to Channels within this Service. Can be up to 1,000. :param limits_user_channels: The maximum number of Channels Users can be a Member of within this Service. Can be up to 1,000. @@ -498,36 +580,52 @@ async def update_async( webhook_filters=webhook_filters, webhooks_on_message_send_url=webhooks_on_message_send_url, webhooks_on_message_send_method=webhooks_on_message_send_method, + webhooks_on_message_send_format=webhooks_on_message_send_format, webhooks_on_message_update_url=webhooks_on_message_update_url, webhooks_on_message_update_method=webhooks_on_message_update_method, + webhooks_on_message_update_format=webhooks_on_message_update_format, webhooks_on_message_remove_url=webhooks_on_message_remove_url, webhooks_on_message_remove_method=webhooks_on_message_remove_method, + webhooks_on_message_remove_format=webhooks_on_message_remove_format, webhooks_on_channel_add_url=webhooks_on_channel_add_url, webhooks_on_channel_add_method=webhooks_on_channel_add_method, + webhooks_on_channel_add_format=webhooks_on_channel_add_format, webhooks_on_channel_destroy_url=webhooks_on_channel_destroy_url, webhooks_on_channel_destroy_method=webhooks_on_channel_destroy_method, + webhooks_on_channel_destroy_format=webhooks_on_channel_destroy_format, webhooks_on_channel_update_url=webhooks_on_channel_update_url, webhooks_on_channel_update_method=webhooks_on_channel_update_method, + webhooks_on_channel_update_format=webhooks_on_channel_update_format, webhooks_on_member_add_url=webhooks_on_member_add_url, webhooks_on_member_add_method=webhooks_on_member_add_method, + webhooks_on_member_add_format=webhooks_on_member_add_format, webhooks_on_member_remove_url=webhooks_on_member_remove_url, webhooks_on_member_remove_method=webhooks_on_member_remove_method, + webhooks_on_member_remove_format=webhooks_on_member_remove_format, webhooks_on_message_sent_url=webhooks_on_message_sent_url, webhooks_on_message_sent_method=webhooks_on_message_sent_method, + webhooks_on_message_sent_format=webhooks_on_message_sent_format, webhooks_on_message_updated_url=webhooks_on_message_updated_url, webhooks_on_message_updated_method=webhooks_on_message_updated_method, + webhooks_on_message_updated_format=webhooks_on_message_updated_format, webhooks_on_message_removed_url=webhooks_on_message_removed_url, webhooks_on_message_removed_method=webhooks_on_message_removed_method, + webhooks_on_message_removed_format=webhooks_on_message_removed_format, webhooks_on_channel_added_url=webhooks_on_channel_added_url, webhooks_on_channel_added_method=webhooks_on_channel_added_method, + webhooks_on_channel_added_format=webhooks_on_channel_added_format, webhooks_on_channel_destroyed_url=webhooks_on_channel_destroyed_url, webhooks_on_channel_destroyed_method=webhooks_on_channel_destroyed_method, + webhooks_on_channel_destroyed_format=webhooks_on_channel_destroyed_format, webhooks_on_channel_updated_url=webhooks_on_channel_updated_url, webhooks_on_channel_updated_method=webhooks_on_channel_updated_method, + webhooks_on_channel_updated_format=webhooks_on_channel_updated_format, webhooks_on_member_added_url=webhooks_on_member_added_url, webhooks_on_member_added_method=webhooks_on_member_added_method, + webhooks_on_member_added_format=webhooks_on_member_added_format, webhooks_on_member_removed_url=webhooks_on_member_removed_url, webhooks_on_member_removed_method=webhooks_on_member_removed_method, + webhooks_on_member_removed_format=webhooks_on_member_removed_format, limits_channel_members=limits_channel_members, limits_user_channels=limits_user_channels, ) @@ -556,36 +654,52 @@ def update_with_http_info( webhook_filters: Union[List[str], object] = values.unset, webhooks_on_message_send_url: Union[str, object] = values.unset, webhooks_on_message_send_method: Union[str, object] = values.unset, + webhooks_on_message_send_format: Union[str, object] = values.unset, webhooks_on_message_update_url: Union[str, object] = values.unset, webhooks_on_message_update_method: Union[str, object] = values.unset, + webhooks_on_message_update_format: Union[str, object] = values.unset, webhooks_on_message_remove_url: Union[str, object] = values.unset, webhooks_on_message_remove_method: Union[str, object] = values.unset, + webhooks_on_message_remove_format: Union[str, object] = values.unset, webhooks_on_channel_add_url: Union[str, object] = values.unset, webhooks_on_channel_add_method: Union[str, object] = values.unset, + webhooks_on_channel_add_format: Union[str, object] = values.unset, webhooks_on_channel_destroy_url: Union[str, object] = values.unset, webhooks_on_channel_destroy_method: Union[str, object] = values.unset, + webhooks_on_channel_destroy_format: Union[str, object] = values.unset, webhooks_on_channel_update_url: Union[str, object] = values.unset, webhooks_on_channel_update_method: Union[str, object] = values.unset, + webhooks_on_channel_update_format: Union[str, object] = values.unset, webhooks_on_member_add_url: Union[str, object] = values.unset, webhooks_on_member_add_method: Union[str, object] = values.unset, + webhooks_on_member_add_format: Union[str, object] = values.unset, webhooks_on_member_remove_url: Union[str, object] = values.unset, webhooks_on_member_remove_method: Union[str, object] = values.unset, + webhooks_on_member_remove_format: Union[str, object] = values.unset, webhooks_on_message_sent_url: Union[str, object] = values.unset, webhooks_on_message_sent_method: Union[str, object] = values.unset, + webhooks_on_message_sent_format: Union[str, object] = values.unset, webhooks_on_message_updated_url: Union[str, object] = values.unset, webhooks_on_message_updated_method: Union[str, object] = values.unset, + webhooks_on_message_updated_format: Union[str, object] = values.unset, webhooks_on_message_removed_url: Union[str, object] = values.unset, webhooks_on_message_removed_method: Union[str, object] = values.unset, + webhooks_on_message_removed_format: Union[str, object] = values.unset, webhooks_on_channel_added_url: Union[str, object] = values.unset, webhooks_on_channel_added_method: Union[str, object] = values.unset, + webhooks_on_channel_added_format: Union[str, object] = values.unset, webhooks_on_channel_destroyed_url: Union[str, object] = values.unset, webhooks_on_channel_destroyed_method: Union[str, object] = values.unset, + webhooks_on_channel_destroyed_format: Union[str, object] = values.unset, webhooks_on_channel_updated_url: Union[str, object] = values.unset, webhooks_on_channel_updated_method: Union[str, object] = values.unset, + webhooks_on_channel_updated_format: Union[str, object] = values.unset, webhooks_on_member_added_url: Union[str, object] = values.unset, webhooks_on_member_added_method: Union[str, object] = values.unset, + webhooks_on_member_added_format: Union[str, object] = values.unset, webhooks_on_member_removed_url: Union[str, object] = values.unset, webhooks_on_member_removed_method: Union[str, object] = values.unset, + webhooks_on_member_removed_format: Union[str, object] = values.unset, limits_channel_members: Union[int, object] = values.unset, limits_user_channels: Union[int, object] = values.unset, ) -> ApiResponse: @@ -614,36 +728,52 @@ def update_with_http_info( :param webhook_filters: The list of WebHook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. :param webhooks_on_message_send_url: The URL of the webhook to call in response to the `on_message_send` event using the `webhooks.on_message_send.method` HTTP method. :param webhooks_on_message_send_method: The HTTP method to use when calling the `webhooks.on_message_send.url`. + :param webhooks_on_message_send_format: :param webhooks_on_message_update_url: The URL of the webhook to call in response to the `on_message_update` event using the `webhooks.on_message_update.method` HTTP method. :param webhooks_on_message_update_method: The HTTP method to use when calling the `webhooks.on_message_update.url`. + :param webhooks_on_message_update_format: :param webhooks_on_message_remove_url: The URL of the webhook to call in response to the `on_message_remove` event using the `webhooks.on_message_remove.method` HTTP method. :param webhooks_on_message_remove_method: The HTTP method to use when calling the `webhooks.on_message_remove.url`. + :param webhooks_on_message_remove_format: :param webhooks_on_channel_add_url: The URL of the webhook to call in response to the `on_channel_add` event using the `webhooks.on_channel_add.method` HTTP method. :param webhooks_on_channel_add_method: The HTTP method to use when calling the `webhooks.on_channel_add.url`. + :param webhooks_on_channel_add_format: :param webhooks_on_channel_destroy_url: The URL of the webhook to call in response to the `on_channel_destroy` event using the `webhooks.on_channel_destroy.method` HTTP method. :param webhooks_on_channel_destroy_method: The HTTP method to use when calling the `webhooks.on_channel_destroy.url`. + :param webhooks_on_channel_destroy_format: :param webhooks_on_channel_update_url: The URL of the webhook to call in response to the `on_channel_update` event using the `webhooks.on_channel_update.method` HTTP method. :param webhooks_on_channel_update_method: The HTTP method to use when calling the `webhooks.on_channel_update.url`. + :param webhooks_on_channel_update_format: :param webhooks_on_member_add_url: The URL of the webhook to call in response to the `on_member_add` event using the `webhooks.on_member_add.method` HTTP method. :param webhooks_on_member_add_method: The HTTP method to use when calling the `webhooks.on_member_add.url`. + :param webhooks_on_member_add_format: :param webhooks_on_member_remove_url: The URL of the webhook to call in response to the `on_member_remove` event using the `webhooks.on_member_remove.method` HTTP method. :param webhooks_on_member_remove_method: The HTTP method to use when calling the `webhooks.on_member_remove.url`. + :param webhooks_on_member_remove_format: :param webhooks_on_message_sent_url: The URL of the webhook to call in response to the `on_message_sent` event using the `webhooks.on_message_sent.method` HTTP method. :param webhooks_on_message_sent_method: The URL of the webhook to call in response to the `on_message_sent` event`. + :param webhooks_on_message_sent_format: :param webhooks_on_message_updated_url: The URL of the webhook to call in response to the `on_message_updated` event using the `webhooks.on_message_updated.method` HTTP method. :param webhooks_on_message_updated_method: The HTTP method to use when calling the `webhooks.on_message_updated.url`. + :param webhooks_on_message_updated_format: :param webhooks_on_message_removed_url: The URL of the webhook to call in response to the `on_message_removed` event using the `webhooks.on_message_removed.method` HTTP method. :param webhooks_on_message_removed_method: The HTTP method to use when calling the `webhooks.on_message_removed.url`. + :param webhooks_on_message_removed_format: :param webhooks_on_channel_added_url: The URL of the webhook to call in response to the `on_channel_added` event using the `webhooks.on_channel_added.method` HTTP method. :param webhooks_on_channel_added_method: The URL of the webhook to call in response to the `on_channel_added` event`. + :param webhooks_on_channel_added_format: :param webhooks_on_channel_destroyed_url: The URL of the webhook to call in response to the `on_channel_added` event using the `webhooks.on_channel_destroyed.method` HTTP method. :param webhooks_on_channel_destroyed_method: The HTTP method to use when calling the `webhooks.on_channel_destroyed.url`. + :param webhooks_on_channel_destroyed_format: :param webhooks_on_channel_updated_url: The URL of the webhook to call in response to the `on_channel_updated` event using the `webhooks.on_channel_updated.method` HTTP method. :param webhooks_on_channel_updated_method: The HTTP method to use when calling the `webhooks.on_channel_updated.url`. + :param webhooks_on_channel_updated_format: :param webhooks_on_member_added_url: The URL of the webhook to call in response to the `on_channel_updated` event using the `webhooks.on_channel_updated.method` HTTP method. :param webhooks_on_member_added_method: The HTTP method to use when calling the `webhooks.on_channel_updated.url`. + :param webhooks_on_member_added_format: :param webhooks_on_member_removed_url: The URL of the webhook to call in response to the `on_member_removed` event using the `webhooks.on_member_removed.method` HTTP method. :param webhooks_on_member_removed_method: The HTTP method to use when calling the `webhooks.on_member_removed.url`. + :param webhooks_on_member_removed_format: :param limits_channel_members: The maximum number of Members that can be added to Channels within this Service. Can be up to 1,000. :param limits_user_channels: The maximum number of Channels Users can be a Member of within this Service. Can be up to 1,000. @@ -672,36 +802,52 @@ def update_with_http_info( webhook_filters=webhook_filters, webhooks_on_message_send_url=webhooks_on_message_send_url, webhooks_on_message_send_method=webhooks_on_message_send_method, + webhooks_on_message_send_format=webhooks_on_message_send_format, webhooks_on_message_update_url=webhooks_on_message_update_url, webhooks_on_message_update_method=webhooks_on_message_update_method, + webhooks_on_message_update_format=webhooks_on_message_update_format, webhooks_on_message_remove_url=webhooks_on_message_remove_url, webhooks_on_message_remove_method=webhooks_on_message_remove_method, + webhooks_on_message_remove_format=webhooks_on_message_remove_format, webhooks_on_channel_add_url=webhooks_on_channel_add_url, webhooks_on_channel_add_method=webhooks_on_channel_add_method, + webhooks_on_channel_add_format=webhooks_on_channel_add_format, webhooks_on_channel_destroy_url=webhooks_on_channel_destroy_url, webhooks_on_channel_destroy_method=webhooks_on_channel_destroy_method, + webhooks_on_channel_destroy_format=webhooks_on_channel_destroy_format, webhooks_on_channel_update_url=webhooks_on_channel_update_url, webhooks_on_channel_update_method=webhooks_on_channel_update_method, + webhooks_on_channel_update_format=webhooks_on_channel_update_format, webhooks_on_member_add_url=webhooks_on_member_add_url, webhooks_on_member_add_method=webhooks_on_member_add_method, + webhooks_on_member_add_format=webhooks_on_member_add_format, webhooks_on_member_remove_url=webhooks_on_member_remove_url, webhooks_on_member_remove_method=webhooks_on_member_remove_method, + webhooks_on_member_remove_format=webhooks_on_member_remove_format, webhooks_on_message_sent_url=webhooks_on_message_sent_url, webhooks_on_message_sent_method=webhooks_on_message_sent_method, + webhooks_on_message_sent_format=webhooks_on_message_sent_format, webhooks_on_message_updated_url=webhooks_on_message_updated_url, webhooks_on_message_updated_method=webhooks_on_message_updated_method, + webhooks_on_message_updated_format=webhooks_on_message_updated_format, webhooks_on_message_removed_url=webhooks_on_message_removed_url, webhooks_on_message_removed_method=webhooks_on_message_removed_method, + webhooks_on_message_removed_format=webhooks_on_message_removed_format, webhooks_on_channel_added_url=webhooks_on_channel_added_url, webhooks_on_channel_added_method=webhooks_on_channel_added_method, + webhooks_on_channel_added_format=webhooks_on_channel_added_format, webhooks_on_channel_destroyed_url=webhooks_on_channel_destroyed_url, webhooks_on_channel_destroyed_method=webhooks_on_channel_destroyed_method, + webhooks_on_channel_destroyed_format=webhooks_on_channel_destroyed_format, webhooks_on_channel_updated_url=webhooks_on_channel_updated_url, webhooks_on_channel_updated_method=webhooks_on_channel_updated_method, + webhooks_on_channel_updated_format=webhooks_on_channel_updated_format, webhooks_on_member_added_url=webhooks_on_member_added_url, webhooks_on_member_added_method=webhooks_on_member_added_method, + webhooks_on_member_added_format=webhooks_on_member_added_format, webhooks_on_member_removed_url=webhooks_on_member_removed_url, webhooks_on_member_removed_method=webhooks_on_member_removed_method, + webhooks_on_member_removed_format=webhooks_on_member_removed_format, limits_channel_members=limits_channel_members, limits_user_channels=limits_user_channels, ) @@ -730,36 +876,52 @@ async def update_with_http_info_async( webhook_filters: Union[List[str], object] = values.unset, webhooks_on_message_send_url: Union[str, object] = values.unset, webhooks_on_message_send_method: Union[str, object] = values.unset, + webhooks_on_message_send_format: Union[str, object] = values.unset, webhooks_on_message_update_url: Union[str, object] = values.unset, webhooks_on_message_update_method: Union[str, object] = values.unset, + webhooks_on_message_update_format: Union[str, object] = values.unset, webhooks_on_message_remove_url: Union[str, object] = values.unset, webhooks_on_message_remove_method: Union[str, object] = values.unset, + webhooks_on_message_remove_format: Union[str, object] = values.unset, webhooks_on_channel_add_url: Union[str, object] = values.unset, webhooks_on_channel_add_method: Union[str, object] = values.unset, + webhooks_on_channel_add_format: Union[str, object] = values.unset, webhooks_on_channel_destroy_url: Union[str, object] = values.unset, webhooks_on_channel_destroy_method: Union[str, object] = values.unset, + webhooks_on_channel_destroy_format: Union[str, object] = values.unset, webhooks_on_channel_update_url: Union[str, object] = values.unset, webhooks_on_channel_update_method: Union[str, object] = values.unset, + webhooks_on_channel_update_format: Union[str, object] = values.unset, webhooks_on_member_add_url: Union[str, object] = values.unset, webhooks_on_member_add_method: Union[str, object] = values.unset, + webhooks_on_member_add_format: Union[str, object] = values.unset, webhooks_on_member_remove_url: Union[str, object] = values.unset, webhooks_on_member_remove_method: Union[str, object] = values.unset, + webhooks_on_member_remove_format: Union[str, object] = values.unset, webhooks_on_message_sent_url: Union[str, object] = values.unset, webhooks_on_message_sent_method: Union[str, object] = values.unset, + webhooks_on_message_sent_format: Union[str, object] = values.unset, webhooks_on_message_updated_url: Union[str, object] = values.unset, webhooks_on_message_updated_method: Union[str, object] = values.unset, + webhooks_on_message_updated_format: Union[str, object] = values.unset, webhooks_on_message_removed_url: Union[str, object] = values.unset, webhooks_on_message_removed_method: Union[str, object] = values.unset, + webhooks_on_message_removed_format: Union[str, object] = values.unset, webhooks_on_channel_added_url: Union[str, object] = values.unset, webhooks_on_channel_added_method: Union[str, object] = values.unset, + webhooks_on_channel_added_format: Union[str, object] = values.unset, webhooks_on_channel_destroyed_url: Union[str, object] = values.unset, webhooks_on_channel_destroyed_method: Union[str, object] = values.unset, + webhooks_on_channel_destroyed_format: Union[str, object] = values.unset, webhooks_on_channel_updated_url: Union[str, object] = values.unset, webhooks_on_channel_updated_method: Union[str, object] = values.unset, + webhooks_on_channel_updated_format: Union[str, object] = values.unset, webhooks_on_member_added_url: Union[str, object] = values.unset, webhooks_on_member_added_method: Union[str, object] = values.unset, + webhooks_on_member_added_format: Union[str, object] = values.unset, webhooks_on_member_removed_url: Union[str, object] = values.unset, webhooks_on_member_removed_method: Union[str, object] = values.unset, + webhooks_on_member_removed_format: Union[str, object] = values.unset, limits_channel_members: Union[int, object] = values.unset, limits_user_channels: Union[int, object] = values.unset, ) -> ApiResponse: @@ -788,36 +950,52 @@ async def update_with_http_info_async( :param webhook_filters: The list of WebHook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. :param webhooks_on_message_send_url: The URL of the webhook to call in response to the `on_message_send` event using the `webhooks.on_message_send.method` HTTP method. :param webhooks_on_message_send_method: The HTTP method to use when calling the `webhooks.on_message_send.url`. + :param webhooks_on_message_send_format: :param webhooks_on_message_update_url: The URL of the webhook to call in response to the `on_message_update` event using the `webhooks.on_message_update.method` HTTP method. :param webhooks_on_message_update_method: The HTTP method to use when calling the `webhooks.on_message_update.url`. + :param webhooks_on_message_update_format: :param webhooks_on_message_remove_url: The URL of the webhook to call in response to the `on_message_remove` event using the `webhooks.on_message_remove.method` HTTP method. :param webhooks_on_message_remove_method: The HTTP method to use when calling the `webhooks.on_message_remove.url`. + :param webhooks_on_message_remove_format: :param webhooks_on_channel_add_url: The URL of the webhook to call in response to the `on_channel_add` event using the `webhooks.on_channel_add.method` HTTP method. :param webhooks_on_channel_add_method: The HTTP method to use when calling the `webhooks.on_channel_add.url`. + :param webhooks_on_channel_add_format: :param webhooks_on_channel_destroy_url: The URL of the webhook to call in response to the `on_channel_destroy` event using the `webhooks.on_channel_destroy.method` HTTP method. :param webhooks_on_channel_destroy_method: The HTTP method to use when calling the `webhooks.on_channel_destroy.url`. + :param webhooks_on_channel_destroy_format: :param webhooks_on_channel_update_url: The URL of the webhook to call in response to the `on_channel_update` event using the `webhooks.on_channel_update.method` HTTP method. :param webhooks_on_channel_update_method: The HTTP method to use when calling the `webhooks.on_channel_update.url`. + :param webhooks_on_channel_update_format: :param webhooks_on_member_add_url: The URL of the webhook to call in response to the `on_member_add` event using the `webhooks.on_member_add.method` HTTP method. :param webhooks_on_member_add_method: The HTTP method to use when calling the `webhooks.on_member_add.url`. + :param webhooks_on_member_add_format: :param webhooks_on_member_remove_url: The URL of the webhook to call in response to the `on_member_remove` event using the `webhooks.on_member_remove.method` HTTP method. :param webhooks_on_member_remove_method: The HTTP method to use when calling the `webhooks.on_member_remove.url`. + :param webhooks_on_member_remove_format: :param webhooks_on_message_sent_url: The URL of the webhook to call in response to the `on_message_sent` event using the `webhooks.on_message_sent.method` HTTP method. :param webhooks_on_message_sent_method: The URL of the webhook to call in response to the `on_message_sent` event`. + :param webhooks_on_message_sent_format: :param webhooks_on_message_updated_url: The URL of the webhook to call in response to the `on_message_updated` event using the `webhooks.on_message_updated.method` HTTP method. :param webhooks_on_message_updated_method: The HTTP method to use when calling the `webhooks.on_message_updated.url`. + :param webhooks_on_message_updated_format: :param webhooks_on_message_removed_url: The URL of the webhook to call in response to the `on_message_removed` event using the `webhooks.on_message_removed.method` HTTP method. :param webhooks_on_message_removed_method: The HTTP method to use when calling the `webhooks.on_message_removed.url`. + :param webhooks_on_message_removed_format: :param webhooks_on_channel_added_url: The URL of the webhook to call in response to the `on_channel_added` event using the `webhooks.on_channel_added.method` HTTP method. :param webhooks_on_channel_added_method: The URL of the webhook to call in response to the `on_channel_added` event`. + :param webhooks_on_channel_added_format: :param webhooks_on_channel_destroyed_url: The URL of the webhook to call in response to the `on_channel_added` event using the `webhooks.on_channel_destroyed.method` HTTP method. :param webhooks_on_channel_destroyed_method: The HTTP method to use when calling the `webhooks.on_channel_destroyed.url`. + :param webhooks_on_channel_destroyed_format: :param webhooks_on_channel_updated_url: The URL of the webhook to call in response to the `on_channel_updated` event using the `webhooks.on_channel_updated.method` HTTP method. :param webhooks_on_channel_updated_method: The HTTP method to use when calling the `webhooks.on_channel_updated.url`. + :param webhooks_on_channel_updated_format: :param webhooks_on_member_added_url: The URL of the webhook to call in response to the `on_channel_updated` event using the `webhooks.on_channel_updated.method` HTTP method. :param webhooks_on_member_added_method: The HTTP method to use when calling the `webhooks.on_channel_updated.url`. + :param webhooks_on_member_added_format: :param webhooks_on_member_removed_url: The URL of the webhook to call in response to the `on_member_removed` event using the `webhooks.on_member_removed.method` HTTP method. :param webhooks_on_member_removed_method: The HTTP method to use when calling the `webhooks.on_member_removed.url`. + :param webhooks_on_member_removed_format: :param limits_channel_members: The maximum number of Members that can be added to Channels within this Service. Can be up to 1,000. :param limits_user_channels: The maximum number of Channels Users can be a Member of within this Service. Can be up to 1,000. @@ -846,36 +1024,52 @@ async def update_with_http_info_async( webhook_filters=webhook_filters, webhooks_on_message_send_url=webhooks_on_message_send_url, webhooks_on_message_send_method=webhooks_on_message_send_method, + webhooks_on_message_send_format=webhooks_on_message_send_format, webhooks_on_message_update_url=webhooks_on_message_update_url, webhooks_on_message_update_method=webhooks_on_message_update_method, + webhooks_on_message_update_format=webhooks_on_message_update_format, webhooks_on_message_remove_url=webhooks_on_message_remove_url, webhooks_on_message_remove_method=webhooks_on_message_remove_method, + webhooks_on_message_remove_format=webhooks_on_message_remove_format, webhooks_on_channel_add_url=webhooks_on_channel_add_url, webhooks_on_channel_add_method=webhooks_on_channel_add_method, + webhooks_on_channel_add_format=webhooks_on_channel_add_format, webhooks_on_channel_destroy_url=webhooks_on_channel_destroy_url, webhooks_on_channel_destroy_method=webhooks_on_channel_destroy_method, + webhooks_on_channel_destroy_format=webhooks_on_channel_destroy_format, webhooks_on_channel_update_url=webhooks_on_channel_update_url, webhooks_on_channel_update_method=webhooks_on_channel_update_method, + webhooks_on_channel_update_format=webhooks_on_channel_update_format, webhooks_on_member_add_url=webhooks_on_member_add_url, webhooks_on_member_add_method=webhooks_on_member_add_method, + webhooks_on_member_add_format=webhooks_on_member_add_format, webhooks_on_member_remove_url=webhooks_on_member_remove_url, webhooks_on_member_remove_method=webhooks_on_member_remove_method, + webhooks_on_member_remove_format=webhooks_on_member_remove_format, webhooks_on_message_sent_url=webhooks_on_message_sent_url, webhooks_on_message_sent_method=webhooks_on_message_sent_method, + webhooks_on_message_sent_format=webhooks_on_message_sent_format, webhooks_on_message_updated_url=webhooks_on_message_updated_url, webhooks_on_message_updated_method=webhooks_on_message_updated_method, + webhooks_on_message_updated_format=webhooks_on_message_updated_format, webhooks_on_message_removed_url=webhooks_on_message_removed_url, webhooks_on_message_removed_method=webhooks_on_message_removed_method, + webhooks_on_message_removed_format=webhooks_on_message_removed_format, webhooks_on_channel_added_url=webhooks_on_channel_added_url, webhooks_on_channel_added_method=webhooks_on_channel_added_method, + webhooks_on_channel_added_format=webhooks_on_channel_added_format, webhooks_on_channel_destroyed_url=webhooks_on_channel_destroyed_url, webhooks_on_channel_destroyed_method=webhooks_on_channel_destroyed_method, + webhooks_on_channel_destroyed_format=webhooks_on_channel_destroyed_format, webhooks_on_channel_updated_url=webhooks_on_channel_updated_url, webhooks_on_channel_updated_method=webhooks_on_channel_updated_method, + webhooks_on_channel_updated_format=webhooks_on_channel_updated_format, webhooks_on_member_added_url=webhooks_on_member_added_url, webhooks_on_member_added_method=webhooks_on_member_added_method, + webhooks_on_member_added_format=webhooks_on_member_added_format, webhooks_on_member_removed_url=webhooks_on_member_removed_url, webhooks_on_member_removed_method=webhooks_on_member_removed_method, + webhooks_on_member_removed_format=webhooks_on_member_removed_format, limits_channel_members=limits_channel_members, limits_user_channels=limits_user_channels, ) @@ -912,7 +1106,6 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -1114,36 +1307,52 @@ def _update( webhook_filters: Union[List[str], object] = values.unset, webhooks_on_message_send_url: Union[str, object] = values.unset, webhooks_on_message_send_method: Union[str, object] = values.unset, + webhooks_on_message_send_format: Union[str, object] = values.unset, webhooks_on_message_update_url: Union[str, object] = values.unset, webhooks_on_message_update_method: Union[str, object] = values.unset, + webhooks_on_message_update_format: Union[str, object] = values.unset, webhooks_on_message_remove_url: Union[str, object] = values.unset, webhooks_on_message_remove_method: Union[str, object] = values.unset, + webhooks_on_message_remove_format: Union[str, object] = values.unset, webhooks_on_channel_add_url: Union[str, object] = values.unset, webhooks_on_channel_add_method: Union[str, object] = values.unset, + webhooks_on_channel_add_format: Union[str, object] = values.unset, webhooks_on_channel_destroy_url: Union[str, object] = values.unset, webhooks_on_channel_destroy_method: Union[str, object] = values.unset, + webhooks_on_channel_destroy_format: Union[str, object] = values.unset, webhooks_on_channel_update_url: Union[str, object] = values.unset, webhooks_on_channel_update_method: Union[str, object] = values.unset, + webhooks_on_channel_update_format: Union[str, object] = values.unset, webhooks_on_member_add_url: Union[str, object] = values.unset, webhooks_on_member_add_method: Union[str, object] = values.unset, + webhooks_on_member_add_format: Union[str, object] = values.unset, webhooks_on_member_remove_url: Union[str, object] = values.unset, webhooks_on_member_remove_method: Union[str, object] = values.unset, + webhooks_on_member_remove_format: Union[str, object] = values.unset, webhooks_on_message_sent_url: Union[str, object] = values.unset, webhooks_on_message_sent_method: Union[str, object] = values.unset, + webhooks_on_message_sent_format: Union[str, object] = values.unset, webhooks_on_message_updated_url: Union[str, object] = values.unset, webhooks_on_message_updated_method: Union[str, object] = values.unset, + webhooks_on_message_updated_format: Union[str, object] = values.unset, webhooks_on_message_removed_url: Union[str, object] = values.unset, webhooks_on_message_removed_method: Union[str, object] = values.unset, + webhooks_on_message_removed_format: Union[str, object] = values.unset, webhooks_on_channel_added_url: Union[str, object] = values.unset, webhooks_on_channel_added_method: Union[str, object] = values.unset, + webhooks_on_channel_added_format: Union[str, object] = values.unset, webhooks_on_channel_destroyed_url: Union[str, object] = values.unset, webhooks_on_channel_destroyed_method: Union[str, object] = values.unset, + webhooks_on_channel_destroyed_format: Union[str, object] = values.unset, webhooks_on_channel_updated_url: Union[str, object] = values.unset, webhooks_on_channel_updated_method: Union[str, object] = values.unset, + webhooks_on_channel_updated_format: Union[str, object] = values.unset, webhooks_on_member_added_url: Union[str, object] = values.unset, webhooks_on_member_added_method: Union[str, object] = values.unset, + webhooks_on_member_added_format: Union[str, object] = values.unset, webhooks_on_member_removed_url: Union[str, object] = values.unset, webhooks_on_member_removed_method: Union[str, object] = values.unset, + webhooks_on_member_removed_format: Union[str, object] = values.unset, limits_channel_members: Union[int, object] = values.unset, limits_user_channels: Union[int, object] = values.unset, ) -> tuple: @@ -1188,36 +1397,52 @@ def _update( "WebhookFilters": serialize.map(webhook_filters, lambda e: e), "Webhooks.OnMessageSend.Url": webhooks_on_message_send_url, "Webhooks.OnMessageSend.Method": webhooks_on_message_send_method, + "Webhooks.OnMessageSend.Format": webhooks_on_message_send_format, "Webhooks.OnMessageUpdate.Url": webhooks_on_message_update_url, "Webhooks.OnMessageUpdate.Method": webhooks_on_message_update_method, + "Webhooks.OnMessageUpdate.Format": webhooks_on_message_update_format, "Webhooks.OnMessageRemove.Url": webhooks_on_message_remove_url, "Webhooks.OnMessageRemove.Method": webhooks_on_message_remove_method, + "Webhooks.OnMessageRemove.Format": webhooks_on_message_remove_format, "Webhooks.OnChannelAdd.Url": webhooks_on_channel_add_url, "Webhooks.OnChannelAdd.Method": webhooks_on_channel_add_method, + "Webhooks.OnChannelAdd.Format": webhooks_on_channel_add_format, "Webhooks.OnChannelDestroy.Url": webhooks_on_channel_destroy_url, "Webhooks.OnChannelDestroy.Method": webhooks_on_channel_destroy_method, + "Webhooks.OnChannelDestroy.Format": webhooks_on_channel_destroy_format, "Webhooks.OnChannelUpdate.Url": webhooks_on_channel_update_url, "Webhooks.OnChannelUpdate.Method": webhooks_on_channel_update_method, + "Webhooks.OnChannelUpdate.Format": webhooks_on_channel_update_format, "Webhooks.OnMemberAdd.Url": webhooks_on_member_add_url, "Webhooks.OnMemberAdd.Method": webhooks_on_member_add_method, + "Webhooks.OnMemberAdd.Format": webhooks_on_member_add_format, "Webhooks.OnMemberRemove.Url": webhooks_on_member_remove_url, "Webhooks.OnMemberRemove.Method": webhooks_on_member_remove_method, + "Webhooks.OnMemberRemove.Format": webhooks_on_member_remove_format, "Webhooks.OnMessageSent.Url": webhooks_on_message_sent_url, "Webhooks.OnMessageSent.Method": webhooks_on_message_sent_method, + "Webhooks.OnMessageSent.Format": webhooks_on_message_sent_format, "Webhooks.OnMessageUpdated.Url": webhooks_on_message_updated_url, "Webhooks.OnMessageUpdated.Method": webhooks_on_message_updated_method, + "Webhooks.OnMessageUpdated.Format": webhooks_on_message_updated_format, "Webhooks.OnMessageRemoved.Url": webhooks_on_message_removed_url, "Webhooks.OnMessageRemoved.Method": webhooks_on_message_removed_method, + "Webhooks.OnMessageRemoved.Format": webhooks_on_message_removed_format, "Webhooks.OnChannelAdded.Url": webhooks_on_channel_added_url, "Webhooks.OnChannelAdded.Method": webhooks_on_channel_added_method, + "Webhooks.OnChannelAdded.Format": webhooks_on_channel_added_format, "Webhooks.OnChannelDestroyed.Url": webhooks_on_channel_destroyed_url, "Webhooks.OnChannelDestroyed.Method": webhooks_on_channel_destroyed_method, + "Webhooks.OnChannelDestroyed.Format": webhooks_on_channel_destroyed_format, "Webhooks.OnChannelUpdated.Url": webhooks_on_channel_updated_url, "Webhooks.OnChannelUpdated.Method": webhooks_on_channel_updated_method, + "Webhooks.OnChannelUpdated.Format": webhooks_on_channel_updated_format, "Webhooks.OnMemberAdded.Url": webhooks_on_member_added_url, "Webhooks.OnMemberAdded.Method": webhooks_on_member_added_method, + "Webhooks.OnMemberAdded.Format": webhooks_on_member_added_format, "Webhooks.OnMemberRemoved.Url": webhooks_on_member_removed_url, "Webhooks.OnMemberRemoved.Method": webhooks_on_member_removed_method, + "Webhooks.OnMemberRemoved.Format": webhooks_on_member_removed_format, "Limits.ChannelMembers": limits_channel_members, "Limits.UserChannels": limits_user_channels, } @@ -1256,36 +1481,52 @@ def update( webhook_filters: Union[List[str], object] = values.unset, webhooks_on_message_send_url: Union[str, object] = values.unset, webhooks_on_message_send_method: Union[str, object] = values.unset, + webhooks_on_message_send_format: Union[str, object] = values.unset, webhooks_on_message_update_url: Union[str, object] = values.unset, webhooks_on_message_update_method: Union[str, object] = values.unset, + webhooks_on_message_update_format: Union[str, object] = values.unset, webhooks_on_message_remove_url: Union[str, object] = values.unset, webhooks_on_message_remove_method: Union[str, object] = values.unset, + webhooks_on_message_remove_format: Union[str, object] = values.unset, webhooks_on_channel_add_url: Union[str, object] = values.unset, webhooks_on_channel_add_method: Union[str, object] = values.unset, + webhooks_on_channel_add_format: Union[str, object] = values.unset, webhooks_on_channel_destroy_url: Union[str, object] = values.unset, webhooks_on_channel_destroy_method: Union[str, object] = values.unset, + webhooks_on_channel_destroy_format: Union[str, object] = values.unset, webhooks_on_channel_update_url: Union[str, object] = values.unset, webhooks_on_channel_update_method: Union[str, object] = values.unset, + webhooks_on_channel_update_format: Union[str, object] = values.unset, webhooks_on_member_add_url: Union[str, object] = values.unset, webhooks_on_member_add_method: Union[str, object] = values.unset, + webhooks_on_member_add_format: Union[str, object] = values.unset, webhooks_on_member_remove_url: Union[str, object] = values.unset, webhooks_on_member_remove_method: Union[str, object] = values.unset, + webhooks_on_member_remove_format: Union[str, object] = values.unset, webhooks_on_message_sent_url: Union[str, object] = values.unset, webhooks_on_message_sent_method: Union[str, object] = values.unset, + webhooks_on_message_sent_format: Union[str, object] = values.unset, webhooks_on_message_updated_url: Union[str, object] = values.unset, webhooks_on_message_updated_method: Union[str, object] = values.unset, + webhooks_on_message_updated_format: Union[str, object] = values.unset, webhooks_on_message_removed_url: Union[str, object] = values.unset, webhooks_on_message_removed_method: Union[str, object] = values.unset, + webhooks_on_message_removed_format: Union[str, object] = values.unset, webhooks_on_channel_added_url: Union[str, object] = values.unset, webhooks_on_channel_added_method: Union[str, object] = values.unset, + webhooks_on_channel_added_format: Union[str, object] = values.unset, webhooks_on_channel_destroyed_url: Union[str, object] = values.unset, webhooks_on_channel_destroyed_method: Union[str, object] = values.unset, + webhooks_on_channel_destroyed_format: Union[str, object] = values.unset, webhooks_on_channel_updated_url: Union[str, object] = values.unset, webhooks_on_channel_updated_method: Union[str, object] = values.unset, + webhooks_on_channel_updated_format: Union[str, object] = values.unset, webhooks_on_member_added_url: Union[str, object] = values.unset, webhooks_on_member_added_method: Union[str, object] = values.unset, + webhooks_on_member_added_format: Union[str, object] = values.unset, webhooks_on_member_removed_url: Union[str, object] = values.unset, webhooks_on_member_removed_method: Union[str, object] = values.unset, + webhooks_on_member_removed_format: Union[str, object] = values.unset, limits_channel_members: Union[int, object] = values.unset, limits_user_channels: Union[int, object] = values.unset, ) -> ServiceInstance: @@ -1314,36 +1555,52 @@ def update( :param webhook_filters: The list of WebHook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. :param webhooks_on_message_send_url: The URL of the webhook to call in response to the `on_message_send` event using the `webhooks.on_message_send.method` HTTP method. :param webhooks_on_message_send_method: The HTTP method to use when calling the `webhooks.on_message_send.url`. + :param webhooks_on_message_send_format: :param webhooks_on_message_update_url: The URL of the webhook to call in response to the `on_message_update` event using the `webhooks.on_message_update.method` HTTP method. :param webhooks_on_message_update_method: The HTTP method to use when calling the `webhooks.on_message_update.url`. + :param webhooks_on_message_update_format: :param webhooks_on_message_remove_url: The URL of the webhook to call in response to the `on_message_remove` event using the `webhooks.on_message_remove.method` HTTP method. :param webhooks_on_message_remove_method: The HTTP method to use when calling the `webhooks.on_message_remove.url`. + :param webhooks_on_message_remove_format: :param webhooks_on_channel_add_url: The URL of the webhook to call in response to the `on_channel_add` event using the `webhooks.on_channel_add.method` HTTP method. :param webhooks_on_channel_add_method: The HTTP method to use when calling the `webhooks.on_channel_add.url`. + :param webhooks_on_channel_add_format: :param webhooks_on_channel_destroy_url: The URL of the webhook to call in response to the `on_channel_destroy` event using the `webhooks.on_channel_destroy.method` HTTP method. :param webhooks_on_channel_destroy_method: The HTTP method to use when calling the `webhooks.on_channel_destroy.url`. + :param webhooks_on_channel_destroy_format: :param webhooks_on_channel_update_url: The URL of the webhook to call in response to the `on_channel_update` event using the `webhooks.on_channel_update.method` HTTP method. :param webhooks_on_channel_update_method: The HTTP method to use when calling the `webhooks.on_channel_update.url`. + :param webhooks_on_channel_update_format: :param webhooks_on_member_add_url: The URL of the webhook to call in response to the `on_member_add` event using the `webhooks.on_member_add.method` HTTP method. :param webhooks_on_member_add_method: The HTTP method to use when calling the `webhooks.on_member_add.url`. + :param webhooks_on_member_add_format: :param webhooks_on_member_remove_url: The URL of the webhook to call in response to the `on_member_remove` event using the `webhooks.on_member_remove.method` HTTP method. :param webhooks_on_member_remove_method: The HTTP method to use when calling the `webhooks.on_member_remove.url`. + :param webhooks_on_member_remove_format: :param webhooks_on_message_sent_url: The URL of the webhook to call in response to the `on_message_sent` event using the `webhooks.on_message_sent.method` HTTP method. :param webhooks_on_message_sent_method: The URL of the webhook to call in response to the `on_message_sent` event`. + :param webhooks_on_message_sent_format: :param webhooks_on_message_updated_url: The URL of the webhook to call in response to the `on_message_updated` event using the `webhooks.on_message_updated.method` HTTP method. :param webhooks_on_message_updated_method: The HTTP method to use when calling the `webhooks.on_message_updated.url`. + :param webhooks_on_message_updated_format: :param webhooks_on_message_removed_url: The URL of the webhook to call in response to the `on_message_removed` event using the `webhooks.on_message_removed.method` HTTP method. :param webhooks_on_message_removed_method: The HTTP method to use when calling the `webhooks.on_message_removed.url`. + :param webhooks_on_message_removed_format: :param webhooks_on_channel_added_url: The URL of the webhook to call in response to the `on_channel_added` event using the `webhooks.on_channel_added.method` HTTP method. :param webhooks_on_channel_added_method: The URL of the webhook to call in response to the `on_channel_added` event`. + :param webhooks_on_channel_added_format: :param webhooks_on_channel_destroyed_url: The URL of the webhook to call in response to the `on_channel_added` event using the `webhooks.on_channel_destroyed.method` HTTP method. :param webhooks_on_channel_destroyed_method: The HTTP method to use when calling the `webhooks.on_channel_destroyed.url`. + :param webhooks_on_channel_destroyed_format: :param webhooks_on_channel_updated_url: The URL of the webhook to call in response to the `on_channel_updated` event using the `webhooks.on_channel_updated.method` HTTP method. :param webhooks_on_channel_updated_method: The HTTP method to use when calling the `webhooks.on_channel_updated.url`. + :param webhooks_on_channel_updated_format: :param webhooks_on_member_added_url: The URL of the webhook to call in response to the `on_channel_updated` event using the `webhooks.on_channel_updated.method` HTTP method. :param webhooks_on_member_added_method: The HTTP method to use when calling the `webhooks.on_channel_updated.url`. + :param webhooks_on_member_added_format: :param webhooks_on_member_removed_url: The URL of the webhook to call in response to the `on_member_removed` event using the `webhooks.on_member_removed.method` HTTP method. :param webhooks_on_member_removed_method: The HTTP method to use when calling the `webhooks.on_member_removed.url`. + :param webhooks_on_member_removed_format: :param limits_channel_members: The maximum number of Members that can be added to Channels within this Service. Can be up to 1,000. :param limits_user_channels: The maximum number of Channels Users can be a Member of within this Service. Can be up to 1,000. @@ -1372,36 +1629,52 @@ def update( webhook_filters=webhook_filters, webhooks_on_message_send_url=webhooks_on_message_send_url, webhooks_on_message_send_method=webhooks_on_message_send_method, + webhooks_on_message_send_format=webhooks_on_message_send_format, webhooks_on_message_update_url=webhooks_on_message_update_url, webhooks_on_message_update_method=webhooks_on_message_update_method, + webhooks_on_message_update_format=webhooks_on_message_update_format, webhooks_on_message_remove_url=webhooks_on_message_remove_url, webhooks_on_message_remove_method=webhooks_on_message_remove_method, + webhooks_on_message_remove_format=webhooks_on_message_remove_format, webhooks_on_channel_add_url=webhooks_on_channel_add_url, webhooks_on_channel_add_method=webhooks_on_channel_add_method, + webhooks_on_channel_add_format=webhooks_on_channel_add_format, webhooks_on_channel_destroy_url=webhooks_on_channel_destroy_url, webhooks_on_channel_destroy_method=webhooks_on_channel_destroy_method, + webhooks_on_channel_destroy_format=webhooks_on_channel_destroy_format, webhooks_on_channel_update_url=webhooks_on_channel_update_url, webhooks_on_channel_update_method=webhooks_on_channel_update_method, + webhooks_on_channel_update_format=webhooks_on_channel_update_format, webhooks_on_member_add_url=webhooks_on_member_add_url, webhooks_on_member_add_method=webhooks_on_member_add_method, + webhooks_on_member_add_format=webhooks_on_member_add_format, webhooks_on_member_remove_url=webhooks_on_member_remove_url, webhooks_on_member_remove_method=webhooks_on_member_remove_method, + webhooks_on_member_remove_format=webhooks_on_member_remove_format, webhooks_on_message_sent_url=webhooks_on_message_sent_url, webhooks_on_message_sent_method=webhooks_on_message_sent_method, + webhooks_on_message_sent_format=webhooks_on_message_sent_format, webhooks_on_message_updated_url=webhooks_on_message_updated_url, webhooks_on_message_updated_method=webhooks_on_message_updated_method, + webhooks_on_message_updated_format=webhooks_on_message_updated_format, webhooks_on_message_removed_url=webhooks_on_message_removed_url, webhooks_on_message_removed_method=webhooks_on_message_removed_method, + webhooks_on_message_removed_format=webhooks_on_message_removed_format, webhooks_on_channel_added_url=webhooks_on_channel_added_url, webhooks_on_channel_added_method=webhooks_on_channel_added_method, + webhooks_on_channel_added_format=webhooks_on_channel_added_format, webhooks_on_channel_destroyed_url=webhooks_on_channel_destroyed_url, webhooks_on_channel_destroyed_method=webhooks_on_channel_destroyed_method, + webhooks_on_channel_destroyed_format=webhooks_on_channel_destroyed_format, webhooks_on_channel_updated_url=webhooks_on_channel_updated_url, webhooks_on_channel_updated_method=webhooks_on_channel_updated_method, + webhooks_on_channel_updated_format=webhooks_on_channel_updated_format, webhooks_on_member_added_url=webhooks_on_member_added_url, webhooks_on_member_added_method=webhooks_on_member_added_method, + webhooks_on_member_added_format=webhooks_on_member_added_format, webhooks_on_member_removed_url=webhooks_on_member_removed_url, webhooks_on_member_removed_method=webhooks_on_member_removed_method, + webhooks_on_member_removed_format=webhooks_on_member_removed_format, limits_channel_members=limits_channel_members, limits_user_channels=limits_user_channels, ) @@ -1431,36 +1704,52 @@ def update_with_http_info( webhook_filters: Union[List[str], object] = values.unset, webhooks_on_message_send_url: Union[str, object] = values.unset, webhooks_on_message_send_method: Union[str, object] = values.unset, + webhooks_on_message_send_format: Union[str, object] = values.unset, webhooks_on_message_update_url: Union[str, object] = values.unset, webhooks_on_message_update_method: Union[str, object] = values.unset, + webhooks_on_message_update_format: Union[str, object] = values.unset, webhooks_on_message_remove_url: Union[str, object] = values.unset, webhooks_on_message_remove_method: Union[str, object] = values.unset, + webhooks_on_message_remove_format: Union[str, object] = values.unset, webhooks_on_channel_add_url: Union[str, object] = values.unset, webhooks_on_channel_add_method: Union[str, object] = values.unset, + webhooks_on_channel_add_format: Union[str, object] = values.unset, webhooks_on_channel_destroy_url: Union[str, object] = values.unset, webhooks_on_channel_destroy_method: Union[str, object] = values.unset, + webhooks_on_channel_destroy_format: Union[str, object] = values.unset, webhooks_on_channel_update_url: Union[str, object] = values.unset, webhooks_on_channel_update_method: Union[str, object] = values.unset, + webhooks_on_channel_update_format: Union[str, object] = values.unset, webhooks_on_member_add_url: Union[str, object] = values.unset, webhooks_on_member_add_method: Union[str, object] = values.unset, + webhooks_on_member_add_format: Union[str, object] = values.unset, webhooks_on_member_remove_url: Union[str, object] = values.unset, webhooks_on_member_remove_method: Union[str, object] = values.unset, + webhooks_on_member_remove_format: Union[str, object] = values.unset, webhooks_on_message_sent_url: Union[str, object] = values.unset, webhooks_on_message_sent_method: Union[str, object] = values.unset, + webhooks_on_message_sent_format: Union[str, object] = values.unset, webhooks_on_message_updated_url: Union[str, object] = values.unset, webhooks_on_message_updated_method: Union[str, object] = values.unset, + webhooks_on_message_updated_format: Union[str, object] = values.unset, webhooks_on_message_removed_url: Union[str, object] = values.unset, webhooks_on_message_removed_method: Union[str, object] = values.unset, + webhooks_on_message_removed_format: Union[str, object] = values.unset, webhooks_on_channel_added_url: Union[str, object] = values.unset, webhooks_on_channel_added_method: Union[str, object] = values.unset, + webhooks_on_channel_added_format: Union[str, object] = values.unset, webhooks_on_channel_destroyed_url: Union[str, object] = values.unset, webhooks_on_channel_destroyed_method: Union[str, object] = values.unset, + webhooks_on_channel_destroyed_format: Union[str, object] = values.unset, webhooks_on_channel_updated_url: Union[str, object] = values.unset, webhooks_on_channel_updated_method: Union[str, object] = values.unset, + webhooks_on_channel_updated_format: Union[str, object] = values.unset, webhooks_on_member_added_url: Union[str, object] = values.unset, webhooks_on_member_added_method: Union[str, object] = values.unset, + webhooks_on_member_added_format: Union[str, object] = values.unset, webhooks_on_member_removed_url: Union[str, object] = values.unset, webhooks_on_member_removed_method: Union[str, object] = values.unset, + webhooks_on_member_removed_format: Union[str, object] = values.unset, limits_channel_members: Union[int, object] = values.unset, limits_user_channels: Union[int, object] = values.unset, ) -> ApiResponse: @@ -1489,36 +1778,52 @@ def update_with_http_info( :param webhook_filters: The list of WebHook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. :param webhooks_on_message_send_url: The URL of the webhook to call in response to the `on_message_send` event using the `webhooks.on_message_send.method` HTTP method. :param webhooks_on_message_send_method: The HTTP method to use when calling the `webhooks.on_message_send.url`. + :param webhooks_on_message_send_format: :param webhooks_on_message_update_url: The URL of the webhook to call in response to the `on_message_update` event using the `webhooks.on_message_update.method` HTTP method. :param webhooks_on_message_update_method: The HTTP method to use when calling the `webhooks.on_message_update.url`. + :param webhooks_on_message_update_format: :param webhooks_on_message_remove_url: The URL of the webhook to call in response to the `on_message_remove` event using the `webhooks.on_message_remove.method` HTTP method. :param webhooks_on_message_remove_method: The HTTP method to use when calling the `webhooks.on_message_remove.url`. + :param webhooks_on_message_remove_format: :param webhooks_on_channel_add_url: The URL of the webhook to call in response to the `on_channel_add` event using the `webhooks.on_channel_add.method` HTTP method. :param webhooks_on_channel_add_method: The HTTP method to use when calling the `webhooks.on_channel_add.url`. + :param webhooks_on_channel_add_format: :param webhooks_on_channel_destroy_url: The URL of the webhook to call in response to the `on_channel_destroy` event using the `webhooks.on_channel_destroy.method` HTTP method. :param webhooks_on_channel_destroy_method: The HTTP method to use when calling the `webhooks.on_channel_destroy.url`. + :param webhooks_on_channel_destroy_format: :param webhooks_on_channel_update_url: The URL of the webhook to call in response to the `on_channel_update` event using the `webhooks.on_channel_update.method` HTTP method. :param webhooks_on_channel_update_method: The HTTP method to use when calling the `webhooks.on_channel_update.url`. + :param webhooks_on_channel_update_format: :param webhooks_on_member_add_url: The URL of the webhook to call in response to the `on_member_add` event using the `webhooks.on_member_add.method` HTTP method. :param webhooks_on_member_add_method: The HTTP method to use when calling the `webhooks.on_member_add.url`. + :param webhooks_on_member_add_format: :param webhooks_on_member_remove_url: The URL of the webhook to call in response to the `on_member_remove` event using the `webhooks.on_member_remove.method` HTTP method. :param webhooks_on_member_remove_method: The HTTP method to use when calling the `webhooks.on_member_remove.url`. + :param webhooks_on_member_remove_format: :param webhooks_on_message_sent_url: The URL of the webhook to call in response to the `on_message_sent` event using the `webhooks.on_message_sent.method` HTTP method. :param webhooks_on_message_sent_method: The URL of the webhook to call in response to the `on_message_sent` event`. + :param webhooks_on_message_sent_format: :param webhooks_on_message_updated_url: The URL of the webhook to call in response to the `on_message_updated` event using the `webhooks.on_message_updated.method` HTTP method. :param webhooks_on_message_updated_method: The HTTP method to use when calling the `webhooks.on_message_updated.url`. + :param webhooks_on_message_updated_format: :param webhooks_on_message_removed_url: The URL of the webhook to call in response to the `on_message_removed` event using the `webhooks.on_message_removed.method` HTTP method. :param webhooks_on_message_removed_method: The HTTP method to use when calling the `webhooks.on_message_removed.url`. + :param webhooks_on_message_removed_format: :param webhooks_on_channel_added_url: The URL of the webhook to call in response to the `on_channel_added` event using the `webhooks.on_channel_added.method` HTTP method. :param webhooks_on_channel_added_method: The URL of the webhook to call in response to the `on_channel_added` event`. + :param webhooks_on_channel_added_format: :param webhooks_on_channel_destroyed_url: The URL of the webhook to call in response to the `on_channel_added` event using the `webhooks.on_channel_destroyed.method` HTTP method. :param webhooks_on_channel_destroyed_method: The HTTP method to use when calling the `webhooks.on_channel_destroyed.url`. + :param webhooks_on_channel_destroyed_format: :param webhooks_on_channel_updated_url: The URL of the webhook to call in response to the `on_channel_updated` event using the `webhooks.on_channel_updated.method` HTTP method. :param webhooks_on_channel_updated_method: The HTTP method to use when calling the `webhooks.on_channel_updated.url`. + :param webhooks_on_channel_updated_format: :param webhooks_on_member_added_url: The URL of the webhook to call in response to the `on_channel_updated` event using the `webhooks.on_channel_updated.method` HTTP method. :param webhooks_on_member_added_method: The HTTP method to use when calling the `webhooks.on_channel_updated.url`. + :param webhooks_on_member_added_format: :param webhooks_on_member_removed_url: The URL of the webhook to call in response to the `on_member_removed` event using the `webhooks.on_member_removed.method` HTTP method. :param webhooks_on_member_removed_method: The HTTP method to use when calling the `webhooks.on_member_removed.url`. + :param webhooks_on_member_removed_format: :param limits_channel_members: The maximum number of Members that can be added to Channels within this Service. Can be up to 1,000. :param limits_user_channels: The maximum number of Channels Users can be a Member of within this Service. Can be up to 1,000. @@ -1547,36 +1852,52 @@ def update_with_http_info( webhook_filters=webhook_filters, webhooks_on_message_send_url=webhooks_on_message_send_url, webhooks_on_message_send_method=webhooks_on_message_send_method, + webhooks_on_message_send_format=webhooks_on_message_send_format, webhooks_on_message_update_url=webhooks_on_message_update_url, webhooks_on_message_update_method=webhooks_on_message_update_method, + webhooks_on_message_update_format=webhooks_on_message_update_format, webhooks_on_message_remove_url=webhooks_on_message_remove_url, webhooks_on_message_remove_method=webhooks_on_message_remove_method, + webhooks_on_message_remove_format=webhooks_on_message_remove_format, webhooks_on_channel_add_url=webhooks_on_channel_add_url, webhooks_on_channel_add_method=webhooks_on_channel_add_method, + webhooks_on_channel_add_format=webhooks_on_channel_add_format, webhooks_on_channel_destroy_url=webhooks_on_channel_destroy_url, webhooks_on_channel_destroy_method=webhooks_on_channel_destroy_method, + webhooks_on_channel_destroy_format=webhooks_on_channel_destroy_format, webhooks_on_channel_update_url=webhooks_on_channel_update_url, webhooks_on_channel_update_method=webhooks_on_channel_update_method, + webhooks_on_channel_update_format=webhooks_on_channel_update_format, webhooks_on_member_add_url=webhooks_on_member_add_url, webhooks_on_member_add_method=webhooks_on_member_add_method, + webhooks_on_member_add_format=webhooks_on_member_add_format, webhooks_on_member_remove_url=webhooks_on_member_remove_url, webhooks_on_member_remove_method=webhooks_on_member_remove_method, + webhooks_on_member_remove_format=webhooks_on_member_remove_format, webhooks_on_message_sent_url=webhooks_on_message_sent_url, webhooks_on_message_sent_method=webhooks_on_message_sent_method, + webhooks_on_message_sent_format=webhooks_on_message_sent_format, webhooks_on_message_updated_url=webhooks_on_message_updated_url, webhooks_on_message_updated_method=webhooks_on_message_updated_method, + webhooks_on_message_updated_format=webhooks_on_message_updated_format, webhooks_on_message_removed_url=webhooks_on_message_removed_url, webhooks_on_message_removed_method=webhooks_on_message_removed_method, + webhooks_on_message_removed_format=webhooks_on_message_removed_format, webhooks_on_channel_added_url=webhooks_on_channel_added_url, webhooks_on_channel_added_method=webhooks_on_channel_added_method, + webhooks_on_channel_added_format=webhooks_on_channel_added_format, webhooks_on_channel_destroyed_url=webhooks_on_channel_destroyed_url, webhooks_on_channel_destroyed_method=webhooks_on_channel_destroyed_method, + webhooks_on_channel_destroyed_format=webhooks_on_channel_destroyed_format, webhooks_on_channel_updated_url=webhooks_on_channel_updated_url, webhooks_on_channel_updated_method=webhooks_on_channel_updated_method, + webhooks_on_channel_updated_format=webhooks_on_channel_updated_format, webhooks_on_member_added_url=webhooks_on_member_added_url, webhooks_on_member_added_method=webhooks_on_member_added_method, + webhooks_on_member_added_format=webhooks_on_member_added_format, webhooks_on_member_removed_url=webhooks_on_member_removed_url, webhooks_on_member_removed_method=webhooks_on_member_removed_method, + webhooks_on_member_removed_format=webhooks_on_member_removed_format, limits_channel_members=limits_channel_members, limits_user_channels=limits_user_channels, ) @@ -1607,36 +1928,52 @@ async def _update_async( webhook_filters: Union[List[str], object] = values.unset, webhooks_on_message_send_url: Union[str, object] = values.unset, webhooks_on_message_send_method: Union[str, object] = values.unset, + webhooks_on_message_send_format: Union[str, object] = values.unset, webhooks_on_message_update_url: Union[str, object] = values.unset, webhooks_on_message_update_method: Union[str, object] = values.unset, + webhooks_on_message_update_format: Union[str, object] = values.unset, webhooks_on_message_remove_url: Union[str, object] = values.unset, webhooks_on_message_remove_method: Union[str, object] = values.unset, + webhooks_on_message_remove_format: Union[str, object] = values.unset, webhooks_on_channel_add_url: Union[str, object] = values.unset, webhooks_on_channel_add_method: Union[str, object] = values.unset, + webhooks_on_channel_add_format: Union[str, object] = values.unset, webhooks_on_channel_destroy_url: Union[str, object] = values.unset, webhooks_on_channel_destroy_method: Union[str, object] = values.unset, + webhooks_on_channel_destroy_format: Union[str, object] = values.unset, webhooks_on_channel_update_url: Union[str, object] = values.unset, webhooks_on_channel_update_method: Union[str, object] = values.unset, + webhooks_on_channel_update_format: Union[str, object] = values.unset, webhooks_on_member_add_url: Union[str, object] = values.unset, webhooks_on_member_add_method: Union[str, object] = values.unset, + webhooks_on_member_add_format: Union[str, object] = values.unset, webhooks_on_member_remove_url: Union[str, object] = values.unset, webhooks_on_member_remove_method: Union[str, object] = values.unset, + webhooks_on_member_remove_format: Union[str, object] = values.unset, webhooks_on_message_sent_url: Union[str, object] = values.unset, webhooks_on_message_sent_method: Union[str, object] = values.unset, + webhooks_on_message_sent_format: Union[str, object] = values.unset, webhooks_on_message_updated_url: Union[str, object] = values.unset, webhooks_on_message_updated_method: Union[str, object] = values.unset, + webhooks_on_message_updated_format: Union[str, object] = values.unset, webhooks_on_message_removed_url: Union[str, object] = values.unset, webhooks_on_message_removed_method: Union[str, object] = values.unset, + webhooks_on_message_removed_format: Union[str, object] = values.unset, webhooks_on_channel_added_url: Union[str, object] = values.unset, webhooks_on_channel_added_method: Union[str, object] = values.unset, + webhooks_on_channel_added_format: Union[str, object] = values.unset, webhooks_on_channel_destroyed_url: Union[str, object] = values.unset, webhooks_on_channel_destroyed_method: Union[str, object] = values.unset, + webhooks_on_channel_destroyed_format: Union[str, object] = values.unset, webhooks_on_channel_updated_url: Union[str, object] = values.unset, webhooks_on_channel_updated_method: Union[str, object] = values.unset, + webhooks_on_channel_updated_format: Union[str, object] = values.unset, webhooks_on_member_added_url: Union[str, object] = values.unset, webhooks_on_member_added_method: Union[str, object] = values.unset, + webhooks_on_member_added_format: Union[str, object] = values.unset, webhooks_on_member_removed_url: Union[str, object] = values.unset, webhooks_on_member_removed_method: Union[str, object] = values.unset, + webhooks_on_member_removed_format: Union[str, object] = values.unset, limits_channel_members: Union[int, object] = values.unset, limits_user_channels: Union[int, object] = values.unset, ) -> tuple: @@ -1681,36 +2018,52 @@ async def _update_async( "WebhookFilters": serialize.map(webhook_filters, lambda e: e), "Webhooks.OnMessageSend.Url": webhooks_on_message_send_url, "Webhooks.OnMessageSend.Method": webhooks_on_message_send_method, + "Webhooks.OnMessageSend.Format": webhooks_on_message_send_format, "Webhooks.OnMessageUpdate.Url": webhooks_on_message_update_url, "Webhooks.OnMessageUpdate.Method": webhooks_on_message_update_method, + "Webhooks.OnMessageUpdate.Format": webhooks_on_message_update_format, "Webhooks.OnMessageRemove.Url": webhooks_on_message_remove_url, "Webhooks.OnMessageRemove.Method": webhooks_on_message_remove_method, + "Webhooks.OnMessageRemove.Format": webhooks_on_message_remove_format, "Webhooks.OnChannelAdd.Url": webhooks_on_channel_add_url, "Webhooks.OnChannelAdd.Method": webhooks_on_channel_add_method, + "Webhooks.OnChannelAdd.Format": webhooks_on_channel_add_format, "Webhooks.OnChannelDestroy.Url": webhooks_on_channel_destroy_url, "Webhooks.OnChannelDestroy.Method": webhooks_on_channel_destroy_method, + "Webhooks.OnChannelDestroy.Format": webhooks_on_channel_destroy_format, "Webhooks.OnChannelUpdate.Url": webhooks_on_channel_update_url, "Webhooks.OnChannelUpdate.Method": webhooks_on_channel_update_method, + "Webhooks.OnChannelUpdate.Format": webhooks_on_channel_update_format, "Webhooks.OnMemberAdd.Url": webhooks_on_member_add_url, "Webhooks.OnMemberAdd.Method": webhooks_on_member_add_method, + "Webhooks.OnMemberAdd.Format": webhooks_on_member_add_format, "Webhooks.OnMemberRemove.Url": webhooks_on_member_remove_url, "Webhooks.OnMemberRemove.Method": webhooks_on_member_remove_method, + "Webhooks.OnMemberRemove.Format": webhooks_on_member_remove_format, "Webhooks.OnMessageSent.Url": webhooks_on_message_sent_url, "Webhooks.OnMessageSent.Method": webhooks_on_message_sent_method, + "Webhooks.OnMessageSent.Format": webhooks_on_message_sent_format, "Webhooks.OnMessageUpdated.Url": webhooks_on_message_updated_url, "Webhooks.OnMessageUpdated.Method": webhooks_on_message_updated_method, + "Webhooks.OnMessageUpdated.Format": webhooks_on_message_updated_format, "Webhooks.OnMessageRemoved.Url": webhooks_on_message_removed_url, "Webhooks.OnMessageRemoved.Method": webhooks_on_message_removed_method, + "Webhooks.OnMessageRemoved.Format": webhooks_on_message_removed_format, "Webhooks.OnChannelAdded.Url": webhooks_on_channel_added_url, "Webhooks.OnChannelAdded.Method": webhooks_on_channel_added_method, + "Webhooks.OnChannelAdded.Format": webhooks_on_channel_added_format, "Webhooks.OnChannelDestroyed.Url": webhooks_on_channel_destroyed_url, "Webhooks.OnChannelDestroyed.Method": webhooks_on_channel_destroyed_method, + "Webhooks.OnChannelDestroyed.Format": webhooks_on_channel_destroyed_format, "Webhooks.OnChannelUpdated.Url": webhooks_on_channel_updated_url, "Webhooks.OnChannelUpdated.Method": webhooks_on_channel_updated_method, + "Webhooks.OnChannelUpdated.Format": webhooks_on_channel_updated_format, "Webhooks.OnMemberAdded.Url": webhooks_on_member_added_url, "Webhooks.OnMemberAdded.Method": webhooks_on_member_added_method, + "Webhooks.OnMemberAdded.Format": webhooks_on_member_added_format, "Webhooks.OnMemberRemoved.Url": webhooks_on_member_removed_url, "Webhooks.OnMemberRemoved.Method": webhooks_on_member_removed_method, + "Webhooks.OnMemberRemoved.Format": webhooks_on_member_removed_format, "Limits.ChannelMembers": limits_channel_members, "Limits.UserChannels": limits_user_channels, } @@ -1749,36 +2102,52 @@ async def update_async( webhook_filters: Union[List[str], object] = values.unset, webhooks_on_message_send_url: Union[str, object] = values.unset, webhooks_on_message_send_method: Union[str, object] = values.unset, + webhooks_on_message_send_format: Union[str, object] = values.unset, webhooks_on_message_update_url: Union[str, object] = values.unset, webhooks_on_message_update_method: Union[str, object] = values.unset, + webhooks_on_message_update_format: Union[str, object] = values.unset, webhooks_on_message_remove_url: Union[str, object] = values.unset, webhooks_on_message_remove_method: Union[str, object] = values.unset, + webhooks_on_message_remove_format: Union[str, object] = values.unset, webhooks_on_channel_add_url: Union[str, object] = values.unset, webhooks_on_channel_add_method: Union[str, object] = values.unset, + webhooks_on_channel_add_format: Union[str, object] = values.unset, webhooks_on_channel_destroy_url: Union[str, object] = values.unset, webhooks_on_channel_destroy_method: Union[str, object] = values.unset, + webhooks_on_channel_destroy_format: Union[str, object] = values.unset, webhooks_on_channel_update_url: Union[str, object] = values.unset, webhooks_on_channel_update_method: Union[str, object] = values.unset, + webhooks_on_channel_update_format: Union[str, object] = values.unset, webhooks_on_member_add_url: Union[str, object] = values.unset, webhooks_on_member_add_method: Union[str, object] = values.unset, + webhooks_on_member_add_format: Union[str, object] = values.unset, webhooks_on_member_remove_url: Union[str, object] = values.unset, webhooks_on_member_remove_method: Union[str, object] = values.unset, + webhooks_on_member_remove_format: Union[str, object] = values.unset, webhooks_on_message_sent_url: Union[str, object] = values.unset, webhooks_on_message_sent_method: Union[str, object] = values.unset, + webhooks_on_message_sent_format: Union[str, object] = values.unset, webhooks_on_message_updated_url: Union[str, object] = values.unset, webhooks_on_message_updated_method: Union[str, object] = values.unset, + webhooks_on_message_updated_format: Union[str, object] = values.unset, webhooks_on_message_removed_url: Union[str, object] = values.unset, webhooks_on_message_removed_method: Union[str, object] = values.unset, + webhooks_on_message_removed_format: Union[str, object] = values.unset, webhooks_on_channel_added_url: Union[str, object] = values.unset, webhooks_on_channel_added_method: Union[str, object] = values.unset, + webhooks_on_channel_added_format: Union[str, object] = values.unset, webhooks_on_channel_destroyed_url: Union[str, object] = values.unset, webhooks_on_channel_destroyed_method: Union[str, object] = values.unset, + webhooks_on_channel_destroyed_format: Union[str, object] = values.unset, webhooks_on_channel_updated_url: Union[str, object] = values.unset, webhooks_on_channel_updated_method: Union[str, object] = values.unset, + webhooks_on_channel_updated_format: Union[str, object] = values.unset, webhooks_on_member_added_url: Union[str, object] = values.unset, webhooks_on_member_added_method: Union[str, object] = values.unset, + webhooks_on_member_added_format: Union[str, object] = values.unset, webhooks_on_member_removed_url: Union[str, object] = values.unset, webhooks_on_member_removed_method: Union[str, object] = values.unset, + webhooks_on_member_removed_format: Union[str, object] = values.unset, limits_channel_members: Union[int, object] = values.unset, limits_user_channels: Union[int, object] = values.unset, ) -> ServiceInstance: @@ -1807,36 +2176,52 @@ async def update_async( :param webhook_filters: The list of WebHook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. :param webhooks_on_message_send_url: The URL of the webhook to call in response to the `on_message_send` event using the `webhooks.on_message_send.method` HTTP method. :param webhooks_on_message_send_method: The HTTP method to use when calling the `webhooks.on_message_send.url`. + :param webhooks_on_message_send_format: :param webhooks_on_message_update_url: The URL of the webhook to call in response to the `on_message_update` event using the `webhooks.on_message_update.method` HTTP method. :param webhooks_on_message_update_method: The HTTP method to use when calling the `webhooks.on_message_update.url`. + :param webhooks_on_message_update_format: :param webhooks_on_message_remove_url: The URL of the webhook to call in response to the `on_message_remove` event using the `webhooks.on_message_remove.method` HTTP method. :param webhooks_on_message_remove_method: The HTTP method to use when calling the `webhooks.on_message_remove.url`. + :param webhooks_on_message_remove_format: :param webhooks_on_channel_add_url: The URL of the webhook to call in response to the `on_channel_add` event using the `webhooks.on_channel_add.method` HTTP method. :param webhooks_on_channel_add_method: The HTTP method to use when calling the `webhooks.on_channel_add.url`. + :param webhooks_on_channel_add_format: :param webhooks_on_channel_destroy_url: The URL of the webhook to call in response to the `on_channel_destroy` event using the `webhooks.on_channel_destroy.method` HTTP method. :param webhooks_on_channel_destroy_method: The HTTP method to use when calling the `webhooks.on_channel_destroy.url`. + :param webhooks_on_channel_destroy_format: :param webhooks_on_channel_update_url: The URL of the webhook to call in response to the `on_channel_update` event using the `webhooks.on_channel_update.method` HTTP method. :param webhooks_on_channel_update_method: The HTTP method to use when calling the `webhooks.on_channel_update.url`. + :param webhooks_on_channel_update_format: :param webhooks_on_member_add_url: The URL of the webhook to call in response to the `on_member_add` event using the `webhooks.on_member_add.method` HTTP method. :param webhooks_on_member_add_method: The HTTP method to use when calling the `webhooks.on_member_add.url`. + :param webhooks_on_member_add_format: :param webhooks_on_member_remove_url: The URL of the webhook to call in response to the `on_member_remove` event using the `webhooks.on_member_remove.method` HTTP method. :param webhooks_on_member_remove_method: The HTTP method to use when calling the `webhooks.on_member_remove.url`. + :param webhooks_on_member_remove_format: :param webhooks_on_message_sent_url: The URL of the webhook to call in response to the `on_message_sent` event using the `webhooks.on_message_sent.method` HTTP method. :param webhooks_on_message_sent_method: The URL of the webhook to call in response to the `on_message_sent` event`. + :param webhooks_on_message_sent_format: :param webhooks_on_message_updated_url: The URL of the webhook to call in response to the `on_message_updated` event using the `webhooks.on_message_updated.method` HTTP method. :param webhooks_on_message_updated_method: The HTTP method to use when calling the `webhooks.on_message_updated.url`. + :param webhooks_on_message_updated_format: :param webhooks_on_message_removed_url: The URL of the webhook to call in response to the `on_message_removed` event using the `webhooks.on_message_removed.method` HTTP method. :param webhooks_on_message_removed_method: The HTTP method to use when calling the `webhooks.on_message_removed.url`. + :param webhooks_on_message_removed_format: :param webhooks_on_channel_added_url: The URL of the webhook to call in response to the `on_channel_added` event using the `webhooks.on_channel_added.method` HTTP method. :param webhooks_on_channel_added_method: The URL of the webhook to call in response to the `on_channel_added` event`. + :param webhooks_on_channel_added_format: :param webhooks_on_channel_destroyed_url: The URL of the webhook to call in response to the `on_channel_added` event using the `webhooks.on_channel_destroyed.method` HTTP method. :param webhooks_on_channel_destroyed_method: The HTTP method to use when calling the `webhooks.on_channel_destroyed.url`. + :param webhooks_on_channel_destroyed_format: :param webhooks_on_channel_updated_url: The URL of the webhook to call in response to the `on_channel_updated` event using the `webhooks.on_channel_updated.method` HTTP method. :param webhooks_on_channel_updated_method: The HTTP method to use when calling the `webhooks.on_channel_updated.url`. + :param webhooks_on_channel_updated_format: :param webhooks_on_member_added_url: The URL of the webhook to call in response to the `on_channel_updated` event using the `webhooks.on_channel_updated.method` HTTP method. :param webhooks_on_member_added_method: The HTTP method to use when calling the `webhooks.on_channel_updated.url`. + :param webhooks_on_member_added_format: :param webhooks_on_member_removed_url: The URL of the webhook to call in response to the `on_member_removed` event using the `webhooks.on_member_removed.method` HTTP method. :param webhooks_on_member_removed_method: The HTTP method to use when calling the `webhooks.on_member_removed.url`. + :param webhooks_on_member_removed_format: :param limits_channel_members: The maximum number of Members that can be added to Channels within this Service. Can be up to 1,000. :param limits_user_channels: The maximum number of Channels Users can be a Member of within this Service. Can be up to 1,000. @@ -1865,36 +2250,52 @@ async def update_async( webhook_filters=webhook_filters, webhooks_on_message_send_url=webhooks_on_message_send_url, webhooks_on_message_send_method=webhooks_on_message_send_method, + webhooks_on_message_send_format=webhooks_on_message_send_format, webhooks_on_message_update_url=webhooks_on_message_update_url, webhooks_on_message_update_method=webhooks_on_message_update_method, + webhooks_on_message_update_format=webhooks_on_message_update_format, webhooks_on_message_remove_url=webhooks_on_message_remove_url, webhooks_on_message_remove_method=webhooks_on_message_remove_method, + webhooks_on_message_remove_format=webhooks_on_message_remove_format, webhooks_on_channel_add_url=webhooks_on_channel_add_url, webhooks_on_channel_add_method=webhooks_on_channel_add_method, + webhooks_on_channel_add_format=webhooks_on_channel_add_format, webhooks_on_channel_destroy_url=webhooks_on_channel_destroy_url, webhooks_on_channel_destroy_method=webhooks_on_channel_destroy_method, + webhooks_on_channel_destroy_format=webhooks_on_channel_destroy_format, webhooks_on_channel_update_url=webhooks_on_channel_update_url, webhooks_on_channel_update_method=webhooks_on_channel_update_method, + webhooks_on_channel_update_format=webhooks_on_channel_update_format, webhooks_on_member_add_url=webhooks_on_member_add_url, webhooks_on_member_add_method=webhooks_on_member_add_method, + webhooks_on_member_add_format=webhooks_on_member_add_format, webhooks_on_member_remove_url=webhooks_on_member_remove_url, webhooks_on_member_remove_method=webhooks_on_member_remove_method, + webhooks_on_member_remove_format=webhooks_on_member_remove_format, webhooks_on_message_sent_url=webhooks_on_message_sent_url, webhooks_on_message_sent_method=webhooks_on_message_sent_method, + webhooks_on_message_sent_format=webhooks_on_message_sent_format, webhooks_on_message_updated_url=webhooks_on_message_updated_url, webhooks_on_message_updated_method=webhooks_on_message_updated_method, + webhooks_on_message_updated_format=webhooks_on_message_updated_format, webhooks_on_message_removed_url=webhooks_on_message_removed_url, webhooks_on_message_removed_method=webhooks_on_message_removed_method, + webhooks_on_message_removed_format=webhooks_on_message_removed_format, webhooks_on_channel_added_url=webhooks_on_channel_added_url, webhooks_on_channel_added_method=webhooks_on_channel_added_method, + webhooks_on_channel_added_format=webhooks_on_channel_added_format, webhooks_on_channel_destroyed_url=webhooks_on_channel_destroyed_url, webhooks_on_channel_destroyed_method=webhooks_on_channel_destroyed_method, + webhooks_on_channel_destroyed_format=webhooks_on_channel_destroyed_format, webhooks_on_channel_updated_url=webhooks_on_channel_updated_url, webhooks_on_channel_updated_method=webhooks_on_channel_updated_method, + webhooks_on_channel_updated_format=webhooks_on_channel_updated_format, webhooks_on_member_added_url=webhooks_on_member_added_url, webhooks_on_member_added_method=webhooks_on_member_added_method, + webhooks_on_member_added_format=webhooks_on_member_added_format, webhooks_on_member_removed_url=webhooks_on_member_removed_url, webhooks_on_member_removed_method=webhooks_on_member_removed_method, + webhooks_on_member_removed_format=webhooks_on_member_removed_format, limits_channel_members=limits_channel_members, limits_user_channels=limits_user_channels, ) @@ -1924,36 +2325,52 @@ async def update_with_http_info_async( webhook_filters: Union[List[str], object] = values.unset, webhooks_on_message_send_url: Union[str, object] = values.unset, webhooks_on_message_send_method: Union[str, object] = values.unset, + webhooks_on_message_send_format: Union[str, object] = values.unset, webhooks_on_message_update_url: Union[str, object] = values.unset, webhooks_on_message_update_method: Union[str, object] = values.unset, + webhooks_on_message_update_format: Union[str, object] = values.unset, webhooks_on_message_remove_url: Union[str, object] = values.unset, webhooks_on_message_remove_method: Union[str, object] = values.unset, + webhooks_on_message_remove_format: Union[str, object] = values.unset, webhooks_on_channel_add_url: Union[str, object] = values.unset, webhooks_on_channel_add_method: Union[str, object] = values.unset, + webhooks_on_channel_add_format: Union[str, object] = values.unset, webhooks_on_channel_destroy_url: Union[str, object] = values.unset, webhooks_on_channel_destroy_method: Union[str, object] = values.unset, + webhooks_on_channel_destroy_format: Union[str, object] = values.unset, webhooks_on_channel_update_url: Union[str, object] = values.unset, webhooks_on_channel_update_method: Union[str, object] = values.unset, + webhooks_on_channel_update_format: Union[str, object] = values.unset, webhooks_on_member_add_url: Union[str, object] = values.unset, webhooks_on_member_add_method: Union[str, object] = values.unset, + webhooks_on_member_add_format: Union[str, object] = values.unset, webhooks_on_member_remove_url: Union[str, object] = values.unset, webhooks_on_member_remove_method: Union[str, object] = values.unset, + webhooks_on_member_remove_format: Union[str, object] = values.unset, webhooks_on_message_sent_url: Union[str, object] = values.unset, webhooks_on_message_sent_method: Union[str, object] = values.unset, + webhooks_on_message_sent_format: Union[str, object] = values.unset, webhooks_on_message_updated_url: Union[str, object] = values.unset, webhooks_on_message_updated_method: Union[str, object] = values.unset, + webhooks_on_message_updated_format: Union[str, object] = values.unset, webhooks_on_message_removed_url: Union[str, object] = values.unset, webhooks_on_message_removed_method: Union[str, object] = values.unset, + webhooks_on_message_removed_format: Union[str, object] = values.unset, webhooks_on_channel_added_url: Union[str, object] = values.unset, webhooks_on_channel_added_method: Union[str, object] = values.unset, + webhooks_on_channel_added_format: Union[str, object] = values.unset, webhooks_on_channel_destroyed_url: Union[str, object] = values.unset, webhooks_on_channel_destroyed_method: Union[str, object] = values.unset, + webhooks_on_channel_destroyed_format: Union[str, object] = values.unset, webhooks_on_channel_updated_url: Union[str, object] = values.unset, webhooks_on_channel_updated_method: Union[str, object] = values.unset, + webhooks_on_channel_updated_format: Union[str, object] = values.unset, webhooks_on_member_added_url: Union[str, object] = values.unset, webhooks_on_member_added_method: Union[str, object] = values.unset, + webhooks_on_member_added_format: Union[str, object] = values.unset, webhooks_on_member_removed_url: Union[str, object] = values.unset, webhooks_on_member_removed_method: Union[str, object] = values.unset, + webhooks_on_member_removed_format: Union[str, object] = values.unset, limits_channel_members: Union[int, object] = values.unset, limits_user_channels: Union[int, object] = values.unset, ) -> ApiResponse: @@ -1982,36 +2399,52 @@ async def update_with_http_info_async( :param webhook_filters: The list of WebHook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. :param webhooks_on_message_send_url: The URL of the webhook to call in response to the `on_message_send` event using the `webhooks.on_message_send.method` HTTP method. :param webhooks_on_message_send_method: The HTTP method to use when calling the `webhooks.on_message_send.url`. + :param webhooks_on_message_send_format: :param webhooks_on_message_update_url: The URL of the webhook to call in response to the `on_message_update` event using the `webhooks.on_message_update.method` HTTP method. :param webhooks_on_message_update_method: The HTTP method to use when calling the `webhooks.on_message_update.url`. + :param webhooks_on_message_update_format: :param webhooks_on_message_remove_url: The URL of the webhook to call in response to the `on_message_remove` event using the `webhooks.on_message_remove.method` HTTP method. :param webhooks_on_message_remove_method: The HTTP method to use when calling the `webhooks.on_message_remove.url`. + :param webhooks_on_message_remove_format: :param webhooks_on_channel_add_url: The URL of the webhook to call in response to the `on_channel_add` event using the `webhooks.on_channel_add.method` HTTP method. :param webhooks_on_channel_add_method: The HTTP method to use when calling the `webhooks.on_channel_add.url`. + :param webhooks_on_channel_add_format: :param webhooks_on_channel_destroy_url: The URL of the webhook to call in response to the `on_channel_destroy` event using the `webhooks.on_channel_destroy.method` HTTP method. :param webhooks_on_channel_destroy_method: The HTTP method to use when calling the `webhooks.on_channel_destroy.url`. + :param webhooks_on_channel_destroy_format: :param webhooks_on_channel_update_url: The URL of the webhook to call in response to the `on_channel_update` event using the `webhooks.on_channel_update.method` HTTP method. :param webhooks_on_channel_update_method: The HTTP method to use when calling the `webhooks.on_channel_update.url`. + :param webhooks_on_channel_update_format: :param webhooks_on_member_add_url: The URL of the webhook to call in response to the `on_member_add` event using the `webhooks.on_member_add.method` HTTP method. :param webhooks_on_member_add_method: The HTTP method to use when calling the `webhooks.on_member_add.url`. + :param webhooks_on_member_add_format: :param webhooks_on_member_remove_url: The URL of the webhook to call in response to the `on_member_remove` event using the `webhooks.on_member_remove.method` HTTP method. :param webhooks_on_member_remove_method: The HTTP method to use when calling the `webhooks.on_member_remove.url`. + :param webhooks_on_member_remove_format: :param webhooks_on_message_sent_url: The URL of the webhook to call in response to the `on_message_sent` event using the `webhooks.on_message_sent.method` HTTP method. :param webhooks_on_message_sent_method: The URL of the webhook to call in response to the `on_message_sent` event`. + :param webhooks_on_message_sent_format: :param webhooks_on_message_updated_url: The URL of the webhook to call in response to the `on_message_updated` event using the `webhooks.on_message_updated.method` HTTP method. :param webhooks_on_message_updated_method: The HTTP method to use when calling the `webhooks.on_message_updated.url`. + :param webhooks_on_message_updated_format: :param webhooks_on_message_removed_url: The URL of the webhook to call in response to the `on_message_removed` event using the `webhooks.on_message_removed.method` HTTP method. :param webhooks_on_message_removed_method: The HTTP method to use when calling the `webhooks.on_message_removed.url`. + :param webhooks_on_message_removed_format: :param webhooks_on_channel_added_url: The URL of the webhook to call in response to the `on_channel_added` event using the `webhooks.on_channel_added.method` HTTP method. :param webhooks_on_channel_added_method: The URL of the webhook to call in response to the `on_channel_added` event`. + :param webhooks_on_channel_added_format: :param webhooks_on_channel_destroyed_url: The URL of the webhook to call in response to the `on_channel_added` event using the `webhooks.on_channel_destroyed.method` HTTP method. :param webhooks_on_channel_destroyed_method: The HTTP method to use when calling the `webhooks.on_channel_destroyed.url`. + :param webhooks_on_channel_destroyed_format: :param webhooks_on_channel_updated_url: The URL of the webhook to call in response to the `on_channel_updated` event using the `webhooks.on_channel_updated.method` HTTP method. :param webhooks_on_channel_updated_method: The HTTP method to use when calling the `webhooks.on_channel_updated.url`. + :param webhooks_on_channel_updated_format: :param webhooks_on_member_added_url: The URL of the webhook to call in response to the `on_channel_updated` event using the `webhooks.on_channel_updated.method` HTTP method. :param webhooks_on_member_added_method: The HTTP method to use when calling the `webhooks.on_channel_updated.url`. + :param webhooks_on_member_added_format: :param webhooks_on_member_removed_url: The URL of the webhook to call in response to the `on_member_removed` event using the `webhooks.on_member_removed.method` HTTP method. :param webhooks_on_member_removed_method: The HTTP method to use when calling the `webhooks.on_member_removed.url`. + :param webhooks_on_member_removed_format: :param limits_channel_members: The maximum number of Members that can be added to Channels within this Service. Can be up to 1,000. :param limits_user_channels: The maximum number of Channels Users can be a Member of within this Service. Can be up to 1,000. @@ -2040,36 +2473,52 @@ async def update_with_http_info_async( webhook_filters=webhook_filters, webhooks_on_message_send_url=webhooks_on_message_send_url, webhooks_on_message_send_method=webhooks_on_message_send_method, + webhooks_on_message_send_format=webhooks_on_message_send_format, webhooks_on_message_update_url=webhooks_on_message_update_url, webhooks_on_message_update_method=webhooks_on_message_update_method, + webhooks_on_message_update_format=webhooks_on_message_update_format, webhooks_on_message_remove_url=webhooks_on_message_remove_url, webhooks_on_message_remove_method=webhooks_on_message_remove_method, + webhooks_on_message_remove_format=webhooks_on_message_remove_format, webhooks_on_channel_add_url=webhooks_on_channel_add_url, webhooks_on_channel_add_method=webhooks_on_channel_add_method, + webhooks_on_channel_add_format=webhooks_on_channel_add_format, webhooks_on_channel_destroy_url=webhooks_on_channel_destroy_url, webhooks_on_channel_destroy_method=webhooks_on_channel_destroy_method, + webhooks_on_channel_destroy_format=webhooks_on_channel_destroy_format, webhooks_on_channel_update_url=webhooks_on_channel_update_url, webhooks_on_channel_update_method=webhooks_on_channel_update_method, + webhooks_on_channel_update_format=webhooks_on_channel_update_format, webhooks_on_member_add_url=webhooks_on_member_add_url, webhooks_on_member_add_method=webhooks_on_member_add_method, + webhooks_on_member_add_format=webhooks_on_member_add_format, webhooks_on_member_remove_url=webhooks_on_member_remove_url, webhooks_on_member_remove_method=webhooks_on_member_remove_method, + webhooks_on_member_remove_format=webhooks_on_member_remove_format, webhooks_on_message_sent_url=webhooks_on_message_sent_url, webhooks_on_message_sent_method=webhooks_on_message_sent_method, + webhooks_on_message_sent_format=webhooks_on_message_sent_format, webhooks_on_message_updated_url=webhooks_on_message_updated_url, webhooks_on_message_updated_method=webhooks_on_message_updated_method, + webhooks_on_message_updated_format=webhooks_on_message_updated_format, webhooks_on_message_removed_url=webhooks_on_message_removed_url, webhooks_on_message_removed_method=webhooks_on_message_removed_method, + webhooks_on_message_removed_format=webhooks_on_message_removed_format, webhooks_on_channel_added_url=webhooks_on_channel_added_url, webhooks_on_channel_added_method=webhooks_on_channel_added_method, + webhooks_on_channel_added_format=webhooks_on_channel_added_format, webhooks_on_channel_destroyed_url=webhooks_on_channel_destroyed_url, webhooks_on_channel_destroyed_method=webhooks_on_channel_destroyed_method, + webhooks_on_channel_destroyed_format=webhooks_on_channel_destroyed_format, webhooks_on_channel_updated_url=webhooks_on_channel_updated_url, webhooks_on_channel_updated_method=webhooks_on_channel_updated_method, + webhooks_on_channel_updated_format=webhooks_on_channel_updated_format, webhooks_on_member_added_url=webhooks_on_member_added_url, webhooks_on_member_added_method=webhooks_on_member_added_method, + webhooks_on_member_added_format=webhooks_on_member_added_format, webhooks_on_member_removed_url=webhooks_on_member_removed_url, webhooks_on_member_removed_method=webhooks_on_member_removed_method, + webhooks_on_member_removed_format=webhooks_on_member_removed_format, limits_channel_members=limits_channel_members, limits_user_channels=limits_user_channels, ) @@ -2123,7 +2572,6 @@ def __repr__(self) -> str: class ServicePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -2142,7 +2590,6 @@ def __repr__(self) -> str: class ServiceList(ListResource): - def __init__(self, version: Version): """ Initialize the ServiceList @@ -2579,10 +3026,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ServicePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/chat/v1/service/channel/__init__.py b/twilio/rest/chat/v1/service/channel/__init__.py index bd0c1f0ff..e7fde67f6 100644 --- a/twilio/rest/chat/v1/service/channel/__init__.py +++ b/twilio/rest/chat/v1/service/channel/__init__.py @@ -12,6 +12,7 @@ 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 @@ -27,7 +28,6 @@ class ChannelInstance(InstanceResource): - class ChannelType(object): PUBLIC = "public" PRIVATE = "private" @@ -291,7 +291,6 @@ def __repr__(self) -> str: class ChannelContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the ChannelContext @@ -687,7 +686,6 @@ def __repr__(self) -> str: class ChannelPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ChannelInstance: """ Build an instance of ChannelInstance @@ -708,7 +706,6 @@ def __repr__(self) -> str: class ChannelList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the ChannelList @@ -1264,10 +1261,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ChannelPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/chat/v1/service/channel/invite.py b/twilio/rest/chat/v1/service/channel/invite.py index 9cdcac6ab..4af4bc61b 100644 --- a/twilio/rest/chat/v1/service/channel/invite.py +++ b/twilio/rest/chat/v1/service/channel/invite.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class InviteInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Invite resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Invite resource. @@ -169,7 +171,6 @@ def __repr__(self) -> str: class InviteContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the InviteContext @@ -370,7 +371,6 @@ def __repr__(self) -> str: class InvitePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> InviteInstance: """ Build an instance of InviteInstance @@ -394,7 +394,6 @@ def __repr__(self) -> str: class InviteList(ListResource): - def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the InviteList @@ -914,10 +913,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = InvitePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/chat/v1/service/channel/member.py b/twilio/rest/chat/v1/service/channel/member.py index 680ca1f18..30c3a2bc0 100644 --- a/twilio/rest/chat/v1/service/channel/member.py +++ b/twilio/rest/chat/v1/service/channel/member.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class MemberInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Member resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Member resource. @@ -63,9 +65,9 @@ def __init__( self.last_consumed_message_index: Optional[int] = deserialize.integer( payload.get("last_consumed_message_index") ) - self.last_consumption_timestamp: Optional[datetime] = ( - deserialize.iso8601_datetime(payload.get("last_consumption_timestamp")) - ) + self.last_consumption_timestamp: Optional[ + datetime + ] = deserialize.iso8601_datetime(payload.get("last_consumption_timestamp")) self.url: Optional[str] = payload.get("url") self._solution = { @@ -247,7 +249,6 @@ def __repr__(self) -> str: class MemberContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the MemberContext @@ -602,7 +603,6 @@ def __repr__(self) -> str: class MemberPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> MemberInstance: """ Build an instance of MemberInstance @@ -626,7 +626,6 @@ def __repr__(self) -> str: class MemberList(ListResource): - def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the MemberList @@ -1146,10 +1145,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = MemberPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/chat/v1/service/channel/message.py b/twilio/rest/chat/v1/service/channel/message.py index 97542206a..6f239d050 100644 --- a/twilio/rest/chat/v1/service/channel/message.py +++ b/twilio/rest/chat/v1/service/channel/message.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class MessageInstance(InstanceResource): - class OrderType(object): ASC = "asc" DESC = "desc" @@ -252,7 +252,6 @@ def __repr__(self) -> str: class MessageContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the MessageContext @@ -601,7 +600,6 @@ def __repr__(self) -> str: class MessagePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> MessageInstance: """ Build an instance of MessageInstance @@ -625,7 +623,6 @@ def __repr__(self) -> str: class MessageList(ListResource): - def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the MessageList @@ -1171,10 +1168,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = MessagePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/chat/v1/service/role.py b/twilio/rest/chat/v1/service/role.py index cbe2c65cd..dad31b6b7 100644 --- a/twilio/rest/chat/v1/service/role.py +++ b/twilio/rest/chat/v1/service/role.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class RoleInstance(InstanceResource): - class RoleType(object): CHANNEL = "channel" DEPLOYMENT = "deployment" @@ -217,7 +217,6 @@ def __repr__(self) -> str: class RoleContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the RoleContext @@ -520,7 +519,6 @@ def __repr__(self) -> str: class RolePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> RoleInstance: """ Build an instance of RoleInstance @@ -541,7 +539,6 @@ def __repr__(self) -> str: class RoleList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the RoleList @@ -1021,10 +1018,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = RolePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/chat/v1/service/user/__init__.py b/twilio/rest/chat/v1/service/user/__init__.py index cd5a49373..c840dd640 100644 --- a/twilio/rest/chat/v1/service/user/__init__.py +++ b/twilio/rest/chat/v1/service/user/__init__.py @@ -12,6 +12,7 @@ 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 @@ -25,6 +26,7 @@ class UserInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the User resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the User resource. @@ -268,7 +270,6 @@ def __repr__(self) -> str: class UserContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the UserContext @@ -636,7 +637,6 @@ def __repr__(self) -> str: class UserPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> UserInstance: """ Build an instance of UserInstance @@ -657,7 +657,6 @@ def __repr__(self) -> str: class UserList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the UserList @@ -1179,10 +1178,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = UserPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/chat/v1/service/user/user_channel.py b/twilio/rest/chat/v1/service/user/user_channel.py index 83cff0ee6..a41964440 100644 --- a/twilio/rest/chat/v1/service/user/user_channel.py +++ b/twilio/rest/chat/v1/service/user/user_channel.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, values from twilio.base.api_response import ApiResponse @@ -23,7 +24,6 @@ class UserChannelInstance(InstanceResource): - class ChannelStatus(object): JOINED = "joined" INVITED = "invited" @@ -76,7 +76,6 @@ def __repr__(self) -> str: class UserChannelPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> UserChannelInstance: """ Build an instance of UserChannelInstance @@ -100,7 +99,6 @@ def __repr__(self) -> str: class UserChannelList(ListResource): - def __init__(self, version: Version, service_sid: str, user_sid: str): """ Initialize the UserChannelList @@ -452,10 +450,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = UserChannelPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/chat/v2/__init__.py b/twilio/rest/chat/v2/__init__.py index e949532d5..c433e8543 100644 --- a/twilio/rest/chat/v2/__init__.py +++ b/twilio/rest/chat/v2/__init__.py @@ -20,7 +20,6 @@ class V2(Version): - def __init__(self, domain: Domain): """ Initialize the V2 version of Chat diff --git a/twilio/rest/chat/v2/credential.py b/twilio/rest/chat/v2/credential.py index 886ecc625..5df756382 100644 --- a/twilio/rest/chat/v2/credential.py +++ b/twilio/rest/chat/v2/credential.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class CredentialInstance(InstanceResource): - class PushService(object): GCM = "gcm" APN = "apn" @@ -282,7 +282,6 @@ def __repr__(self) -> str: class CredentialContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the CredentialContext @@ -665,7 +664,6 @@ def __repr__(self) -> str: class CredentialPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> CredentialInstance: """ Build an instance of CredentialInstance @@ -684,7 +682,6 @@ def __repr__(self) -> str: class CredentialList(ListResource): - def __init__(self, version: Version): """ Initialize the CredentialList @@ -1241,10 +1238,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CredentialPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/chat/v2/service/__init__.py b/twilio/rest/chat/v2/service/__init__.py index b20b9962c..873c97c9f 100644 --- a/twilio/rest/chat/v2/service/__init__.py +++ b/twilio/rest/chat/v2/service/__init__.py @@ -12,6 +12,7 @@ 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 @@ -28,6 +29,7 @@ class ServiceInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Service resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. @@ -660,7 +662,6 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -1536,7 +1537,6 @@ def __repr__(self) -> str: class ServicePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -1555,7 +1555,6 @@ def __repr__(self) -> str: class ServiceList(ListResource): - def __init__(self, version: Version): """ Initialize the ServiceList @@ -1992,10 +1991,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ServicePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/chat/v2/service/binding.py b/twilio/rest/chat/v2/service/binding.py index 0642813af..ea03d4dcf 100644 --- a/twilio/rest/chat/v2/service/binding.py +++ b/twilio/rest/chat/v2/service/binding.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class BindingInstance(InstanceResource): - class BindingType(object): GCM = "gcm" APN = "apn" @@ -178,7 +178,6 @@ def __repr__(self) -> str: class BindingContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the BindingContext @@ -369,7 +368,6 @@ def __repr__(self) -> str: class BindingPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> BindingInstance: """ Build an instance of BindingInstance @@ -390,7 +388,6 @@ def __repr__(self) -> str: class BindingList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the BindingList @@ -808,10 +805,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = BindingPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/chat/v2/service/channel/__init__.py b/twilio/rest/chat/v2/service/channel/__init__.py index 5b931b398..b21e81c68 100644 --- a/twilio/rest/chat/v2/service/channel/__init__.py +++ b/twilio/rest/chat/v2/service/channel/__init__.py @@ -12,6 +12,7 @@ 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 @@ -28,7 +29,6 @@ class ChannelInstance(InstanceResource): - class ChannelType(object): PUBLIC = "public" PRIVATE = "private" @@ -391,7 +391,6 @@ def __repr__(self) -> str: class ChannelContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the ChannelContext @@ -951,7 +950,6 @@ def __repr__(self) -> str: class ChannelPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ChannelInstance: """ Build an instance of ChannelInstance @@ -972,7 +970,6 @@ def __repr__(self) -> str: class ChannelList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the ChannelList @@ -1612,10 +1609,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ChannelPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/chat/v2/service/channel/invite.py b/twilio/rest/chat/v2/service/channel/invite.py index 502292a5d..dd8073e54 100644 --- a/twilio/rest/chat/v2/service/channel/invite.py +++ b/twilio/rest/chat/v2/service/channel/invite.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class InviteInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Invite resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Invite resource. @@ -169,7 +171,6 @@ def __repr__(self) -> str: class InviteContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the InviteContext @@ -370,7 +371,6 @@ def __repr__(self) -> str: class InvitePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> InviteInstance: """ Build an instance of InviteInstance @@ -394,7 +394,6 @@ def __repr__(self) -> str: class InviteList(ListResource): - def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the InviteList @@ -914,10 +913,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = InvitePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/chat/v2/service/channel/member.py b/twilio/rest/chat/v2/service/channel/member.py index 4193070b2..1129617b5 100644 --- a/twilio/rest/chat/v2/service/channel/member.py +++ b/twilio/rest/chat/v2/service/channel/member.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class MemberInstance(InstanceResource): - class WebhookEnabledType(object): TRUE = "true" FALSE = "false" @@ -69,9 +69,9 @@ def __init__( self.last_consumed_message_index: Optional[int] = deserialize.integer( payload.get("last_consumed_message_index") ) - self.last_consumption_timestamp: Optional[datetime] = ( - deserialize.iso8601_datetime(payload.get("last_consumption_timestamp")) - ) + self.last_consumption_timestamp: Optional[ + datetime + ] = deserialize.iso8601_datetime(payload.get("last_consumption_timestamp")) self.url: Optional[str] = payload.get("url") self.attributes: Optional[str] = payload.get("attributes") @@ -354,7 +354,6 @@ def __repr__(self) -> str: class MemberContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the MemberContext @@ -875,7 +874,6 @@ def __repr__(self) -> str: class MemberPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> MemberInstance: """ Build an instance of MemberInstance @@ -899,7 +897,6 @@ def __repr__(self) -> str: class MemberList(ListResource): - def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the MemberList @@ -1559,10 +1556,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = MemberPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/chat/v2/service/channel/message.py b/twilio/rest/chat/v2/service/channel/message.py index 9328fe118..4f6c76ad1 100644 --- a/twilio/rest/chat/v2/service/channel/message.py +++ b/twilio/rest/chat/v2/service/channel/message.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class MessageInstance(InstanceResource): - class OrderType(object): ASC = "asc" DESC = "desc" @@ -362,7 +362,6 @@ def __repr__(self) -> str: class MessageContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the MessageContext @@ -879,7 +878,6 @@ def __repr__(self) -> str: class MessagePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> MessageInstance: """ Build an instance of MessageInstance @@ -903,7 +901,6 @@ def __repr__(self) -> str: class MessageList(ListResource): - def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the MessageList @@ -1559,10 +1556,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = MessagePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/chat/v2/service/channel/webhook.py b/twilio/rest/chat/v2/service/channel/webhook.py index eb0066839..f2e7b20aa 100644 --- a/twilio/rest/chat/v2/service/channel/webhook.py +++ b/twilio/rest/chat/v2/service/channel/webhook.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class WebhookInstance(InstanceResource): - class Method(object): GET = "GET" POST = "POST" @@ -297,7 +297,6 @@ def __repr__(self) -> str: class WebhookContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the WebhookContext @@ -728,7 +727,6 @@ def __repr__(self) -> str: class WebhookPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> WebhookInstance: """ Build an instance of WebhookInstance @@ -752,7 +750,6 @@ def __repr__(self) -> str: class WebhookList(ListResource): - def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the WebhookList @@ -1346,10 +1343,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = WebhookPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/chat/v2/service/role.py b/twilio/rest/chat/v2/service/role.py index 726e017e6..01dbe0795 100644 --- a/twilio/rest/chat/v2/service/role.py +++ b/twilio/rest/chat/v2/service/role.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class RoleInstance(InstanceResource): - class RoleType(object): CHANNEL = "channel" DEPLOYMENT = "deployment" @@ -217,7 +217,6 @@ def __repr__(self) -> str: class RoleContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the RoleContext @@ -520,7 +519,6 @@ def __repr__(self) -> str: class RolePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> RoleInstance: """ Build an instance of RoleInstance @@ -541,7 +539,6 @@ def __repr__(self) -> str: class RoleList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the RoleList @@ -1021,10 +1018,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = RolePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/chat/v2/service/user/__init__.py b/twilio/rest/chat/v2/service/user/__init__.py index 87d1c4a47..a8da501c1 100644 --- a/twilio/rest/chat/v2/service/user/__init__.py +++ b/twilio/rest/chat/v2/service/user/__init__.py @@ -12,6 +12,7 @@ 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 @@ -26,7 +27,6 @@ class UserInstance(InstanceResource): - class WebhookEnabledType(object): TRUE = "true" FALSE = "false" @@ -301,7 +301,6 @@ def __repr__(self) -> str: class UserContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the UserContext @@ -735,7 +734,6 @@ def __repr__(self) -> str: class UserPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> UserInstance: """ Build an instance of UserInstance @@ -756,7 +754,6 @@ def __repr__(self) -> str: class UserList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the UserList @@ -1314,10 +1311,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = UserPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/chat/v2/service/user/user_binding.py b/twilio/rest/chat/v2/service/user/user_binding.py index 3e992863f..2a806987e 100644 --- a/twilio/rest/chat/v2/service/user/user_binding.py +++ b/twilio/rest/chat/v2/service/user/user_binding.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class UserBindingInstance(InstanceResource): - class BindingType(object): GCM = "gcm" APN = "apn" @@ -181,7 +181,6 @@ def __repr__(self) -> str: class UserBindingContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, user_sid: str, sid: str): """ Initialize the UserBindingContext @@ -380,7 +379,6 @@ def __repr__(self) -> str: class UserBindingPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> UserBindingInstance: """ Build an instance of UserBindingInstance @@ -404,7 +402,6 @@ def __repr__(self) -> str: class UserBindingList(ListResource): - def __init__(self, version: Version, service_sid: str, user_sid: str): """ Initialize the UserBindingList @@ -816,10 +813,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = UserBindingPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/chat/v2/service/user/user_channel.py b/twilio/rest/chat/v2/service/user/user_channel.py index d0a78c7d4..e979598fb 100644 --- a/twilio/rest/chat/v2/service/user/user_channel.py +++ b/twilio/rest/chat/v2/service/user/user_channel.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class UserChannelInstance(InstanceResource): - class ChannelStatus(object): JOINED = "joined" INVITED = "invited" @@ -78,9 +78,9 @@ def __init__( ) self.links: Optional[Dict[str, object]] = payload.get("links") self.url: Optional[str] = payload.get("url") - self.notification_level: Optional["UserChannelInstance.NotificationLevel"] = ( - payload.get("notification_level") - ) + self.notification_level: Optional[ + "UserChannelInstance.NotificationLevel" + ] = payload.get("notification_level") self._solution = { "service_sid": service_sid, @@ -313,7 +313,6 @@ def __repr__(self) -> str: class UserChannelContext(InstanceContext): - def __init__( self, version: Version, service_sid: str, user_sid: str, channel_sid: str ): @@ -756,7 +755,6 @@ def __repr__(self) -> str: class UserChannelPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> UserChannelInstance: """ Build an instance of UserChannelInstance @@ -780,7 +778,6 @@ def __repr__(self) -> str: class UserChannelList(ListResource): - def __init__(self, version: Version, service_sid: str, user_sid: str): """ Initialize the UserChannelList @@ -1132,10 +1129,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = UserChannelPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/chat/v3/__init__.py b/twilio/rest/chat/v3/__init__.py index 582dc4406..7fdfc8977 100644 --- a/twilio/rest/chat/v3/__init__.py +++ b/twilio/rest/chat/v3/__init__.py @@ -19,7 +19,6 @@ class V3(Version): - def __init__(self, domain: Domain): """ Initialize the V3 version of Chat diff --git a/twilio/rest/chat/v3/channel.py b/twilio/rest/chat/v3/channel.py index 57c22fc41..48f2123f3 100644 --- a/twilio/rest/chat/v3/channel.py +++ b/twilio/rest/chat/v3/channel.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, values @@ -23,7 +24,6 @@ class ChannelInstance(InstanceResource): - class ChannelType(object): PUBLIC = "public" PRIVATE = "private" @@ -206,7 +206,6 @@ def __repr__(self) -> str: class ChannelContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the ChannelContext @@ -433,7 +432,6 @@ def __repr__(self) -> str: class ChannelList(ListResource): - def __init__(self, version: Version): """ Initialize the ChannelList diff --git a/twilio/rest/content/ContentBase.py b/twilio/rest/content/ContentBase.py index 8a1ccd5d9..afcecd597 100644 --- a/twilio/rest/content/ContentBase.py +++ b/twilio/rest/content/ContentBase.py @@ -18,7 +18,6 @@ class ContentBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Content Domain diff --git a/twilio/rest/content/v1/__init__.py b/twilio/rest/content/v1/__init__.py index 1410fe478..68f3f13a6 100644 --- a/twilio/rest/content/v1/__init__.py +++ b/twilio/rest/content/v1/__init__.py @@ -21,7 +21,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Content diff --git a/twilio/rest/content/v1/content/__init__.py b/twilio/rest/content/v1/content/__init__.py index b419ce57a..4dd46864a 100644 --- a/twilio/rest/content/v1/content/__init__.py +++ b/twilio/rest/content/v1/content/__init__.py @@ -12,6 +12,7 @@ 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 @@ -26,7 +27,6 @@ class ContentInstance(InstanceResource): - class AuthenticationAction(object): """ :ivar type: @@ -34,10 +34,9 @@ class AuthenticationAction(object): """ def __init__(self, payload: Dict[str, Any]): - - self.type: Optional["ContentInstance.AuthenticationActionType"] = ( - payload.get("type") - ) + self.type: Optional[ + "ContentInstance.AuthenticationActionType" + ] = payload.get("type") self.copy_code_text: Optional[str] = payload.get("copy_code_text") def to_dict(self): @@ -57,7 +56,6 @@ class CallToActionAction(object): """ def __init__(self, payload: Dict[str, Any]): - self.type: Optional["ContentInstance.CallToActionActionType"] = payload.get( "type" ) @@ -89,16 +87,15 @@ class CardAction(object): """ def __init__(self, payload: Dict[str, Any]): - self.type: Optional["ContentInstance.CardActionType"] = payload.get("type") self.title: Optional[str] = payload.get("title") self.url: Optional[str] = payload.get("url") self.phone: Optional[str] = payload.get("phone") self.id: Optional[str] = payload.get("id") self.code: Optional[str] = payload.get("code") - self.webview_size: Optional["ContentInstance.WebviewSizeType"] = ( - payload.get("webview_size") - ) + self.webview_size: Optional[ + "ContentInstance.WebviewSizeType" + ] = payload.get("webview_size") def to_dict(self): return { @@ -121,7 +118,6 @@ class CarouselAction(object): """ def __init__(self, payload: Dict[str, Any]): - self.type: Optional["ContentInstance.CarouselActionType"] = payload.get( "type" ) @@ -148,7 +144,6 @@ class CarouselCard(object): """ def __init__(self, payload: Dict[str, Any]): - self.title: Optional[str] = payload.get("title") self.body: Optional[str] = payload.get("body") self.media: Optional[str] = payload.get("media") @@ -161,11 +156,9 @@ def to_dict(self): "title": self.title, "body": self.body, "media": self.media, - "actions": ( - [actions.to_dict() for actions in self.actions] - if self.actions is not None - else None - ), + "actions": [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None, } class CatalogItem(object): @@ -179,7 +172,6 @@ class CatalogItem(object): """ def __init__(self, payload: Dict[str, Any]): - self.id: Optional[str] = payload.get("id") self.section_title: Optional[str] = payload.get("section_title") self.name: Optional[str] = payload.get("name") @@ -206,7 +198,6 @@ class ContentCreateRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.friendly_name: Optional[str] = payload.get("friendly_name") self.variables: Optional[Dict[str, str]] = payload.get("variables") self.language: Optional[str] = payload.get("language") @@ -229,7 +220,6 @@ class ContentUpdateRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.friendly_name: Optional[str] = payload.get("friendly_name") self.variables: Optional[Dict[str, str]] = payload.get("variables") self.language: Optional[str] = payload.get("language") @@ -253,7 +243,6 @@ class FlowsPage(object): """ def __init__(self, payload: Dict[str, Any]): - self.id: Optional[str] = payload.get("id") self.next_page_id: Optional[str] = payload.get("next_page_id") self.title: Optional[str] = payload.get("title") @@ -268,11 +257,9 @@ def to_dict(self): "next_page_id": self.next_page_id, "title": self.title, "subtitle": self.subtitle, - "layout": ( - [layout.to_dict() for layout in self.layout] - if self.layout is not None - else None - ), + "layout": [layout.to_dict() for layout in self.layout] + if self.layout is not None + else None, } class FlowsPageComponent(object): @@ -282,7 +269,6 @@ class FlowsPageComponent(object): """ def __init__(self, payload: Dict[str, Any]): - self.label: Optional[str] = payload.get("label") self.type: Optional[str] = payload.get("type") @@ -300,7 +286,6 @@ class ListItem(object): """ def __init__(self, payload: Dict[str, Any]): - self.id: Optional[str] = payload.get("id") self.item: Optional[str] = payload.get("item") self.description: Optional[str] = payload.get("description") @@ -320,7 +305,6 @@ class QuickReplyAction(object): """ def __init__(self, payload: Dict[str, Any]): - self.type: Optional["ContentInstance.QuickReplyActionType"] = payload.get( "type" ) @@ -341,7 +325,6 @@ class TwilioCallToAction(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") self.actions: Optional[List[ContentList.CallToActionAction]] = payload.get( "actions" @@ -350,11 +333,9 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { "body": self.body, - "actions": ( - [actions.to_dict() for actions in self.actions] - if self.actions is not None - else None - ), + "actions": [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None, } class TwilioCard(object): @@ -366,7 +347,6 @@ class TwilioCard(object): """ def __init__(self, payload: Dict[str, Any]): - self.title: Optional[str] = payload.get("title") self.subtitle: Optional[str] = payload.get("subtitle") self.media: Optional[List[str]] = payload.get("media") @@ -379,11 +359,9 @@ def to_dict(self): "title": self.title, "subtitle": self.subtitle, "media": self.media, - "actions": ( - [actions.to_dict() for actions in self.actions] - if self.actions is not None - else None - ), + "actions": [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None, } class TwilioCarousel(object): @@ -393,18 +371,15 @@ class TwilioCarousel(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") self.cards: Optional[List[ContentList.CarouselCard]] = payload.get("cards") def to_dict(self): return { "body": self.body, - "cards": ( - [cards.to_dict() for cards in self.cards] - if self.cards is not None - else None - ), + "cards": [cards.to_dict() for cards in self.cards] + if self.cards is not None + else None, } class TwilioCatalog(object): @@ -418,7 +393,6 @@ class TwilioCatalog(object): """ def __init__(self, payload: Dict[str, Any]): - self.title: Optional[str] = payload.get("title") self.body: Optional[str] = payload.get("body") self.subtitle: Optional[str] = payload.get("subtitle") @@ -432,11 +406,9 @@ def to_dict(self): "body": self.body, "subtitle": self.subtitle, "id": self.id, - "items": ( - [items.to_dict() for items in self.items] - if self.items is not None - else None - ), + "items": [items.to_dict() for items in self.items] + if self.items is not None + else None, "dynamic_items": self.dynamic_items, } @@ -451,7 +423,6 @@ class TwilioFlows(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") self.button_text: Optional[str] = payload.get("button_text") self.subtitle: Optional[str] = payload.get("subtitle") @@ -465,11 +436,9 @@ def to_dict(self): "button_text": self.button_text, "subtitle": self.subtitle, "media_url": self.media_url, - "pages": ( - [pages.to_dict() for pages in self.pages] - if self.pages is not None - else None - ), + "pages": [pages.to_dict() for pages in self.pages] + if self.pages is not None + else None, "type": self.type, } @@ -481,7 +450,6 @@ class TwilioListPicker(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") self.button: Optional[str] = payload.get("button") self.items: Optional[List[ContentList.ListItem]] = payload.get("items") @@ -490,11 +458,9 @@ def to_dict(self): return { "body": self.body, "button": self.button, - "items": ( - [items.to_dict() for items in self.items] - if self.items is not None - else None - ), + "items": [items.to_dict() for items in self.items] + if self.items is not None + else None, } class TwilioLocation(object): @@ -507,7 +473,6 @@ class TwilioLocation(object): """ def __init__(self, payload: Dict[str, Any]): - self.latitude: Optional[float] = payload.get("latitude") self.longitude: Optional[float] = payload.get("longitude") self.label: Optional[str] = payload.get("label") @@ -530,7 +495,6 @@ class TwilioMedia(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") self.media: Optional[List[str]] = payload.get("media") @@ -547,7 +511,6 @@ class TwilioQuickReply(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") self.actions: Optional[List[ContentList.QuickReplyAction]] = payload.get( "actions" @@ -556,11 +519,9 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { "body": self.body, - "actions": ( - [actions.to_dict() for actions in self.actions] - if self.actions is not None - else None - ), + "actions": [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None, } class TwilioSchedule(object): @@ -571,7 +532,6 @@ class TwilioSchedule(object): """ def __init__(self, payload: Dict[str, Any]): - self.id: Optional[str] = payload.get("id") self.title: Optional[str] = payload.get("title") self.time_slots: Optional[str] = payload.get("time_slots") @@ -589,7 +549,6 @@ class TwilioText(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") def to_dict(self): @@ -616,7 +575,6 @@ class Types(object): """ def __init__(self, payload: Dict[str, Any]): - self.twilio_text: Optional[ContentList.TwilioText] = payload.get( "twilio_text" ) @@ -626,15 +584,15 @@ def __init__(self, payload: Dict[str, Any]): self.twilio_location: Optional[ContentList.TwilioLocation] = payload.get( "twilio_location" ) - self.twilio_list_picker: Optional[ContentList.TwilioListPicker] = ( - payload.get("twilio_list_picker") - ) - self.twilio_call_to_action: Optional[ContentList.TwilioCallToAction] = ( - payload.get("twilio_call_to_action") - ) - self.twilio_quick_reply: Optional[ContentList.TwilioQuickReply] = ( - payload.get("twilio_quick_reply") - ) + self.twilio_list_picker: Optional[ + ContentList.TwilioListPicker + ] = payload.get("twilio_list_picker") + self.twilio_call_to_action: Optional[ + ContentList.TwilioCallToAction + ] = payload.get("twilio_call_to_action") + self.twilio_quick_reply: Optional[ + ContentList.TwilioQuickReply + ] = payload.get("twilio_quick_reply") self.twilio_card: Optional[ContentList.TwilioCard] = payload.get( "twilio_card" ) @@ -662,72 +620,48 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { - "twilio_text": ( - self.twilio_text.to_dict() if self.twilio_text is not None else None - ), - "twilio_media": ( - self.twilio_media.to_dict() - if self.twilio_media is not None - else None - ), - "twilio_location": ( - self.twilio_location.to_dict() - if self.twilio_location is not None - else None - ), - "twilio_list_picker": ( - self.twilio_list_picker.to_dict() - if self.twilio_list_picker is not None - else None - ), - "twilio_call_to_action": ( - self.twilio_call_to_action.to_dict() - if self.twilio_call_to_action is not None - else None - ), - "twilio_quick_reply": ( - self.twilio_quick_reply.to_dict() - if self.twilio_quick_reply is not None - else None - ), - "twilio_card": ( - self.twilio_card.to_dict() if self.twilio_card is not None else None - ), - "twilio_catalog": ( - self.twilio_catalog.to_dict() - if self.twilio_catalog is not None - else None - ), - "twilio_carousel": ( - self.twilio_carousel.to_dict() - if self.twilio_carousel is not None - else None - ), - "twilio_flows": ( - self.twilio_flows.to_dict() - if self.twilio_flows is not None - else None - ), - "twilio_schedule": ( - self.twilio_schedule.to_dict() - if self.twilio_schedule is not None - else None - ), - "whatsapp_card": ( - self.whatsapp_card.to_dict() - if self.whatsapp_card is not None - else None - ), - "whatsapp_authentication": ( - self.whatsapp_authentication.to_dict() - if self.whatsapp_authentication is not None - else None - ), - "whatsapp_flows": ( - self.whatsapp_flows.to_dict() - if self.whatsapp_flows is not None - else None - ), + "twilio_text": self.twilio_text.to_dict() + if self.twilio_text is not None + else None, + "twilio_media": self.twilio_media.to_dict() + if self.twilio_media is not None + else None, + "twilio_location": self.twilio_location.to_dict() + if self.twilio_location is not None + else None, + "twilio_list_picker": self.twilio_list_picker.to_dict() + if self.twilio_list_picker is not None + else None, + "twilio_call_to_action": self.twilio_call_to_action.to_dict() + if self.twilio_call_to_action is not None + else None, + "twilio_quick_reply": self.twilio_quick_reply.to_dict() + if self.twilio_quick_reply is not None + else None, + "twilio_card": self.twilio_card.to_dict() + if self.twilio_card is not None + else None, + "twilio_catalog": self.twilio_catalog.to_dict() + if self.twilio_catalog is not None + else None, + "twilio_carousel": self.twilio_carousel.to_dict() + if self.twilio_carousel is not None + else None, + "twilio_flows": self.twilio_flows.to_dict() + if self.twilio_flows is not None + else None, + "twilio_schedule": self.twilio_schedule.to_dict() + if self.twilio_schedule is not None + else None, + "whatsapp_card": self.whatsapp_card.to_dict() + if self.whatsapp_card is not None + else None, + "whatsapp_authentication": self.whatsapp_authentication.to_dict() + if self.whatsapp_authentication is not None + else None, + "whatsapp_flows": self.whatsapp_flows.to_dict() + if self.whatsapp_flows is not None + else None, } class WhatsappAuthentication(object): @@ -738,26 +672,23 @@ class WhatsappAuthentication(object): """ def __init__(self, payload: Dict[str, Any]): - self.add_security_recommendation: Optional[bool] = payload.get( "add_security_recommendation" ) self.code_expiration_minutes: Optional[float] = payload.get( "code_expiration_minutes" ) - self.actions: Optional[List[ContentList.AuthenticationAction]] = ( - payload.get("actions") - ) + self.actions: Optional[ + List[ContentList.AuthenticationAction] + ] = payload.get("actions") def to_dict(self): return { "add_security_recommendation": self.add_security_recommendation, "code_expiration_minutes": self.code_expiration_minutes, - "actions": ( - [actions.to_dict() for actions in self.actions] - if self.actions is not None - else None - ), + "actions": [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None, } class WhatsappCard(object): @@ -770,7 +701,6 @@ class WhatsappCard(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") self.footer: Optional[str] = payload.get("footer") self.media: Optional[List[str]] = payload.get("media") @@ -785,11 +715,9 @@ def to_dict(self): "footer": self.footer, "media": self.media, "header_text": self.header_text, - "actions": ( - [actions.to_dict() for actions in self.actions] - if self.actions is not None - else None - ), + "actions": [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None, } class WhatsappFlows(object): @@ -805,7 +733,6 @@ class WhatsappFlows(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") self.button_text: Optional[str] = payload.get("button_text") self.subtitle: Optional[str] = payload.get("subtitle") @@ -1064,7 +991,6 @@ def __repr__(self) -> str: class ContentContext(InstanceContext): - class AuthenticationAction(object): """ :ivar type: @@ -1072,10 +998,9 @@ class AuthenticationAction(object): """ def __init__(self, payload: Dict[str, Any]): - - self.type: Optional["ContentInstance.AuthenticationActionType"] = ( - payload.get("type") - ) + self.type: Optional[ + "ContentInstance.AuthenticationActionType" + ] = payload.get("type") self.copy_code_text: Optional[str] = payload.get("copy_code_text") def to_dict(self): @@ -1095,7 +1020,6 @@ class CallToActionAction(object): """ def __init__(self, payload: Dict[str, Any]): - self.type: Optional["ContentInstance.CallToActionActionType"] = payload.get( "type" ) @@ -1127,16 +1051,15 @@ class CardAction(object): """ def __init__(self, payload: Dict[str, Any]): - self.type: Optional["ContentInstance.CardActionType"] = payload.get("type") self.title: Optional[str] = payload.get("title") self.url: Optional[str] = payload.get("url") self.phone: Optional[str] = payload.get("phone") self.id: Optional[str] = payload.get("id") self.code: Optional[str] = payload.get("code") - self.webview_size: Optional["ContentInstance.WebviewSizeType"] = ( - payload.get("webview_size") - ) + self.webview_size: Optional[ + "ContentInstance.WebviewSizeType" + ] = payload.get("webview_size") def to_dict(self): return { @@ -1159,7 +1082,6 @@ class CarouselAction(object): """ def __init__(self, payload: Dict[str, Any]): - self.type: Optional["ContentInstance.CarouselActionType"] = payload.get( "type" ) @@ -1186,7 +1108,6 @@ class CarouselCard(object): """ def __init__(self, payload: Dict[str, Any]): - self.title: Optional[str] = payload.get("title") self.body: Optional[str] = payload.get("body") self.media: Optional[str] = payload.get("media") @@ -1199,11 +1120,9 @@ def to_dict(self): "title": self.title, "body": self.body, "media": self.media, - "actions": ( - [actions.to_dict() for actions in self.actions] - if self.actions is not None - else None - ), + "actions": [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None, } class CatalogItem(object): @@ -1217,7 +1136,6 @@ class CatalogItem(object): """ def __init__(self, payload: Dict[str, Any]): - self.id: Optional[str] = payload.get("id") self.section_title: Optional[str] = payload.get("section_title") self.name: Optional[str] = payload.get("name") @@ -1244,7 +1162,6 @@ class ContentCreateRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.friendly_name: Optional[str] = payload.get("friendly_name") self.variables: Optional[Dict[str, str]] = payload.get("variables") self.language: Optional[str] = payload.get("language") @@ -1267,7 +1184,6 @@ class ContentUpdateRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.friendly_name: Optional[str] = payload.get("friendly_name") self.variables: Optional[Dict[str, str]] = payload.get("variables") self.language: Optional[str] = payload.get("language") @@ -1291,7 +1207,6 @@ class FlowsPage(object): """ def __init__(self, payload: Dict[str, Any]): - self.id: Optional[str] = payload.get("id") self.next_page_id: Optional[str] = payload.get("next_page_id") self.title: Optional[str] = payload.get("title") @@ -1306,11 +1221,9 @@ def to_dict(self): "next_page_id": self.next_page_id, "title": self.title, "subtitle": self.subtitle, - "layout": ( - [layout.to_dict() for layout in self.layout] - if self.layout is not None - else None - ), + "layout": [layout.to_dict() for layout in self.layout] + if self.layout is not None + else None, } class FlowsPageComponent(object): @@ -1320,7 +1233,6 @@ class FlowsPageComponent(object): """ def __init__(self, payload: Dict[str, Any]): - self.label: Optional[str] = payload.get("label") self.type: Optional[str] = payload.get("type") @@ -1338,7 +1250,6 @@ class ListItem(object): """ def __init__(self, payload: Dict[str, Any]): - self.id: Optional[str] = payload.get("id") self.item: Optional[str] = payload.get("item") self.description: Optional[str] = payload.get("description") @@ -1358,7 +1269,6 @@ class QuickReplyAction(object): """ def __init__(self, payload: Dict[str, Any]): - self.type: Optional["ContentInstance.QuickReplyActionType"] = payload.get( "type" ) @@ -1379,7 +1289,6 @@ class TwilioCallToAction(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") self.actions: Optional[List[ContentList.CallToActionAction]] = payload.get( "actions" @@ -1388,11 +1297,9 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { "body": self.body, - "actions": ( - [actions.to_dict() for actions in self.actions] - if self.actions is not None - else None - ), + "actions": [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None, } class TwilioCard(object): @@ -1404,7 +1311,6 @@ class TwilioCard(object): """ def __init__(self, payload: Dict[str, Any]): - self.title: Optional[str] = payload.get("title") self.subtitle: Optional[str] = payload.get("subtitle") self.media: Optional[List[str]] = payload.get("media") @@ -1417,11 +1323,9 @@ def to_dict(self): "title": self.title, "subtitle": self.subtitle, "media": self.media, - "actions": ( - [actions.to_dict() for actions in self.actions] - if self.actions is not None - else None - ), + "actions": [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None, } class TwilioCarousel(object): @@ -1431,18 +1335,15 @@ class TwilioCarousel(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") self.cards: Optional[List[ContentList.CarouselCard]] = payload.get("cards") def to_dict(self): return { "body": self.body, - "cards": ( - [cards.to_dict() for cards in self.cards] - if self.cards is not None - else None - ), + "cards": [cards.to_dict() for cards in self.cards] + if self.cards is not None + else None, } class TwilioCatalog(object): @@ -1456,7 +1357,6 @@ class TwilioCatalog(object): """ def __init__(self, payload: Dict[str, Any]): - self.title: Optional[str] = payload.get("title") self.body: Optional[str] = payload.get("body") self.subtitle: Optional[str] = payload.get("subtitle") @@ -1470,11 +1370,9 @@ def to_dict(self): "body": self.body, "subtitle": self.subtitle, "id": self.id, - "items": ( - [items.to_dict() for items in self.items] - if self.items is not None - else None - ), + "items": [items.to_dict() for items in self.items] + if self.items is not None + else None, "dynamic_items": self.dynamic_items, } @@ -1489,7 +1387,6 @@ class TwilioFlows(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") self.button_text: Optional[str] = payload.get("button_text") self.subtitle: Optional[str] = payload.get("subtitle") @@ -1503,11 +1400,9 @@ def to_dict(self): "button_text": self.button_text, "subtitle": self.subtitle, "media_url": self.media_url, - "pages": ( - [pages.to_dict() for pages in self.pages] - if self.pages is not None - else None - ), + "pages": [pages.to_dict() for pages in self.pages] + if self.pages is not None + else None, "type": self.type, } @@ -1519,7 +1414,6 @@ class TwilioListPicker(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") self.button: Optional[str] = payload.get("button") self.items: Optional[List[ContentList.ListItem]] = payload.get("items") @@ -1528,11 +1422,9 @@ def to_dict(self): return { "body": self.body, "button": self.button, - "items": ( - [items.to_dict() for items in self.items] - if self.items is not None - else None - ), + "items": [items.to_dict() for items in self.items] + if self.items is not None + else None, } class TwilioLocation(object): @@ -1545,7 +1437,6 @@ class TwilioLocation(object): """ def __init__(self, payload: Dict[str, Any]): - self.latitude: Optional[float] = payload.get("latitude") self.longitude: Optional[float] = payload.get("longitude") self.label: Optional[str] = payload.get("label") @@ -1568,7 +1459,6 @@ class TwilioMedia(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") self.media: Optional[List[str]] = payload.get("media") @@ -1585,7 +1475,6 @@ class TwilioQuickReply(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") self.actions: Optional[List[ContentList.QuickReplyAction]] = payload.get( "actions" @@ -1594,11 +1483,9 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { "body": self.body, - "actions": ( - [actions.to_dict() for actions in self.actions] - if self.actions is not None - else None - ), + "actions": [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None, } class TwilioSchedule(object): @@ -1609,7 +1496,6 @@ class TwilioSchedule(object): """ def __init__(self, payload: Dict[str, Any]): - self.id: Optional[str] = payload.get("id") self.title: Optional[str] = payload.get("title") self.time_slots: Optional[str] = payload.get("time_slots") @@ -1627,7 +1513,6 @@ class TwilioText(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") def to_dict(self): @@ -1654,7 +1539,6 @@ class Types(object): """ def __init__(self, payload: Dict[str, Any]): - self.twilio_text: Optional[ContentList.TwilioText] = payload.get( "twilio_text" ) @@ -1664,15 +1548,15 @@ def __init__(self, payload: Dict[str, Any]): self.twilio_location: Optional[ContentList.TwilioLocation] = payload.get( "twilio_location" ) - self.twilio_list_picker: Optional[ContentList.TwilioListPicker] = ( - payload.get("twilio_list_picker") - ) - self.twilio_call_to_action: Optional[ContentList.TwilioCallToAction] = ( - payload.get("twilio_call_to_action") - ) - self.twilio_quick_reply: Optional[ContentList.TwilioQuickReply] = ( - payload.get("twilio_quick_reply") - ) + self.twilio_list_picker: Optional[ + ContentList.TwilioListPicker + ] = payload.get("twilio_list_picker") + self.twilio_call_to_action: Optional[ + ContentList.TwilioCallToAction + ] = payload.get("twilio_call_to_action") + self.twilio_quick_reply: Optional[ + ContentList.TwilioQuickReply + ] = payload.get("twilio_quick_reply") self.twilio_card: Optional[ContentList.TwilioCard] = payload.get( "twilio_card" ) @@ -1700,72 +1584,48 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { - "twilio_text": ( - self.twilio_text.to_dict() if self.twilio_text is not None else None - ), - "twilio_media": ( - self.twilio_media.to_dict() - if self.twilio_media is not None - else None - ), - "twilio_location": ( - self.twilio_location.to_dict() - if self.twilio_location is not None - else None - ), - "twilio_list_picker": ( - self.twilio_list_picker.to_dict() - if self.twilio_list_picker is not None - else None - ), - "twilio_call_to_action": ( - self.twilio_call_to_action.to_dict() - if self.twilio_call_to_action is not None - else None - ), - "twilio_quick_reply": ( - self.twilio_quick_reply.to_dict() - if self.twilio_quick_reply is not None - else None - ), - "twilio_card": ( - self.twilio_card.to_dict() if self.twilio_card is not None else None - ), - "twilio_catalog": ( - self.twilio_catalog.to_dict() - if self.twilio_catalog is not None - else None - ), - "twilio_carousel": ( - self.twilio_carousel.to_dict() - if self.twilio_carousel is not None - else None - ), - "twilio_flows": ( - self.twilio_flows.to_dict() - if self.twilio_flows is not None - else None - ), - "twilio_schedule": ( - self.twilio_schedule.to_dict() - if self.twilio_schedule is not None - else None - ), - "whatsapp_card": ( - self.whatsapp_card.to_dict() - if self.whatsapp_card is not None - else None - ), - "whatsapp_authentication": ( - self.whatsapp_authentication.to_dict() - if self.whatsapp_authentication is not None - else None - ), - "whatsapp_flows": ( - self.whatsapp_flows.to_dict() - if self.whatsapp_flows is not None - else None - ), + "twilio_text": self.twilio_text.to_dict() + if self.twilio_text is not None + else None, + "twilio_media": self.twilio_media.to_dict() + if self.twilio_media is not None + else None, + "twilio_location": self.twilio_location.to_dict() + if self.twilio_location is not None + else None, + "twilio_list_picker": self.twilio_list_picker.to_dict() + if self.twilio_list_picker is not None + else None, + "twilio_call_to_action": self.twilio_call_to_action.to_dict() + if self.twilio_call_to_action is not None + else None, + "twilio_quick_reply": self.twilio_quick_reply.to_dict() + if self.twilio_quick_reply is not None + else None, + "twilio_card": self.twilio_card.to_dict() + if self.twilio_card is not None + else None, + "twilio_catalog": self.twilio_catalog.to_dict() + if self.twilio_catalog is not None + else None, + "twilio_carousel": self.twilio_carousel.to_dict() + if self.twilio_carousel is not None + else None, + "twilio_flows": self.twilio_flows.to_dict() + if self.twilio_flows is not None + else None, + "twilio_schedule": self.twilio_schedule.to_dict() + if self.twilio_schedule is not None + else None, + "whatsapp_card": self.whatsapp_card.to_dict() + if self.whatsapp_card is not None + else None, + "whatsapp_authentication": self.whatsapp_authentication.to_dict() + if self.whatsapp_authentication is not None + else None, + "whatsapp_flows": self.whatsapp_flows.to_dict() + if self.whatsapp_flows is not None + else None, } class WhatsappAuthentication(object): @@ -1776,26 +1636,23 @@ class WhatsappAuthentication(object): """ def __init__(self, payload: Dict[str, Any]): - self.add_security_recommendation: Optional[bool] = payload.get( "add_security_recommendation" ) self.code_expiration_minutes: Optional[float] = payload.get( "code_expiration_minutes" ) - self.actions: Optional[List[ContentList.AuthenticationAction]] = ( - payload.get("actions") - ) + self.actions: Optional[ + List[ContentList.AuthenticationAction] + ] = payload.get("actions") def to_dict(self): return { "add_security_recommendation": self.add_security_recommendation, "code_expiration_minutes": self.code_expiration_minutes, - "actions": ( - [actions.to_dict() for actions in self.actions] - if self.actions is not None - else None - ), + "actions": [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None, } class WhatsappCard(object): @@ -1808,7 +1665,6 @@ class WhatsappCard(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") self.footer: Optional[str] = payload.get("footer") self.media: Optional[List[str]] = payload.get("media") @@ -1823,11 +1679,9 @@ def to_dict(self): "footer": self.footer, "media": self.media, "header_text": self.header_text, - "actions": ( - [actions.to_dict() for actions in self.actions] - if self.actions is not None - else None - ), + "actions": [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None, } class WhatsappFlows(object): @@ -1843,7 +1697,6 @@ class WhatsappFlows(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") self.button_text: Optional[str] = payload.get("button_text") self.subtitle: Optional[str] = payload.get("subtitle") @@ -2176,7 +2029,6 @@ def __repr__(self) -> str: class ContentPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ContentInstance: """ Build an instance of ContentInstance @@ -2195,7 +2047,6 @@ def __repr__(self) -> str: class ContentList(ListResource): - class AuthenticationAction(object): """ :ivar type: @@ -2203,10 +2054,9 @@ class AuthenticationAction(object): """ def __init__(self, payload: Dict[str, Any]): - - self.type: Optional["ContentInstance.AuthenticationActionType"] = ( - payload.get("type") - ) + self.type: Optional[ + "ContentInstance.AuthenticationActionType" + ] = payload.get("type") self.copy_code_text: Optional[str] = payload.get("copy_code_text") def to_dict(self): @@ -2226,7 +2076,6 @@ class CallToActionAction(object): """ def __init__(self, payload: Dict[str, Any]): - self.type: Optional["ContentInstance.CallToActionActionType"] = payload.get( "type" ) @@ -2258,16 +2107,15 @@ class CardAction(object): """ def __init__(self, payload: Dict[str, Any]): - self.type: Optional["ContentInstance.CardActionType"] = payload.get("type") self.title: Optional[str] = payload.get("title") self.url: Optional[str] = payload.get("url") self.phone: Optional[str] = payload.get("phone") self.id: Optional[str] = payload.get("id") self.code: Optional[str] = payload.get("code") - self.webview_size: Optional["ContentInstance.WebviewSizeType"] = ( - payload.get("webview_size") - ) + self.webview_size: Optional[ + "ContentInstance.WebviewSizeType" + ] = payload.get("webview_size") def to_dict(self): return { @@ -2290,7 +2138,6 @@ class CarouselAction(object): """ def __init__(self, payload: Dict[str, Any]): - self.type: Optional["ContentInstance.CarouselActionType"] = payload.get( "type" ) @@ -2317,7 +2164,6 @@ class CarouselCard(object): """ def __init__(self, payload: Dict[str, Any]): - self.title: Optional[str] = payload.get("title") self.body: Optional[str] = payload.get("body") self.media: Optional[str] = payload.get("media") @@ -2330,11 +2176,9 @@ def to_dict(self): "title": self.title, "body": self.body, "media": self.media, - "actions": ( - [actions.to_dict() for actions in self.actions] - if self.actions is not None - else None - ), + "actions": [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None, } class CatalogItem(object): @@ -2348,7 +2192,6 @@ class CatalogItem(object): """ def __init__(self, payload: Dict[str, Any]): - self.id: Optional[str] = payload.get("id") self.section_title: Optional[str] = payload.get("section_title") self.name: Optional[str] = payload.get("name") @@ -2375,7 +2218,6 @@ class ContentCreateRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.friendly_name: Optional[str] = payload.get("friendly_name") self.variables: Optional[Dict[str, str]] = payload.get("variables") self.language: Optional[str] = payload.get("language") @@ -2398,7 +2240,6 @@ class ContentUpdateRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.friendly_name: Optional[str] = payload.get("friendly_name") self.variables: Optional[Dict[str, str]] = payload.get("variables") self.language: Optional[str] = payload.get("language") @@ -2422,7 +2263,6 @@ class FlowsPage(object): """ def __init__(self, payload: Dict[str, Any]): - self.id: Optional[str] = payload.get("id") self.next_page_id: Optional[str] = payload.get("next_page_id") self.title: Optional[str] = payload.get("title") @@ -2437,11 +2277,9 @@ def to_dict(self): "next_page_id": self.next_page_id, "title": self.title, "subtitle": self.subtitle, - "layout": ( - [layout.to_dict() for layout in self.layout] - if self.layout is not None - else None - ), + "layout": [layout.to_dict() for layout in self.layout] + if self.layout is not None + else None, } class FlowsPageComponent(object): @@ -2451,7 +2289,6 @@ class FlowsPageComponent(object): """ def __init__(self, payload: Dict[str, Any]): - self.label: Optional[str] = payload.get("label") self.type: Optional[str] = payload.get("type") @@ -2469,7 +2306,6 @@ class ListItem(object): """ def __init__(self, payload: Dict[str, Any]): - self.id: Optional[str] = payload.get("id") self.item: Optional[str] = payload.get("item") self.description: Optional[str] = payload.get("description") @@ -2489,7 +2325,6 @@ class QuickReplyAction(object): """ def __init__(self, payload: Dict[str, Any]): - self.type: Optional["ContentInstance.QuickReplyActionType"] = payload.get( "type" ) @@ -2510,7 +2345,6 @@ class TwilioCallToAction(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") self.actions: Optional[List[ContentList.CallToActionAction]] = payload.get( "actions" @@ -2519,11 +2353,9 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { "body": self.body, - "actions": ( - [actions.to_dict() for actions in self.actions] - if self.actions is not None - else None - ), + "actions": [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None, } class TwilioCard(object): @@ -2535,7 +2367,6 @@ class TwilioCard(object): """ def __init__(self, payload: Dict[str, Any]): - self.title: Optional[str] = payload.get("title") self.subtitle: Optional[str] = payload.get("subtitle") self.media: Optional[List[str]] = payload.get("media") @@ -2548,11 +2379,9 @@ def to_dict(self): "title": self.title, "subtitle": self.subtitle, "media": self.media, - "actions": ( - [actions.to_dict() for actions in self.actions] - if self.actions is not None - else None - ), + "actions": [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None, } class TwilioCarousel(object): @@ -2562,18 +2391,15 @@ class TwilioCarousel(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") self.cards: Optional[List[ContentList.CarouselCard]] = payload.get("cards") def to_dict(self): return { "body": self.body, - "cards": ( - [cards.to_dict() for cards in self.cards] - if self.cards is not None - else None - ), + "cards": [cards.to_dict() for cards in self.cards] + if self.cards is not None + else None, } class TwilioCatalog(object): @@ -2587,7 +2413,6 @@ class TwilioCatalog(object): """ def __init__(self, payload: Dict[str, Any]): - self.title: Optional[str] = payload.get("title") self.body: Optional[str] = payload.get("body") self.subtitle: Optional[str] = payload.get("subtitle") @@ -2601,11 +2426,9 @@ def to_dict(self): "body": self.body, "subtitle": self.subtitle, "id": self.id, - "items": ( - [items.to_dict() for items in self.items] - if self.items is not None - else None - ), + "items": [items.to_dict() for items in self.items] + if self.items is not None + else None, "dynamic_items": self.dynamic_items, } @@ -2620,7 +2443,6 @@ class TwilioFlows(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") self.button_text: Optional[str] = payload.get("button_text") self.subtitle: Optional[str] = payload.get("subtitle") @@ -2634,11 +2456,9 @@ def to_dict(self): "button_text": self.button_text, "subtitle": self.subtitle, "media_url": self.media_url, - "pages": ( - [pages.to_dict() for pages in self.pages] - if self.pages is not None - else None - ), + "pages": [pages.to_dict() for pages in self.pages] + if self.pages is not None + else None, "type": self.type, } @@ -2650,7 +2470,6 @@ class TwilioListPicker(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") self.button: Optional[str] = payload.get("button") self.items: Optional[List[ContentList.ListItem]] = payload.get("items") @@ -2659,11 +2478,9 @@ def to_dict(self): return { "body": self.body, "button": self.button, - "items": ( - [items.to_dict() for items in self.items] - if self.items is not None - else None - ), + "items": [items.to_dict() for items in self.items] + if self.items is not None + else None, } class TwilioLocation(object): @@ -2676,7 +2493,6 @@ class TwilioLocation(object): """ def __init__(self, payload: Dict[str, Any]): - self.latitude: Optional[float] = payload.get("latitude") self.longitude: Optional[float] = payload.get("longitude") self.label: Optional[str] = payload.get("label") @@ -2699,7 +2515,6 @@ class TwilioMedia(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") self.media: Optional[List[str]] = payload.get("media") @@ -2716,7 +2531,6 @@ class TwilioQuickReply(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") self.actions: Optional[List[ContentList.QuickReplyAction]] = payload.get( "actions" @@ -2725,11 +2539,9 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { "body": self.body, - "actions": ( - [actions.to_dict() for actions in self.actions] - if self.actions is not None - else None - ), + "actions": [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None, } class TwilioSchedule(object): @@ -2740,7 +2552,6 @@ class TwilioSchedule(object): """ def __init__(self, payload: Dict[str, Any]): - self.id: Optional[str] = payload.get("id") self.title: Optional[str] = payload.get("title") self.time_slots: Optional[str] = payload.get("time_slots") @@ -2758,7 +2569,6 @@ class TwilioText(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") def to_dict(self): @@ -2785,7 +2595,6 @@ class Types(object): """ def __init__(self, payload: Dict[str, Any]): - self.twilio_text: Optional[ContentList.TwilioText] = payload.get( "twilio_text" ) @@ -2795,15 +2604,15 @@ def __init__(self, payload: Dict[str, Any]): self.twilio_location: Optional[ContentList.TwilioLocation] = payload.get( "twilio_location" ) - self.twilio_list_picker: Optional[ContentList.TwilioListPicker] = ( - payload.get("twilio_list_picker") - ) - self.twilio_call_to_action: Optional[ContentList.TwilioCallToAction] = ( - payload.get("twilio_call_to_action") - ) - self.twilio_quick_reply: Optional[ContentList.TwilioQuickReply] = ( - payload.get("twilio_quick_reply") - ) + self.twilio_list_picker: Optional[ + ContentList.TwilioListPicker + ] = payload.get("twilio_list_picker") + self.twilio_call_to_action: Optional[ + ContentList.TwilioCallToAction + ] = payload.get("twilio_call_to_action") + self.twilio_quick_reply: Optional[ + ContentList.TwilioQuickReply + ] = payload.get("twilio_quick_reply") self.twilio_card: Optional[ContentList.TwilioCard] = payload.get( "twilio_card" ) @@ -2831,72 +2640,48 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { - "twilio_text": ( - self.twilio_text.to_dict() if self.twilio_text is not None else None - ), - "twilio_media": ( - self.twilio_media.to_dict() - if self.twilio_media is not None - else None - ), - "twilio_location": ( - self.twilio_location.to_dict() - if self.twilio_location is not None - else None - ), - "twilio_list_picker": ( - self.twilio_list_picker.to_dict() - if self.twilio_list_picker is not None - else None - ), - "twilio_call_to_action": ( - self.twilio_call_to_action.to_dict() - if self.twilio_call_to_action is not None - else None - ), - "twilio_quick_reply": ( - self.twilio_quick_reply.to_dict() - if self.twilio_quick_reply is not None - else None - ), - "twilio_card": ( - self.twilio_card.to_dict() if self.twilio_card is not None else None - ), - "twilio_catalog": ( - self.twilio_catalog.to_dict() - if self.twilio_catalog is not None - else None - ), - "twilio_carousel": ( - self.twilio_carousel.to_dict() - if self.twilio_carousel is not None - else None - ), - "twilio_flows": ( - self.twilio_flows.to_dict() - if self.twilio_flows is not None - else None - ), - "twilio_schedule": ( - self.twilio_schedule.to_dict() - if self.twilio_schedule is not None - else None - ), - "whatsapp_card": ( - self.whatsapp_card.to_dict() - if self.whatsapp_card is not None - else None - ), - "whatsapp_authentication": ( - self.whatsapp_authentication.to_dict() - if self.whatsapp_authentication is not None - else None - ), - "whatsapp_flows": ( - self.whatsapp_flows.to_dict() - if self.whatsapp_flows is not None - else None - ), + "twilio_text": self.twilio_text.to_dict() + if self.twilio_text is not None + else None, + "twilio_media": self.twilio_media.to_dict() + if self.twilio_media is not None + else None, + "twilio_location": self.twilio_location.to_dict() + if self.twilio_location is not None + else None, + "twilio_list_picker": self.twilio_list_picker.to_dict() + if self.twilio_list_picker is not None + else None, + "twilio_call_to_action": self.twilio_call_to_action.to_dict() + if self.twilio_call_to_action is not None + else None, + "twilio_quick_reply": self.twilio_quick_reply.to_dict() + if self.twilio_quick_reply is not None + else None, + "twilio_card": self.twilio_card.to_dict() + if self.twilio_card is not None + else None, + "twilio_catalog": self.twilio_catalog.to_dict() + if self.twilio_catalog is not None + else None, + "twilio_carousel": self.twilio_carousel.to_dict() + if self.twilio_carousel is not None + else None, + "twilio_flows": self.twilio_flows.to_dict() + if self.twilio_flows is not None + else None, + "twilio_schedule": self.twilio_schedule.to_dict() + if self.twilio_schedule is not None + else None, + "whatsapp_card": self.whatsapp_card.to_dict() + if self.whatsapp_card is not None + else None, + "whatsapp_authentication": self.whatsapp_authentication.to_dict() + if self.whatsapp_authentication is not None + else None, + "whatsapp_flows": self.whatsapp_flows.to_dict() + if self.whatsapp_flows is not None + else None, } class WhatsappAuthentication(object): @@ -2907,26 +2692,23 @@ class WhatsappAuthentication(object): """ def __init__(self, payload: Dict[str, Any]): - self.add_security_recommendation: Optional[bool] = payload.get( "add_security_recommendation" ) self.code_expiration_minutes: Optional[float] = payload.get( "code_expiration_minutes" ) - self.actions: Optional[List[ContentList.AuthenticationAction]] = ( - payload.get("actions") - ) + self.actions: Optional[ + List[ContentList.AuthenticationAction] + ] = payload.get("actions") def to_dict(self): return { "add_security_recommendation": self.add_security_recommendation, "code_expiration_minutes": self.code_expiration_minutes, - "actions": ( - [actions.to_dict() for actions in self.actions] - if self.actions is not None - else None - ), + "actions": [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None, } class WhatsappCard(object): @@ -2939,7 +2721,6 @@ class WhatsappCard(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") self.footer: Optional[str] = payload.get("footer") self.media: Optional[List[str]] = payload.get("media") @@ -2954,11 +2735,9 @@ def to_dict(self): "footer": self.footer, "media": self.media, "header_text": self.header_text, - "actions": ( - [actions.to_dict() for actions in self.actions] - if self.actions is not None - else None - ), + "actions": [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None, } class WhatsappFlows(object): @@ -2974,7 +2753,6 @@ class WhatsappFlows(object): """ def __init__(self, payload: Dict[str, Any]): - self.body: Optional[str] = payload.get("body") self.button_text: Optional[str] = payload.get("button_text") self.subtitle: Optional[str] = payload.get("subtitle") @@ -3438,10 +3216,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ContentPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/content/v1/content/approval_create.py b/twilio/rest/content/v1/content/approval_create.py index 2487ec609..2fe4cad82 100644 --- a/twilio/rest/content/v1/content/approval_create.py +++ b/twilio/rest/content/v1/content/approval_create.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,7 +23,6 @@ class ApprovalCreateInstance(InstanceResource): - class ContentApprovalRequest(object): """ :ivar name: Name of the template. @@ -30,7 +30,6 @@ class ContentApprovalRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.name: Optional[str] = payload.get("name") self.category: Optional[str] = payload.get("category") @@ -76,7 +75,6 @@ def __repr__(self) -> str: class ApprovalCreateList(ListResource): - class ContentApprovalRequest(object): """ :ivar name: Name of the template. @@ -84,7 +82,6 @@ class ContentApprovalRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.name: Optional[str] = payload.get("name") self.category: Optional[str] = payload.get("category") diff --git a/twilio/rest/content/v1/content/approval_fetch.py b/twilio/rest/content/v1/content/approval_fetch.py index cf7b6b4c4..253d78f9e 100644 --- a/twilio/rest/content/v1/content/approval_fetch.py +++ b/twilio/rest/content/v1/content/approval_fetch.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class ApprovalFetchInstance(InstanceResource): + """ :ivar sid: The unique string that that we created to identify the Content resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. @@ -104,7 +106,6 @@ def __repr__(self) -> str: class ApprovalFetchContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the ApprovalFetchContext @@ -221,7 +222,6 @@ def __repr__(self) -> str: class ApprovalFetchList(ListResource): - def __init__(self, version: Version, sid: str): """ Initialize the ApprovalFetchList diff --git a/twilio/rest/content/v1/content_and_approvals.py b/twilio/rest/content/v1/content_and_approvals.py index d56cb2200..f47f1f794 100644 --- a/twilio/rest/content/v1/content_and_approvals.py +++ b/twilio/rest/content/v1/content_and_approvals.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class ContentAndApprovalsInstance(InstanceResource): + """ :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. @@ -66,7 +68,6 @@ def __repr__(self) -> str: class ContentAndApprovalsPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ContentAndApprovalsInstance: """ Build an instance of ContentAndApprovalsInstance @@ -85,7 +86,6 @@ def __repr__(self) -> str: class ContentAndApprovalsList(ListResource): - def __init__(self, version: Version): """ Initialize the ContentAndApprovalsList @@ -428,10 +428,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ContentAndApprovalsPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/content/v1/legacy_content.py b/twilio/rest/content/v1/legacy_content.py index cb60fec8c..a0629e7cc 100644 --- a/twilio/rest/content/v1/legacy_content.py +++ b/twilio/rest/content/v1/legacy_content.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class LegacyContentInstance(InstanceResource): + """ :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. @@ -68,7 +70,6 @@ def __repr__(self) -> str: class LegacyContentPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> LegacyContentInstance: """ Build an instance of LegacyContentInstance @@ -87,7 +88,6 @@ def __repr__(self) -> str: class LegacyContentList(ListResource): - def __init__(self, version: Version): """ Initialize the LegacyContentList @@ -430,10 +430,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = LegacyContentPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/content/v2/__init__.py b/twilio/rest/content/v2/__init__.py index ca6d8bcd7..237065bb8 100644 --- a/twilio/rest/content/v2/__init__.py +++ b/twilio/rest/content/v2/__init__.py @@ -20,7 +20,6 @@ class V2(Version): - def __init__(self, domain: Domain): """ Initialize the V2 version of Content diff --git a/twilio/rest/content/v2/content.py b/twilio/rest/content/v2/content.py index c6d25091d..4db135087 100644 --- a/twilio/rest/content/v2/content.py +++ b/twilio/rest/content/v2/content.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class ContentInstance(InstanceResource): + """ :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. @@ -66,7 +68,6 @@ def __repr__(self) -> str: class ContentPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ContentInstance: """ Build an instance of ContentInstance @@ -85,7 +86,6 @@ def __repr__(self) -> str: class ContentList(ListResource): - def __init__(self, version: Version): """ Initialize the ContentList @@ -758,10 +758,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ContentPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/content/v2/content_and_approvals.py b/twilio/rest/content/v2/content_and_approvals.py index 11c1c63cd..d99ae9a62 100644 --- a/twilio/rest/content/v2/content_and_approvals.py +++ b/twilio/rest/content/v2/content_and_approvals.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class ContentAndApprovalsInstance(InstanceResource): + """ :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. @@ -66,7 +68,6 @@ def __repr__(self) -> str: class ContentAndApprovalsPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ContentAndApprovalsInstance: """ Build an instance of ContentAndApprovalsInstance @@ -85,7 +86,6 @@ def __repr__(self) -> str: class ContentAndApprovalsList(ListResource): - def __init__(self, version: Version): """ Initialize the ContentAndApprovalsList @@ -758,10 +758,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ContentAndApprovalsPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/conversations/ConversationsBase.py b/twilio/rest/conversations/ConversationsBase.py index 890430836..2cd4c292c 100644 --- a/twilio/rest/conversations/ConversationsBase.py +++ b/twilio/rest/conversations/ConversationsBase.py @@ -14,10 +14,10 @@ from twilio.base.domain import Domain from twilio.rest import Client from twilio.rest.conversations.v1 import V1 +from twilio.rest.conversations.v2 import V2 class ConversationsBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Conversations Domain @@ -26,6 +26,7 @@ def __init__(self, twilio: Client): """ super().__init__(twilio, "https://conversations.twilio.com") self._v1: Optional[V1] = None + self._v2: Optional[V2] = None @property def v1(self) -> V1: @@ -36,6 +37,15 @@ def v1(self) -> V1: self._v1 = V1(self) return self._v1 + @property + def v2(self): + """ + :returns: Versions v2 of Conversations + """ + if self._v2 is None: + self._v2 = V2(self) + return self._v2 + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/conversations/v1/__init__.py b/twilio/rest/conversations/v1/__init__.py index 1ec6c22a7..4fc64f9eb 100644 --- a/twilio/rest/conversations/v1/__init__.py +++ b/twilio/rest/conversations/v1/__init__.py @@ -27,11 +27,20 @@ ) from twilio.rest.conversations.v1.role import RoleList from twilio.rest.conversations.v1.service import ServiceList +from twilio.rest.conversations.v1.stats_conversations_ratelimitingerrors import ( + StatsConversationsRatelimitingerrorsList, +) +from twilio.rest.conversations.v1.stats_twilsock_concurrentconnections import ( + StatsTwilsockConcurrentconnectionsList, +) +from twilio.rest.conversations.v1.stats_twilsock_ratelimitingerrors import ( + StatsTwilsockRatelimitingerrorsList, +) from twilio.rest.conversations.v1.user import UserList +from twilio.rest.conversations.v1.webhook import WebhookList class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Conversations @@ -49,7 +58,17 @@ def __init__(self, domain: Domain): self._participant_conversations: Optional[ParticipantConversationList] = None self._roles: Optional[RoleList] = None self._services: Optional[ServiceList] = None + self._stats_conversations_ratelimitingerrors: Optional[ + StatsConversationsRatelimitingerrorsList + ] = None + self._stats_twilsock_concurrentconnections: Optional[ + StatsTwilsockConcurrentconnectionsList + ] = None + self._stats_twilsock_ratelimitingerrors: Optional[ + StatsTwilsockRatelimitingerrorsList + ] = None self._users: Optional[UserList] = None + self._webhooks: Optional[WebhookList] = None @property def address_configurations(self) -> AddressConfigurationList: @@ -101,12 +120,46 @@ def services(self) -> ServiceList: self._services = ServiceList(self) return self._services + @property + def stats_conversations_ratelimitingerrors( + self, + ) -> StatsConversationsRatelimitingerrorsList: + if self._stats_conversations_ratelimitingerrors is None: + self._stats_conversations_ratelimitingerrors = ( + StatsConversationsRatelimitingerrorsList(self) + ) + return self._stats_conversations_ratelimitingerrors + + @property + def stats_twilsock_concurrentconnections( + self, + ) -> StatsTwilsockConcurrentconnectionsList: + if self._stats_twilsock_concurrentconnections is None: + self._stats_twilsock_concurrentconnections = ( + StatsTwilsockConcurrentconnectionsList(self) + ) + return self._stats_twilsock_concurrentconnections + + @property + def stats_twilsock_ratelimitingerrors(self) -> StatsTwilsockRatelimitingerrorsList: + if self._stats_twilsock_ratelimitingerrors is None: + self._stats_twilsock_ratelimitingerrors = ( + StatsTwilsockRatelimitingerrorsList(self) + ) + return self._stats_twilsock_ratelimitingerrors + @property def users(self) -> UserList: if self._users is None: self._users = UserList(self) return self._users + @property + def webhooks(self) -> WebhookList: + if self._webhooks is None: + self._webhooks = WebhookList(self) + return self._webhooks + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/conversations/v1/address_configuration.py b/twilio/rest/conversations/v1/address_configuration.py index 104a09b6e..59972599b 100644 --- a/twilio/rest/conversations/v1/address_configuration.py +++ b/twilio/rest/conversations/v1/address_configuration.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class AddressConfigurationInstance(InstanceResource): - class AutoCreationType(object): WEBHOOK = "webhook" STUDIO = "studio" @@ -354,7 +354,6 @@ def __repr__(self) -> str: class AddressConfigurationContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the AddressConfigurationContext @@ -827,7 +826,6 @@ def __repr__(self) -> str: class AddressConfigurationPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> AddressConfigurationInstance: """ Build an instance of AddressConfigurationInstance @@ -846,7 +844,6 @@ def __repr__(self) -> str: class AddressConfigurationList(ListResource): - def __init__(self, version: Version): """ Initialize the AddressConfigurationList @@ -1549,10 +1546,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AddressConfigurationPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/conversations/v1/configuration/__init__.py b/twilio/rest/conversations/v1/configuration/__init__.py index ec2a73bad..2ebe2bd67 100644 --- a/twilio/rest/conversations/v1/configuration/__init__.py +++ b/twilio/rest/conversations/v1/configuration/__init__.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -24,6 +25,7 @@ class ConfigurationInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this configuration. :ivar default_chat_service_sid: The SID of the default [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) used when creating a conversation. @@ -210,7 +212,6 @@ def __repr__(self) -> str: class ConfigurationContext(InstanceContext): - def __init__(self, version: Version): """ Initialize the ConfigurationContext @@ -484,7 +485,6 @@ def __repr__(self) -> str: class ConfigurationList(ListResource): - def __init__(self, version: Version): """ Initialize the ConfigurationList diff --git a/twilio/rest/conversations/v1/configuration/webhook.py b/twilio/rest/conversations/v1/configuration/webhook.py index d286bba93..7d1b4ec55 100644 --- a/twilio/rest/conversations/v1/configuration/webhook.py +++ b/twilio/rest/conversations/v1/configuration/webhook.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -22,7 +23,6 @@ class WebhookInstance(InstanceResource): - class Method(object): GET = "GET" POST = "POST" @@ -223,7 +223,6 @@ def __repr__(self) -> str: class WebhookContext(InstanceContext): - def __init__(self, version: Version): """ Initialize the WebhookContext @@ -513,7 +512,6 @@ def __repr__(self) -> str: class WebhookList(ListResource): - def __init__(self, version: Version): """ Initialize the WebhookList diff --git a/twilio/rest/conversations/v1/conversation/__init__.py b/twilio/rest/conversations/v1/conversation/__init__.py index 462c6f2cc..6668eb7c9 100644 --- a/twilio/rest/conversations/v1/conversation/__init__.py +++ b/twilio/rest/conversations/v1/conversation/__init__.py @@ -12,6 +12,7 @@ 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 @@ -27,7 +28,6 @@ class ConversationInstance(InstanceResource): - class State(object): INITIALIZING = "initializing" INACTIVE = "inactive" @@ -435,7 +435,6 @@ def __repr__(self) -> str: class ConversationContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the ConversationContext @@ -1036,7 +1035,6 @@ def __repr__(self) -> str: class ConversationPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ConversationInstance: """ Build an instance of ConversationInstance @@ -1055,7 +1053,6 @@ def __repr__(self) -> str: class ConversationList(ListResource): - def __init__(self, version: Version): """ Initialize the ConversationList @@ -1826,10 +1823,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ConversationPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/conversations/v1/conversation/message/__init__.py b/twilio/rest/conversations/v1/conversation/message/__init__.py index b3adff0d6..62448598f 100644 --- a/twilio/rest/conversations/v1/conversation/message/__init__.py +++ b/twilio/rest/conversations/v1/conversation/message/__init__.py @@ -12,6 +12,7 @@ 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 @@ -21,13 +22,15 @@ from twilio.base.list_resource import ListResource from twilio.base.version import Version from twilio.base.page import Page +from twilio.rest.conversations.v1.conversation.message.channel_metadata import ( + ChannelMetadataList, +) from twilio.rest.conversations.v1.conversation.message.delivery_receipt import ( DeliveryReceiptList, ) class MessageInstance(InstanceResource): - class OrderType(object): ASC = "asc" DESC = "desc" @@ -349,6 +352,13 @@ async def update_with_http_info_async( subject=subject, ) + @property + def channel_metadata(self) -> ChannelMetadataList: + """ + Access the channel_metadata + """ + return self._proxy.channel_metadata + @property def delivery_receipts(self) -> DeliveryReceiptList: """ @@ -367,7 +377,6 @@ def __repr__(self) -> str: class MessageContext(InstanceContext): - def __init__(self, version: Version, conversation_sid: str, sid: str): """ Initialize the MessageContext @@ -387,6 +396,7 @@ def __init__(self, version: Version, conversation_sid: str, sid: str): **self._solution ) + self._channel_metadata: Optional[ChannelMetadataList] = None self._delivery_receipts: Optional[DeliveryReceiptList] = None def _delete( @@ -863,6 +873,19 @@ async def update_with_http_info_async( ) return ApiResponse(data=instance, status_code=status_code, headers=headers) + @property + def channel_metadata(self) -> ChannelMetadataList: + """ + Access the channel_metadata + """ + if self._channel_metadata is None: + self._channel_metadata = ChannelMetadataList( + self._version, + self._solution["conversation_sid"], + self._solution["sid"], + ) + return self._channel_metadata + @property def delivery_receipts(self) -> DeliveryReceiptList: """ @@ -887,7 +910,6 @@ def __repr__(self) -> str: class MessagePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> MessageInstance: """ Build an instance of MessageInstance @@ -908,7 +930,6 @@ def __repr__(self) -> str: class MessageList(ListResource): - def __init__(self, version: Version, conversation_sid: str): """ Initialize the MessageList @@ -1582,10 +1603,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = MessagePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/conversations/v1/conversation/message/channel_metadata.py b/twilio/rest/conversations/v1/conversation/message/channel_metadata.py new file mode 100644 index 000000000..917167f02 --- /dev/null +++ b/twilio/rest/conversations/v1/conversation/message/channel_metadata.py @@ -0,0 +1,288 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from typing import Any, Dict, Optional +from twilio.base import values +from twilio.base.api_response import ApiResponse +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 ChannelMetadataInstance(InstanceResource): + + """ + :ivar conversation_sid: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the message metadata. + :ivar message_sid: The unique ID of the [Message](https://www.twilio.com/docs/conversations/api/conversation-message-resource) within a [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) the message metadata belongs to. + :ivar type: The channel that created this metadata object. + :ivar data: The channel specific metadata of the message. The structure and content of the metadata depends on the channel. + :ivar url: The URL of this resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + conversation_sid: str, + message_sid: str, + ): + super().__init__(version) + + self.conversation_sid: Optional[str] = payload.get("conversation_sid") + self.message_sid: Optional[str] = payload.get("message_sid") + self.type: Optional[str] = payload.get("type") + self.data: Optional[Dict[str, object]] = payload.get("data") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "conversation_sid": conversation_sid, + "message_sid": message_sid, + } + self._context: Optional[ChannelMetadataContext] = None + + @property + def _proxy(self) -> "ChannelMetadataContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: ChannelMetadataContext for this ChannelMetadataInstance + """ + if self._context is None: + self._context = ChannelMetadataContext( + self._version, + conversation_sid=self._solution["conversation_sid"], + message_sid=self._solution["message_sid"], + ) + return self._context + + def fetch(self) -> "ChannelMetadataInstance": + """ + Fetch the ChannelMetadataInstance + + + :returns: The fetched ChannelMetadataInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "ChannelMetadataInstance": + """ + Asynchronous coroutine to fetch the ChannelMetadataInstance + + + :returns: The fetched ChannelMetadataInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the ChannelMetadataInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the ChannelMetadataInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_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 ChannelMetadataContext(InstanceContext): + def __init__(self, version: Version, conversation_sid: str, message_sid: str): + """ + Initialize the ChannelMetadataContext + + :param version: Version that contains the resource + :param conversation_sid: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the message metadata. + :param message_sid: The unique ID of the [Message](https://www.twilio.com/docs/conversations/api/conversation-message-resource) within a [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) the message metadata belongs to. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "conversation_sid": conversation_sid, + "message_sid": message_sid, + } + self._uri = "/Conversations/{conversation_sid}/Messages/{message_sid}/ChannelMetadata".format( + **self._solution + ) + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> ChannelMetadataInstance: + """ + Fetch the ChannelMetadataInstance + + + :returns: The fetched ChannelMetadataInstance + """ + payload, _, _ = self._fetch() + return ChannelMetadataInstance( + self._version, + payload, + conversation_sid=self._solution["conversation_sid"], + message_sid=self._solution["message_sid"], + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the ChannelMetadataInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = ChannelMetadataInstance( + self._version, + payload, + conversation_sid=self._solution["conversation_sid"], + message_sid=self._solution["message_sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> ChannelMetadataInstance: + """ + Asynchronous coroutine to fetch the ChannelMetadataInstance + + + :returns: The fetched ChannelMetadataInstance + """ + payload, _, _ = await self._fetch_async() + return ChannelMetadataInstance( + self._version, + payload, + conversation_sid=self._solution["conversation_sid"], + message_sid=self._solution["message_sid"], + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the ChannelMetadataInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = ChannelMetadataInstance( + self._version, + payload, + conversation_sid=self._solution["conversation_sid"], + message_sid=self._solution["message_sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class ChannelMetadataList(ListResource): + def __init__(self, version: Version, conversation_sid: str, message_sid: str): + """ + Initialize the ChannelMetadataList + + :param version: Version that contains the resource + :param conversation_sid: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the message metadata. + :param message_sid: The unique ID of the [Message](https://www.twilio.com/docs/conversations/api/conversation-message-resource) within a [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) the message metadata belongs to. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "conversation_sid": conversation_sid, + "message_sid": message_sid, + } + + def get(self) -> ChannelMetadataContext: + """ + Constructs a ChannelMetadataContext + + """ + return ChannelMetadataContext( + self._version, + conversation_sid=self._solution["conversation_sid"], + message_sid=self._solution["message_sid"], + ) + + def __call__(self) -> ChannelMetadataContext: + """ + Constructs a ChannelMetadataContext + + """ + return ChannelMetadataContext( + self._version, + conversation_sid=self._solution["conversation_sid"], + message_sid=self._solution["message_sid"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/conversations/v1/conversation/message/delivery_receipt.py b/twilio/rest/conversations/v1/conversation/message/delivery_receipt.py index 2b0e1aada..9b27e82f6 100644 --- a/twilio/rest/conversations/v1/conversation/message/delivery_receipt.py +++ b/twilio/rest/conversations/v1/conversation/message/delivery_receipt.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class DeliveryReceiptInstance(InstanceResource): - class DeliveryStatus(object): READ = "read" FAILED = "failed" @@ -145,7 +145,6 @@ def __repr__(self) -> str: class DeliveryReceiptContext(InstanceContext): - def __init__( self, version: Version, conversation_sid: str, message_sid: str, sid: str ): @@ -278,7 +277,6 @@ def __repr__(self) -> str: class DeliveryReceiptPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> DeliveryReceiptInstance: """ Build an instance of DeliveryReceiptInstance @@ -302,7 +300,6 @@ def __repr__(self) -> str: class DeliveryReceiptList(ListResource): - def __init__(self, version: Version, conversation_sid: str, message_sid: str): """ Initialize the DeliveryReceiptList @@ -656,10 +653,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = DeliveryReceiptPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/conversations/v1/conversation/participant.py b/twilio/rest/conversations/v1/conversation/participant.py index c6c31cd54..a9b5a0ae2 100644 --- a/twilio/rest/conversations/v1/conversation/participant.py +++ b/twilio/rest/conversations/v1/conversation/participant.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class ParticipantInstance(InstanceResource): - class WebhookEnabledType(object): TRUE = "true" FALSE = "false" @@ -387,7 +387,6 @@ def __repr__(self) -> str: class ParticipantContext(InstanceContext): - def __init__(self, version: Version, conversation_sid: str, sid: str): """ Initialize the ParticipantContext @@ -940,7 +939,6 @@ def __repr__(self) -> str: class ParticipantPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ParticipantInstance: """ Build an instance of ParticipantInstance @@ -961,7 +959,6 @@ def __repr__(self) -> str: class ParticipantList(ListResource): - def __init__(self, version: Version, conversation_sid: str): """ Initialize the ParticipantList @@ -988,6 +985,7 @@ def _create( identity: Union[str, object] = values.unset, messaging_binding_address: Union[str, object] = values.unset, messaging_binding_proxy_address: Union[str, object] = values.unset, + messaging_binding_proxy_address_fallback: Union[str, object] = values.unset, date_created: Union[datetime, object] = values.unset, date_updated: Union[datetime, object] = values.unset, attributes: Union[str, object] = values.unset, @@ -1006,6 +1004,7 @@ def _create( "Identity": identity, "MessagingBinding.Address": messaging_binding_address, "MessagingBinding.ProxyAddress": messaging_binding_proxy_address, + "MessagingBinding.ProxyAddressFallback": messaging_binding_proxy_address_fallback, "DateCreated": serialize.iso8601_datetime(date_created), "DateUpdated": serialize.iso8601_datetime(date_updated), "Attributes": attributes, @@ -1036,6 +1035,7 @@ def create( identity: Union[str, object] = values.unset, messaging_binding_address: Union[str, object] = values.unset, messaging_binding_proxy_address: Union[str, object] = values.unset, + messaging_binding_proxy_address_fallback: Union[str, object] = values.unset, date_created: Union[datetime, object] = values.unset, date_updated: Union[datetime, object] = values.unset, attributes: Union[str, object] = values.unset, @@ -1049,6 +1049,7 @@ def create( :param identity: A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. :param messaging_binding_address: The address of the participant's device, e.g. a phone or WhatsApp number. Together with the Proxy address, this determines a participant uniquely. This field (with proxy_address) is only null when the participant is interacting from an SDK endpoint (see the 'identity' field). :param messaging_binding_proxy_address: The address of the Twilio phone number (or WhatsApp number) that the participant is in contact with. This field, together with participant address, is only null when the participant is interacting from an SDK endpoint (see the 'identity' field). + :param messaging_binding_proxy_address_fallback: The address of the Twilio phone number to fall back to if it is determined that the Participant is unreachable at messaging_binding.address. Only SMS fallbacks are valid at this time. :param date_created: The date that this resource was created. :param date_updated: The date that this resource was last updated. :param attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. @@ -1062,6 +1063,7 @@ def create( identity=identity, messaging_binding_address=messaging_binding_address, messaging_binding_proxy_address=messaging_binding_proxy_address, + messaging_binding_proxy_address_fallback=messaging_binding_proxy_address_fallback, date_created=date_created, date_updated=date_updated, attributes=attributes, @@ -1080,6 +1082,7 @@ def create_with_http_info( identity: Union[str, object] = values.unset, messaging_binding_address: Union[str, object] = values.unset, messaging_binding_proxy_address: Union[str, object] = values.unset, + messaging_binding_proxy_address_fallback: Union[str, object] = values.unset, date_created: Union[datetime, object] = values.unset, date_updated: Union[datetime, object] = values.unset, attributes: Union[str, object] = values.unset, @@ -1093,6 +1096,7 @@ def create_with_http_info( :param identity: A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. :param messaging_binding_address: The address of the participant's device, e.g. a phone or WhatsApp number. Together with the Proxy address, this determines a participant uniquely. This field (with proxy_address) is only null when the participant is interacting from an SDK endpoint (see the 'identity' field). :param messaging_binding_proxy_address: The address of the Twilio phone number (or WhatsApp number) that the participant is in contact with. This field, together with participant address, is only null when the participant is interacting from an SDK endpoint (see the 'identity' field). + :param messaging_binding_proxy_address_fallback: The address of the Twilio phone number to fall back to if it is determined that the Participant is unreachable at messaging_binding.address. Only SMS fallbacks are valid at this time. :param date_created: The date that this resource was created. :param date_updated: The date that this resource was last updated. :param attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. @@ -1106,6 +1110,7 @@ def create_with_http_info( identity=identity, messaging_binding_address=messaging_binding_address, messaging_binding_proxy_address=messaging_binding_proxy_address, + messaging_binding_proxy_address_fallback=messaging_binding_proxy_address_fallback, date_created=date_created, date_updated=date_updated, attributes=attributes, @@ -1125,6 +1130,7 @@ async def _create_async( identity: Union[str, object] = values.unset, messaging_binding_address: Union[str, object] = values.unset, messaging_binding_proxy_address: Union[str, object] = values.unset, + messaging_binding_proxy_address_fallback: Union[str, object] = values.unset, date_created: Union[datetime, object] = values.unset, date_updated: Union[datetime, object] = values.unset, attributes: Union[str, object] = values.unset, @@ -1143,6 +1149,7 @@ async def _create_async( "Identity": identity, "MessagingBinding.Address": messaging_binding_address, "MessagingBinding.ProxyAddress": messaging_binding_proxy_address, + "MessagingBinding.ProxyAddressFallback": messaging_binding_proxy_address_fallback, "DateCreated": serialize.iso8601_datetime(date_created), "DateUpdated": serialize.iso8601_datetime(date_updated), "Attributes": attributes, @@ -1173,6 +1180,7 @@ async def create_async( identity: Union[str, object] = values.unset, messaging_binding_address: Union[str, object] = values.unset, messaging_binding_proxy_address: Union[str, object] = values.unset, + messaging_binding_proxy_address_fallback: Union[str, object] = values.unset, date_created: Union[datetime, object] = values.unset, date_updated: Union[datetime, object] = values.unset, attributes: Union[str, object] = values.unset, @@ -1186,6 +1194,7 @@ async def create_async( :param identity: A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. :param messaging_binding_address: The address of the participant's device, e.g. a phone or WhatsApp number. Together with the Proxy address, this determines a participant uniquely. This field (with proxy_address) is only null when the participant is interacting from an SDK endpoint (see the 'identity' field). :param messaging_binding_proxy_address: The address of the Twilio phone number (or WhatsApp number) that the participant is in contact with. This field, together with participant address, is only null when the participant is interacting from an SDK endpoint (see the 'identity' field). + :param messaging_binding_proxy_address_fallback: The address of the Twilio phone number to fall back to if it is determined that the Participant is unreachable at messaging_binding.address. Only SMS fallbacks are valid at this time. :param date_created: The date that this resource was created. :param date_updated: The date that this resource was last updated. :param attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. @@ -1199,6 +1208,7 @@ async def create_async( identity=identity, messaging_binding_address=messaging_binding_address, messaging_binding_proxy_address=messaging_binding_proxy_address, + messaging_binding_proxy_address_fallback=messaging_binding_proxy_address_fallback, date_created=date_created, date_updated=date_updated, attributes=attributes, @@ -1217,6 +1227,7 @@ async def create_with_http_info_async( identity: Union[str, object] = values.unset, messaging_binding_address: Union[str, object] = values.unset, messaging_binding_proxy_address: Union[str, object] = values.unset, + messaging_binding_proxy_address_fallback: Union[str, object] = values.unset, date_created: Union[datetime, object] = values.unset, date_updated: Union[datetime, object] = values.unset, attributes: Union[str, object] = values.unset, @@ -1230,6 +1241,7 @@ async def create_with_http_info_async( :param identity: A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. :param messaging_binding_address: The address of the participant's device, e.g. a phone or WhatsApp number. Together with the Proxy address, this determines a participant uniquely. This field (with proxy_address) is only null when the participant is interacting from an SDK endpoint (see the 'identity' field). :param messaging_binding_proxy_address: The address of the Twilio phone number (or WhatsApp number) that the participant is in contact with. This field, together with participant address, is only null when the participant is interacting from an SDK endpoint (see the 'identity' field). + :param messaging_binding_proxy_address_fallback: The address of the Twilio phone number to fall back to if it is determined that the Participant is unreachable at messaging_binding.address. Only SMS fallbacks are valid at this time. :param date_created: The date that this resource was created. :param date_updated: The date that this resource was last updated. :param attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. @@ -1243,6 +1255,7 @@ async def create_with_http_info_async( identity=identity, messaging_binding_address=messaging_binding_address, messaging_binding_proxy_address=messaging_binding_proxy_address, + messaging_binding_proxy_address_fallback=messaging_binding_proxy_address_fallback, date_created=date_created, date_updated=date_updated, attributes=attributes, @@ -1585,10 +1598,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ParticipantPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/conversations/v1/conversation/webhook.py b/twilio/rest/conversations/v1/conversation/webhook.py index 7920fde34..4140e2eda 100644 --- a/twilio/rest/conversations/v1/conversation/webhook.py +++ b/twilio/rest/conversations/v1/conversation/webhook.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class WebhookInstance(InstanceResource): - class Method(object): GET = "get" POST = "post" @@ -280,7 +280,6 @@ def __repr__(self) -> str: class WebhookContext(InstanceContext): - def __init__(self, version: Version, conversation_sid: str, sid: str): """ Initialize the WebhookContext @@ -683,7 +682,6 @@ def __repr__(self) -> str: class WebhookPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> WebhookInstance: """ Build an instance of WebhookInstance @@ -704,7 +702,6 @@ def __repr__(self) -> str: class WebhookList(ListResource): - def __init__(self, version: Version, conversation_sid: str): """ Initialize the WebhookList @@ -1284,10 +1281,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = WebhookPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/conversations/v1/conversation_with_participants.py b/twilio/rest/conversations/v1/conversation_with_participants.py index 76e25061e..10dda4067 100644 --- a/twilio/rest/conversations/v1/conversation_with_participants.py +++ b/twilio/rest/conversations/v1/conversation_with_participants.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, List, Optional, Union from twilio.base import deserialize, serialize, values @@ -23,7 +24,6 @@ class ConversationWithParticipantsInstance(InstanceResource): - class State(object): INITIALIZING = "initializing" INACTIVE = "inactive" @@ -61,9 +61,9 @@ def __init__(self, version: Version, payload: Dict[str, Any]): self.friendly_name: Optional[str] = payload.get("friendly_name") self.unique_name: Optional[str] = payload.get("unique_name") self.attributes: Optional[str] = payload.get("attributes") - self.state: Optional["ConversationWithParticipantsInstance.State"] = ( - payload.get("state") - ) + self.state: Optional[ + "ConversationWithParticipantsInstance.State" + ] = payload.get("state") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) @@ -86,7 +86,6 @@ def __repr__(self) -> str: class ConversationWithParticipantsList(ListResource): - def __init__(self, version: Version): """ Initialize the ConversationWithParticipantsList diff --git a/twilio/rest/conversations/v1/credential.py b/twilio/rest/conversations/v1/credential.py index bd89df32d..bd6fb271a 100644 --- a/twilio/rest/conversations/v1/credential.py +++ b/twilio/rest/conversations/v1/credential.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class CredentialInstance(InstanceResource): - class PushType(object): APN = "apn" GCM = "gcm" @@ -294,7 +294,6 @@ def __repr__(self) -> str: class CredentialContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the CredentialContext @@ -693,7 +692,6 @@ def __repr__(self) -> str: class CredentialPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> CredentialInstance: """ Build an instance of CredentialInstance @@ -712,7 +710,6 @@ def __repr__(self) -> str: class CredentialList(ListResource): - def __init__(self, version: Version): """ Initialize the CredentialList @@ -1269,10 +1266,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CredentialPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/conversations/v1/participant_conversation.py b/twilio/rest/conversations/v1/participant_conversation.py index 4d4f9fd0c..35a32a6fd 100644 --- a/twilio/rest/conversations/v1/participant_conversation.py +++ b/twilio/rest/conversations/v1/participant_conversation.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class ParticipantConversationInstance(InstanceResource): - class State(object): INACTIVE = "inactive" ACTIVE = "active" @@ -70,18 +70,18 @@ def __init__(self, version: Version, payload: Dict[str, Any]): self.conversation_attributes: Optional[str] = payload.get( "conversation_attributes" ) - self.conversation_date_created: Optional[datetime] = ( - deserialize.iso8601_datetime(payload.get("conversation_date_created")) - ) - self.conversation_date_updated: Optional[datetime] = ( - deserialize.iso8601_datetime(payload.get("conversation_date_updated")) - ) + self.conversation_date_created: Optional[ + datetime + ] = deserialize.iso8601_datetime(payload.get("conversation_date_created")) + self.conversation_date_updated: Optional[ + datetime + ] = deserialize.iso8601_datetime(payload.get("conversation_date_updated")) self.conversation_created_by: Optional[str] = payload.get( "conversation_created_by" ) - self.conversation_state: Optional["ParticipantConversationInstance.State"] = ( - payload.get("conversation_state") - ) + self.conversation_state: Optional[ + "ParticipantConversationInstance.State" + ] = payload.get("conversation_state") self.conversation_timers: Optional[Dict[str, object]] = payload.get( "conversation_timers" ) @@ -98,7 +98,6 @@ def __repr__(self) -> str: class ParticipantConversationPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ParticipantConversationInstance: """ Build an instance of ParticipantConversationInstance @@ -117,7 +116,6 @@ def __repr__(self) -> str: class ParticipantConversationList(ListResource): - def __init__(self, version: Version): """ Initialize the ParticipantConversationList @@ -530,10 +528,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ParticipantConversationPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/conversations/v1/role.py b/twilio/rest/conversations/v1/role.py index fd7165ce3..61d91c432 100644 --- a/twilio/rest/conversations/v1/role.py +++ b/twilio/rest/conversations/v1/role.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class RoleInstance(InstanceResource): - class RoleType(object): CONVERSATION = "conversation" SERVICE = "service" @@ -211,7 +211,6 @@ def __repr__(self) -> str: class RoleContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the RoleContext @@ -488,7 +487,6 @@ def __repr__(self) -> str: class RolePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> RoleInstance: """ Build an instance of RoleInstance @@ -507,7 +505,6 @@ def __repr__(self) -> str: class RoleList(ListResource): - def __init__(self, version: Version): """ Initialize the RoleList @@ -974,10 +971,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = RolePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/conversations/v1/service/__init__.py b/twilio/rest/conversations/v1/service/__init__.py index 109637aac..787ddae8d 100644 --- a/twilio/rest/conversations/v1/service/__init__.py +++ b/twilio/rest/conversations/v1/service/__init__.py @@ -12,6 +12,7 @@ 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 @@ -35,6 +36,7 @@ class ServiceInstance(InstanceResource): + """ :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this service. :ivar sid: A 34 character string that uniquely identifies this resource. @@ -214,7 +216,6 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -493,7 +494,6 @@ def __repr__(self) -> str: class ServicePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -512,7 +512,6 @@ def __repr__(self) -> str: class ServiceList(ListResource): - def __init__(self, version: Version): """ Initialize the ServiceList @@ -949,10 +948,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ServicePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/conversations/v1/service/binding.py b/twilio/rest/conversations/v1/service/binding.py index 3ea138330..bf63a0fdf 100644 --- a/twilio/rest/conversations/v1/service/binding.py +++ b/twilio/rest/conversations/v1/service/binding.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class BindingInstance(InstanceResource): - class BindingType(object): APN = "apn" GCM = "gcm" @@ -177,7 +177,6 @@ def __repr__(self) -> str: class BindingContext(InstanceContext): - def __init__(self, version: Version, chat_service_sid: str, sid: str): """ Initialize the BindingContext @@ -370,7 +369,6 @@ def __repr__(self) -> str: class BindingPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> BindingInstance: """ Build an instance of BindingInstance @@ -391,7 +389,6 @@ def __repr__(self) -> str: class BindingList(ListResource): - def __init__(self, version: Version, chat_service_sid: str): """ Initialize the BindingList @@ -809,10 +806,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = BindingPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/conversations/v1/service/configuration/__init__.py b/twilio/rest/conversations/v1/service/configuration/__init__.py index 7c5a50699..9e76c08ae 100644 --- a/twilio/rest/conversations/v1/service/configuration/__init__.py +++ b/twilio/rest/conversations/v1/service/configuration/__init__.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -27,6 +28,7 @@ class ConfigurationInstance(InstanceResource): + """ :ivar chat_service_sid: The unique string that we created to identify the Service configuration resource. :ivar default_conversation_creator_role_sid: The conversation-level role assigned to a conversation creator when they join a new conversation. See [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. @@ -219,7 +221,6 @@ def __repr__(self) -> str: class ConfigurationContext(InstanceContext): - def __init__(self, version: Version, chat_service_sid: str): """ Initialize the ConfigurationContext @@ -516,7 +517,6 @@ def __repr__(self) -> str: class ConfigurationList(ListResource): - def __init__(self, version: Version, chat_service_sid: str): """ Initialize the ConfigurationList diff --git a/twilio/rest/conversations/v1/service/configuration/notification.py b/twilio/rest/conversations/v1/service/configuration/notification.py index 96029c93d..b63908cfe 100644 --- a/twilio/rest/conversations/v1/service/configuration/notification.py +++ b/twilio/rest/conversations/v1/service/configuration/notification.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class NotificationInstance(InstanceResource): + """ :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this configuration. :ivar chat_service_sid: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Configuration applies to. @@ -320,7 +322,6 @@ def __repr__(self) -> str: class NotificationContext(InstanceContext): - def __init__(self, version: Version, chat_service_sid: str): """ Initialize the NotificationContext @@ -773,7 +774,6 @@ def __repr__(self) -> str: class NotificationList(ListResource): - def __init__(self, version: Version, chat_service_sid: str): """ Initialize the NotificationList diff --git a/twilio/rest/conversations/v1/service/configuration/webhook.py b/twilio/rest/conversations/v1/service/configuration/webhook.py index 5b77281c5..8baf4a07a 100644 --- a/twilio/rest/conversations/v1/service/configuration/webhook.py +++ b/twilio/rest/conversations/v1/service/configuration/webhook.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -22,7 +23,6 @@ class WebhookInstance(InstanceResource): - class Method(object): GET = "GET" POST = "POST" @@ -213,7 +213,6 @@ def __repr__(self) -> str: class WebhookContext(InstanceContext): - def __init__(self, version: Version, chat_service_sid: str): """ Initialize the WebhookContext @@ -506,7 +505,6 @@ def __repr__(self) -> str: class WebhookList(ListResource): - def __init__(self, version: Version, chat_service_sid: str): """ Initialize the WebhookList diff --git a/twilio/rest/conversations/v1/service/conversation/__init__.py b/twilio/rest/conversations/v1/service/conversation/__init__.py index b24d53c0c..347517949 100644 --- a/twilio/rest/conversations/v1/service/conversation/__init__.py +++ b/twilio/rest/conversations/v1/service/conversation/__init__.py @@ -12,6 +12,7 @@ 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 @@ -29,7 +30,6 @@ class ConversationInstance(InstanceResource): - class State(object): INACTIVE = "inactive" ACTIVE = "active" @@ -443,7 +443,6 @@ def __repr__(self) -> str: class ConversationContext(InstanceContext): - def __init__(self, version: Version, chat_service_sid: str, sid: str): """ Initialize the ConversationContext @@ -1071,7 +1070,6 @@ def __repr__(self) -> str: class ConversationPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ConversationInstance: """ Build an instance of ConversationInstance @@ -1092,7 +1090,6 @@ def __repr__(self) -> str: class ConversationList(ListResource): - def __init__(self, version: Version, chat_service_sid: str): """ Initialize the ConversationList @@ -1878,10 +1875,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ConversationPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/conversations/v1/service/conversation/message/__init__.py b/twilio/rest/conversations/v1/service/conversation/message/__init__.py index d2f29309c..2f4b4d131 100644 --- a/twilio/rest/conversations/v1/service/conversation/message/__init__.py +++ b/twilio/rest/conversations/v1/service/conversation/message/__init__.py @@ -12,6 +12,7 @@ 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 @@ -21,13 +22,15 @@ from twilio.base.list_resource import ListResource from twilio.base.version import Version from twilio.base.page import Page +from twilio.rest.conversations.v1.service.conversation.message.channel_metadata import ( + ChannelMetadataList, +) from twilio.rest.conversations.v1.service.conversation.message.delivery_receipt import ( DeliveryReceiptList, ) class MessageInstance(InstanceResource): - class OrderType(object): ASC = "asc" DESC = "desc" @@ -354,6 +357,13 @@ async def update_with_http_info_async( subject=subject, ) + @property + def channel_metadata(self) -> ChannelMetadataList: + """ + Access the channel_metadata + """ + return self._proxy.channel_metadata + @property def delivery_receipts(self) -> DeliveryReceiptList: """ @@ -372,7 +382,6 @@ def __repr__(self) -> str: class MessageContext(InstanceContext): - def __init__( self, version: Version, chat_service_sid: str, conversation_sid: str, sid: str ): @@ -396,6 +405,7 @@ def __init__( **self._solution ) + self._channel_metadata: Optional[ChannelMetadataList] = None self._delivery_receipts: Optional[DeliveryReceiptList] = None def _delete( @@ -880,6 +890,20 @@ async def update_with_http_info_async( ) return ApiResponse(data=instance, status_code=status_code, headers=headers) + @property + def channel_metadata(self) -> ChannelMetadataList: + """ + Access the channel_metadata + """ + if self._channel_metadata is None: + self._channel_metadata = ChannelMetadataList( + self._version, + self._solution["chat_service_sid"], + self._solution["conversation_sid"], + self._solution["sid"], + ) + return self._channel_metadata + @property def delivery_receipts(self) -> DeliveryReceiptList: """ @@ -905,7 +929,6 @@ def __repr__(self) -> str: class MessagePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> MessageInstance: """ Build an instance of MessageInstance @@ -929,7 +952,6 @@ def __repr__(self) -> str: class MessageList(ListResource): - def __init__(self, version: Version, chat_service_sid: str, conversation_sid: str): """ Initialize the MessageList @@ -1617,10 +1639,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = MessagePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/conversations/v1/service/conversation/message/channel_metadata.py b/twilio/rest/conversations/v1/service/conversation/message/channel_metadata.py new file mode 100644 index 000000000..d70495a8e --- /dev/null +++ b/twilio/rest/conversations/v1/service/conversation/message/channel_metadata.py @@ -0,0 +1,315 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from typing import Any, Dict, Optional +from twilio.base import values +from twilio.base.api_response import ApiResponse +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 ChannelMetadataInstance(InstanceResource): + + """ + :ivar chat_service_sid: The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the message metadata is associated with. + :ivar conversation_sid: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the message metadata. + :ivar message_sid: The unique ID of the [Message](https://www.twilio.com/docs/conversations/api/conversation-message-resource) within a [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) the message metadata belongs to. + :ivar type: The channel that created this metadata object. + :ivar data: The channel specific metadata of the message. The structure and content of the metadata depends on the channel. + :ivar url: The URL of this resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + chat_service_sid: str, + conversation_sid: str, + message_sid: str, + ): + super().__init__(version) + + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.conversation_sid: Optional[str] = payload.get("conversation_sid") + self.message_sid: Optional[str] = payload.get("message_sid") + self.type: Optional[str] = payload.get("type") + self.data: Optional[Dict[str, object]] = payload.get("data") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "chat_service_sid": chat_service_sid, + "conversation_sid": conversation_sid, + "message_sid": message_sid, + } + self._context: Optional[ChannelMetadataContext] = None + + @property + def _proxy(self) -> "ChannelMetadataContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: ChannelMetadataContext for this ChannelMetadataInstance + """ + if self._context is None: + self._context = ChannelMetadataContext( + self._version, + chat_service_sid=self._solution["chat_service_sid"], + conversation_sid=self._solution["conversation_sid"], + message_sid=self._solution["message_sid"], + ) + return self._context + + def fetch(self) -> "ChannelMetadataInstance": + """ + Fetch the ChannelMetadataInstance + + + :returns: The fetched ChannelMetadataInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "ChannelMetadataInstance": + """ + Asynchronous coroutine to fetch the ChannelMetadataInstance + + + :returns: The fetched ChannelMetadataInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the ChannelMetadataInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the ChannelMetadataInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_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 ChannelMetadataContext(InstanceContext): + def __init__( + self, + version: Version, + chat_service_sid: str, + conversation_sid: str, + message_sid: str, + ): + """ + Initialize the ChannelMetadataContext + + :param version: Version that contains the resource + :param chat_service_sid: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Participant resource is associated with. + :param conversation_sid: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the message metadata. + :param message_sid: The unique ID of the [Message](https://www.twilio.com/docs/conversations/api/conversation-message-resource) within a [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) the message metadata belongs to. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "chat_service_sid": chat_service_sid, + "conversation_sid": conversation_sid, + "message_sid": message_sid, + } + self._uri = "/Services/{chat_service_sid}/Conversations/{conversation_sid}/Messages/{message_sid}/ChannelMetadata".format( + **self._solution + ) + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> ChannelMetadataInstance: + """ + Fetch the ChannelMetadataInstance + + + :returns: The fetched ChannelMetadataInstance + """ + payload, _, _ = self._fetch() + return ChannelMetadataInstance( + self._version, + payload, + chat_service_sid=self._solution["chat_service_sid"], + conversation_sid=self._solution["conversation_sid"], + message_sid=self._solution["message_sid"], + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the ChannelMetadataInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = ChannelMetadataInstance( + self._version, + payload, + chat_service_sid=self._solution["chat_service_sid"], + conversation_sid=self._solution["conversation_sid"], + message_sid=self._solution["message_sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> ChannelMetadataInstance: + """ + Asynchronous coroutine to fetch the ChannelMetadataInstance + + + :returns: The fetched ChannelMetadataInstance + """ + payload, _, _ = await self._fetch_async() + return ChannelMetadataInstance( + self._version, + payload, + chat_service_sid=self._solution["chat_service_sid"], + conversation_sid=self._solution["conversation_sid"], + message_sid=self._solution["message_sid"], + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the ChannelMetadataInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = ChannelMetadataInstance( + self._version, + payload, + chat_service_sid=self._solution["chat_service_sid"], + conversation_sid=self._solution["conversation_sid"], + message_sid=self._solution["message_sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class ChannelMetadataList(ListResource): + def __init__( + self, + version: Version, + chat_service_sid: str, + conversation_sid: str, + message_sid: str, + ): + """ + Initialize the ChannelMetadataList + + :param version: Version that contains the resource + :param chat_service_sid: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Participant resource is associated with. + :param conversation_sid: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the message metadata. + :param message_sid: The unique ID of the [Message](https://www.twilio.com/docs/conversations/api/conversation-message-resource) within a [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) the message metadata belongs to. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "chat_service_sid": chat_service_sid, + "conversation_sid": conversation_sid, + "message_sid": message_sid, + } + + def get(self) -> ChannelMetadataContext: + """ + Constructs a ChannelMetadataContext + + """ + return ChannelMetadataContext( + self._version, + chat_service_sid=self._solution["chat_service_sid"], + conversation_sid=self._solution["conversation_sid"], + message_sid=self._solution["message_sid"], + ) + + def __call__(self) -> ChannelMetadataContext: + """ + Constructs a ChannelMetadataContext + + """ + return ChannelMetadataContext( + self._version, + chat_service_sid=self._solution["chat_service_sid"], + conversation_sid=self._solution["conversation_sid"], + message_sid=self._solution["message_sid"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/conversations/v1/service/conversation/message/delivery_receipt.py b/twilio/rest/conversations/v1/service/conversation/message/delivery_receipt.py index 764c4b294..8665b8394 100644 --- a/twilio/rest/conversations/v1/service/conversation/message/delivery_receipt.py +++ b/twilio/rest/conversations/v1/service/conversation/message/delivery_receipt.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class DeliveryReceiptInstance(InstanceResource): - class DeliveryStatus(object): READ = "read" FAILED = "failed" @@ -150,7 +150,6 @@ def __repr__(self) -> str: class DeliveryReceiptContext(InstanceContext): - def __init__( self, version: Version, @@ -294,7 +293,6 @@ def __repr__(self) -> str: class DeliveryReceiptPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> DeliveryReceiptInstance: """ Build an instance of DeliveryReceiptInstance @@ -319,7 +317,6 @@ def __repr__(self) -> str: class DeliveryReceiptList(ListResource): - def __init__( self, version: Version, @@ -679,10 +676,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = DeliveryReceiptPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/conversations/v1/service/conversation/participant.py b/twilio/rest/conversations/v1/service/conversation/participant.py index 0b35b02ab..b947510c4 100644 --- a/twilio/rest/conversations/v1/service/conversation/participant.py +++ b/twilio/rest/conversations/v1/service/conversation/participant.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class ParticipantInstance(InstanceResource): - class WebhookEnabledType(object): TRUE = "true" FALSE = "false" @@ -392,7 +392,6 @@ def __repr__(self) -> str: class ParticipantContext(InstanceContext): - def __init__( self, version: Version, chat_service_sid: str, conversation_sid: str, sid: str ): @@ -957,7 +956,6 @@ def __repr__(self) -> str: class ParticipantPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ParticipantInstance: """ Build an instance of ParticipantInstance @@ -981,7 +979,6 @@ def __repr__(self) -> str: class ParticipantList(ListResource): - def __init__(self, version: Version, chat_service_sid: str, conversation_sid: str): """ Initialize the ParticipantList @@ -1010,6 +1007,7 @@ def _create( identity: Union[str, object] = values.unset, messaging_binding_address: Union[str, object] = values.unset, messaging_binding_proxy_address: Union[str, object] = values.unset, + messaging_binding_proxy_address_fallback: Union[str, object] = values.unset, date_created: Union[datetime, object] = values.unset, date_updated: Union[datetime, object] = values.unset, attributes: Union[str, object] = values.unset, @@ -1028,6 +1026,7 @@ def _create( "Identity": identity, "MessagingBinding.Address": messaging_binding_address, "MessagingBinding.ProxyAddress": messaging_binding_proxy_address, + "MessagingBinding.ProxyAddressFallback": messaging_binding_proxy_address_fallback, "DateCreated": serialize.iso8601_datetime(date_created), "DateUpdated": serialize.iso8601_datetime(date_updated), "Attributes": attributes, @@ -1058,6 +1057,7 @@ def create( identity: Union[str, object] = values.unset, messaging_binding_address: Union[str, object] = values.unset, messaging_binding_proxy_address: Union[str, object] = values.unset, + messaging_binding_proxy_address_fallback: Union[str, object] = values.unset, date_created: Union[datetime, object] = values.unset, date_updated: Union[datetime, object] = values.unset, attributes: Union[str, object] = values.unset, @@ -1071,6 +1071,7 @@ def create( :param identity: A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the [Conversation SDK](https://www.twilio.com/docs/conversations/sdk-overview) to communicate. Limited to 256 characters. :param messaging_binding_address: The address of the participant's device, e.g. a phone or WhatsApp number. Together with the Proxy address, this determines a participant uniquely. This field (with `proxy_address`) is only null when the participant is interacting from an SDK endpoint (see the `identity` field). :param messaging_binding_proxy_address: The address of the Twilio phone number (or WhatsApp number) that the participant is in contact with. This field, together with participant address, is only null when the participant is interacting from an SDK endpoint (see the `identity` field). + :param messaging_binding_proxy_address_fallback: The address of the Twilio phone number to fall back to if it is determined that the Participant is unreachable at messaging_binding.address. Only SMS fallbacks are valid at this time. :param date_created: The date on which this resource was created. :param date_updated: The date on which this resource was last updated. :param attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set `{}` will be returned. @@ -1084,6 +1085,7 @@ def create( identity=identity, messaging_binding_address=messaging_binding_address, messaging_binding_proxy_address=messaging_binding_proxy_address, + messaging_binding_proxy_address_fallback=messaging_binding_proxy_address_fallback, date_created=date_created, date_updated=date_updated, attributes=attributes, @@ -1105,6 +1107,7 @@ def create_with_http_info( identity: Union[str, object] = values.unset, messaging_binding_address: Union[str, object] = values.unset, messaging_binding_proxy_address: Union[str, object] = values.unset, + messaging_binding_proxy_address_fallback: Union[str, object] = values.unset, date_created: Union[datetime, object] = values.unset, date_updated: Union[datetime, object] = values.unset, attributes: Union[str, object] = values.unset, @@ -1118,6 +1121,7 @@ def create_with_http_info( :param identity: A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the [Conversation SDK](https://www.twilio.com/docs/conversations/sdk-overview) to communicate. Limited to 256 characters. :param messaging_binding_address: The address of the participant's device, e.g. a phone or WhatsApp number. Together with the Proxy address, this determines a participant uniquely. This field (with `proxy_address`) is only null when the participant is interacting from an SDK endpoint (see the `identity` field). :param messaging_binding_proxy_address: The address of the Twilio phone number (or WhatsApp number) that the participant is in contact with. This field, together with participant address, is only null when the participant is interacting from an SDK endpoint (see the `identity` field). + :param messaging_binding_proxy_address_fallback: The address of the Twilio phone number to fall back to if it is determined that the Participant is unreachable at messaging_binding.address. Only SMS fallbacks are valid at this time. :param date_created: The date on which this resource was created. :param date_updated: The date on which this resource was last updated. :param attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set `{}` will be returned. @@ -1131,6 +1135,7 @@ def create_with_http_info( identity=identity, messaging_binding_address=messaging_binding_address, messaging_binding_proxy_address=messaging_binding_proxy_address, + messaging_binding_proxy_address_fallback=messaging_binding_proxy_address_fallback, date_created=date_created, date_updated=date_updated, attributes=attributes, @@ -1153,6 +1158,7 @@ async def _create_async( identity: Union[str, object] = values.unset, messaging_binding_address: Union[str, object] = values.unset, messaging_binding_proxy_address: Union[str, object] = values.unset, + messaging_binding_proxy_address_fallback: Union[str, object] = values.unset, date_created: Union[datetime, object] = values.unset, date_updated: Union[datetime, object] = values.unset, attributes: Union[str, object] = values.unset, @@ -1171,6 +1177,7 @@ async def _create_async( "Identity": identity, "MessagingBinding.Address": messaging_binding_address, "MessagingBinding.ProxyAddress": messaging_binding_proxy_address, + "MessagingBinding.ProxyAddressFallback": messaging_binding_proxy_address_fallback, "DateCreated": serialize.iso8601_datetime(date_created), "DateUpdated": serialize.iso8601_datetime(date_updated), "Attributes": attributes, @@ -1201,6 +1208,7 @@ async def create_async( identity: Union[str, object] = values.unset, messaging_binding_address: Union[str, object] = values.unset, messaging_binding_proxy_address: Union[str, object] = values.unset, + messaging_binding_proxy_address_fallback: Union[str, object] = values.unset, date_created: Union[datetime, object] = values.unset, date_updated: Union[datetime, object] = values.unset, attributes: Union[str, object] = values.unset, @@ -1214,6 +1222,7 @@ async def create_async( :param identity: A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the [Conversation SDK](https://www.twilio.com/docs/conversations/sdk-overview) to communicate. Limited to 256 characters. :param messaging_binding_address: The address of the participant's device, e.g. a phone or WhatsApp number. Together with the Proxy address, this determines a participant uniquely. This field (with `proxy_address`) is only null when the participant is interacting from an SDK endpoint (see the `identity` field). :param messaging_binding_proxy_address: The address of the Twilio phone number (or WhatsApp number) that the participant is in contact with. This field, together with participant address, is only null when the participant is interacting from an SDK endpoint (see the `identity` field). + :param messaging_binding_proxy_address_fallback: The address of the Twilio phone number to fall back to if it is determined that the Participant is unreachable at messaging_binding.address. Only SMS fallbacks are valid at this time. :param date_created: The date on which this resource was created. :param date_updated: The date on which this resource was last updated. :param attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set `{}` will be returned. @@ -1227,6 +1236,7 @@ async def create_async( identity=identity, messaging_binding_address=messaging_binding_address, messaging_binding_proxy_address=messaging_binding_proxy_address, + messaging_binding_proxy_address_fallback=messaging_binding_proxy_address_fallback, date_created=date_created, date_updated=date_updated, attributes=attributes, @@ -1248,6 +1258,7 @@ async def create_with_http_info_async( identity: Union[str, object] = values.unset, messaging_binding_address: Union[str, object] = values.unset, messaging_binding_proxy_address: Union[str, object] = values.unset, + messaging_binding_proxy_address_fallback: Union[str, object] = values.unset, date_created: Union[datetime, object] = values.unset, date_updated: Union[datetime, object] = values.unset, attributes: Union[str, object] = values.unset, @@ -1261,6 +1272,7 @@ async def create_with_http_info_async( :param identity: A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the [Conversation SDK](https://www.twilio.com/docs/conversations/sdk-overview) to communicate. Limited to 256 characters. :param messaging_binding_address: The address of the participant's device, e.g. a phone or WhatsApp number. Together with the Proxy address, this determines a participant uniquely. This field (with `proxy_address`) is only null when the participant is interacting from an SDK endpoint (see the `identity` field). :param messaging_binding_proxy_address: The address of the Twilio phone number (or WhatsApp number) that the participant is in contact with. This field, together with participant address, is only null when the participant is interacting from an SDK endpoint (see the `identity` field). + :param messaging_binding_proxy_address_fallback: The address of the Twilio phone number to fall back to if it is determined that the Participant is unreachable at messaging_binding.address. Only SMS fallbacks are valid at this time. :param date_created: The date on which this resource was created. :param date_updated: The date on which this resource was last updated. :param attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set `{}` will be returned. @@ -1274,6 +1286,7 @@ async def create_with_http_info_async( identity=identity, messaging_binding_address=messaging_binding_address, messaging_binding_proxy_address=messaging_binding_proxy_address, + messaging_binding_proxy_address_fallback=messaging_binding_proxy_address_fallback, date_created=date_created, date_updated=date_updated, attributes=attributes, @@ -1619,10 +1632,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ParticipantPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/conversations/v1/service/conversation/webhook.py b/twilio/rest/conversations/v1/service/conversation/webhook.py index a31545f6e..df1a7b3bb 100644 --- a/twilio/rest/conversations/v1/service/conversation/webhook.py +++ b/twilio/rest/conversations/v1/service/conversation/webhook.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class WebhookInstance(InstanceResource): - class Method(object): GET = "get" POST = "post" @@ -285,7 +285,6 @@ def __repr__(self) -> str: class WebhookContext(InstanceContext): - def __init__( self, version: Version, chat_service_sid: str, conversation_sid: str, sid: str ): @@ -700,7 +699,6 @@ def __repr__(self) -> str: class WebhookPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> WebhookInstance: """ Build an instance of WebhookInstance @@ -724,7 +722,6 @@ def __repr__(self) -> str: class WebhookList(ListResource): - def __init__(self, version: Version, chat_service_sid: str, conversation_sid: str): """ Initialize the WebhookList @@ -1318,10 +1315,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = WebhookPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/conversations/v1/service/conversation_with_participants.py b/twilio/rest/conversations/v1/service/conversation_with_participants.py index b6305a6aa..f83dfb266 100644 --- a/twilio/rest/conversations/v1/service/conversation_with_participants.py +++ b/twilio/rest/conversations/v1/service/conversation_with_participants.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, List, Optional, Union from twilio.base import deserialize, serialize, values @@ -23,7 +24,6 @@ class ConversationWithParticipantsInstance(InstanceResource): - class State(object): INITIALIZING = "initializing" INACTIVE = "inactive" @@ -63,9 +63,9 @@ def __init__( self.friendly_name: Optional[str] = payload.get("friendly_name") self.unique_name: Optional[str] = payload.get("unique_name") self.attributes: Optional[str] = payload.get("attributes") - self.state: Optional["ConversationWithParticipantsInstance.State"] = ( - payload.get("state") - ) + self.state: Optional[ + "ConversationWithParticipantsInstance.State" + ] = payload.get("state") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) @@ -96,7 +96,6 @@ def __repr__(self) -> str: class ConversationWithParticipantsList(ListResource): - def __init__(self, version: Version, chat_service_sid: str): """ Initialize the ConversationWithParticipantsList diff --git a/twilio/rest/conversations/v1/service/participant_conversation.py b/twilio/rest/conversations/v1/service/participant_conversation.py index 4e7935bff..2e6ef670a 100644 --- a/twilio/rest/conversations/v1/service/participant_conversation.py +++ b/twilio/rest/conversations/v1/service/participant_conversation.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class ParticipantConversationInstance(InstanceResource): - class State(object): INACTIVE = "inactive" ACTIVE = "active" @@ -72,18 +72,18 @@ def __init__( self.conversation_attributes: Optional[str] = payload.get( "conversation_attributes" ) - self.conversation_date_created: Optional[datetime] = ( - deserialize.iso8601_datetime(payload.get("conversation_date_created")) - ) - self.conversation_date_updated: Optional[datetime] = ( - deserialize.iso8601_datetime(payload.get("conversation_date_updated")) - ) + self.conversation_date_created: Optional[ + datetime + ] = deserialize.iso8601_datetime(payload.get("conversation_date_created")) + self.conversation_date_updated: Optional[ + datetime + ] = deserialize.iso8601_datetime(payload.get("conversation_date_updated")) self.conversation_created_by: Optional[str] = payload.get( "conversation_created_by" ) - self.conversation_state: Optional["ParticipantConversationInstance.State"] = ( - payload.get("conversation_state") - ) + self.conversation_state: Optional[ + "ParticipantConversationInstance.State" + ] = payload.get("conversation_state") self.conversation_timers: Optional[Dict[str, object]] = payload.get( "conversation_timers" ) @@ -106,7 +106,6 @@ def __repr__(self) -> str: class ParticipantConversationPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ParticipantConversationInstance: """ Build an instance of ParticipantConversationInstance @@ -127,7 +126,6 @@ def __repr__(self) -> str: class ParticipantConversationList(ListResource): - def __init__(self, version: Version, chat_service_sid: str): """ Initialize the ParticipantConversationList @@ -547,10 +545,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ParticipantConversationPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/conversations/v1/service/role.py b/twilio/rest/conversations/v1/service/role.py index 8d0cdfebd..40e071241 100644 --- a/twilio/rest/conversations/v1/service/role.py +++ b/twilio/rest/conversations/v1/service/role.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class RoleInstance(InstanceResource): - class RoleType(object): CONVERSATION = "conversation" SERVICE = "service" @@ -217,7 +217,6 @@ def __repr__(self) -> str: class RoleContext(InstanceContext): - def __init__(self, version: Version, chat_service_sid: str, sid: str): """ Initialize the RoleContext @@ -520,7 +519,6 @@ def __repr__(self) -> str: class RolePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> RoleInstance: """ Build an instance of RoleInstance @@ -541,7 +539,6 @@ def __repr__(self) -> str: class RoleList(ListResource): - def __init__(self, version: Version, chat_service_sid: str): """ Initialize the RoleList @@ -1021,10 +1018,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = RolePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/conversations/v1/service/user/__init__.py b/twilio/rest/conversations/v1/service/user/__init__.py index c1aad8a71..fde008ef6 100644 --- a/twilio/rest/conversations/v1/service/user/__init__.py +++ b/twilio/rest/conversations/v1/service/user/__init__.py @@ -12,6 +12,7 @@ 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 @@ -27,7 +28,6 @@ class UserInstance(InstanceResource): - class WebhookEnabledType(object): TRUE = "true" FALSE = "false" @@ -323,7 +323,6 @@ def __repr__(self) -> str: class UserContext(InstanceContext): - def __init__(self, version: Version, chat_service_sid: str, sid: str): """ Initialize the UserContext @@ -793,7 +792,6 @@ def __repr__(self) -> str: class UserPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> UserInstance: """ Build an instance of UserInstance @@ -814,7 +812,6 @@ def __repr__(self) -> str: class UserList(ListResource): - def __init__(self, version: Version, chat_service_sid: str): """ Initialize the UserList @@ -1372,10 +1369,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = UserPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/conversations/v1/service/user/user_conversation.py b/twilio/rest/conversations/v1/service/user/user_conversation.py index 585ca2adf..31eaff9e5 100644 --- a/twilio/rest/conversations/v1/service/user/user_conversation.py +++ b/twilio/rest/conversations/v1/service/user/user_conversation.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class UserConversationInstance(InstanceResource): - class NotificationLevel(object): DEFAULT = "default" MUTED = "muted" @@ -77,9 +77,9 @@ def __init__( self.participant_sid: Optional[str] = payload.get("participant_sid") self.user_sid: Optional[str] = payload.get("user_sid") self.friendly_name: Optional[str] = payload.get("friendly_name") - self.conversation_state: Optional["UserConversationInstance.State"] = ( - payload.get("conversation_state") - ) + self.conversation_state: Optional[ + "UserConversationInstance.State" + ] = payload.get("conversation_state") self.timers: Optional[Dict[str, object]] = payload.get("timers") self.attributes: Optional[str] = payload.get("attributes") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( @@ -295,7 +295,6 @@ def __repr__(self) -> str: class UserConversationContext(InstanceContext): - def __init__( self, version: Version, @@ -686,7 +685,6 @@ def __repr__(self) -> str: class UserConversationPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> UserConversationInstance: """ Build an instance of UserConversationInstance @@ -710,7 +708,6 @@ def __repr__(self) -> str: class UserConversationList(ListResource): - def __init__(self, version: Version, chat_service_sid: str, user_sid: str): """ Initialize the UserConversationList @@ -1064,10 +1061,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = UserConversationPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/conversations/v1/stats_conversations_ratelimitingerrors.py b/twilio/rest/conversations/v1/stats_conversations_ratelimitingerrors.py new file mode 100644 index 000000000..1b9234b59 --- /dev/null +++ b/twilio/rest/conversations/v1/stats_conversations_ratelimitingerrors.py @@ -0,0 +1,506 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.api_response import ApiResponse + +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 StatsConversationsRatelimitingerrorsInstance(InstanceResource): + class Source(object): + SDK = "SDK" + API = "API" + + """ + :ivar chat_service_sid: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Stats resource is associated with. + :ivar timestamp: The date when particular error has occurred in ISO 8601 format. + :ivar source: + :ivar limit_type: Type of the limit which was hit. Can be api_reads_per_second, sdk_reads_per_second, actions_per_second, etc. + :ivar action: Action which triggered the error. It can be CHANNEL-READ, CHANNEL-CREATE, USER-READ etc. + :ivar sdk_name: Name of the SDK where error has happened. Might be iOS, Android, JavaScript, etc. + :ivar app_name: Customer application name. Field is present only for SDK requests. + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + chat_service_sid: Optional[str] = None, + ): + super().__init__(version) + + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.timestamp: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("timestamp") + ) + self.source: Optional[ + "StatsConversationsRatelimitingerrorsInstance.Source" + ] = payload.get("source") + self.limit_type: Optional[str] = payload.get("limit_type") + self.action: Optional[str] = payload.get("action") + self.sdk_name: Optional[str] = payload.get("sdk_name") + self.app_name: Optional[str] = payload.get("app_name") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "chat_service_sid": chat_service_sid or self.chat_service_sid, + } + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format( + context + ) + + +class StatsConversationsRatelimitingerrorsPage(Page): + def get_instance( + self, payload: Dict[str, Any] + ) -> StatsConversationsRatelimitingerrorsInstance: + """ + Build an instance of StatsConversationsRatelimitingerrorsInstance + + :param payload: Payload response from the API + """ + return StatsConversationsRatelimitingerrorsInstance( + self._version, payload, chat_service_sid=self._solution["chat_service_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class StatsConversationsRatelimitingerrorsList(ListResource): + def __init__(self, version: Version, chat_service_sid: str): + """ + Initialize the StatsConversationsRatelimitingerrorsList + + :param version: Version that contains the resource + :param chat_service_sid: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Stats resource is associated with. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "chat_service_sid": chat_service_sid, + } + self._uri = "/Services/{chat_service_sid}/Stats/Conversations/RateLimitingErrors".format( + **self._solution + ) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[StatsConversationsRatelimitingerrorsInstance]: + """ + Streams StatsConversationsRatelimitingerrorsInstance 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[StatsConversationsRatelimitingerrorsInstance]: + """ + Asynchronously streams StatsConversationsRatelimitingerrorsInstance 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 stream_with_http_info( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams StatsConversationsRatelimitingerrorsInstance and returns headers from first page + + + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info(page_size=limits["page_size"]) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams StatsConversationsRatelimitingerrorsInstance and returns headers from first page + + + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + page_size=limits["page_size"] + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[StatsConversationsRatelimitingerrorsInstance]: + """ + Lists StatsConversationsRatelimitingerrorsInstance 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[StatsConversationsRatelimitingerrorsInstance]: + """ + Asynchronously lists StatsConversationsRatelimitingerrorsInstance 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 list_with_http_info( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists StatsConversationsRatelimitingerrorsInstance and returns headers from first page + + + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists StatsConversationsRatelimitingerrorsInstance and returns headers from first page + + + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> StatsConversationsRatelimitingerrorsPage: + """ + Retrieve a single page of StatsConversationsRatelimitingerrorsInstance 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 StatsConversationsRatelimitingerrorsInstance + """ + 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 StatsConversationsRatelimitingerrorsPage( + 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, + ) -> StatsConversationsRatelimitingerrorsPage: + """ + Asynchronously retrieve a single page of StatsConversationsRatelimitingerrorsInstance 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 StatsConversationsRatelimitingerrorsInstance + """ + 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 StatsConversationsRatelimitingerrorsPage( + self._version, response, self._solution + ) + + def page_with_http_info( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :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: ApiResponse with StatsConversationsRatelimitingerrorsPage, status code, and headers + """ + 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, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = StatsConversationsRatelimitingerrorsPage( + self._version, response, self._solution + ) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :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: ApiResponse with StatsConversationsRatelimitingerrorsPage, status code, and headers + """ + 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, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = StatsConversationsRatelimitingerrorsPage( + self._version, response, self._solution + ) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> StatsConversationsRatelimitingerrorsPage: + """ + Retrieve a specific page of StatsConversationsRatelimitingerrorsInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of StatsConversationsRatelimitingerrorsInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return StatsConversationsRatelimitingerrorsPage( + self._version, response, self._solution + ) + + async def get_page_async( + self, target_url: str + ) -> StatsConversationsRatelimitingerrorsPage: + """ + Asynchronously retrieve a specific page of StatsConversationsRatelimitingerrorsInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of StatsConversationsRatelimitingerrorsInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return StatsConversationsRatelimitingerrorsPage( + self._version, response, self._solution + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/conversations/v1/stats_twilsock_concurrentconnections.py b/twilio/rest/conversations/v1/stats_twilsock_concurrentconnections.py new file mode 100644 index 000000000..24110be24 --- /dev/null +++ b/twilio/rest/conversations/v1/stats_twilsock_concurrentconnections.py @@ -0,0 +1,461 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.api_response import ApiResponse + +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 StatsTwilsockConcurrentconnectionsInstance(InstanceResource): + + """ + :ivar timestamp_per_15min: The date when the max concurrent connection were measured in ISO 8601 format. + :ivar max_concurrent_connections: The maximum count of concurrent connections measured in the 15 minute period. + :ivar url: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.timestamp_per_15min: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("timestamp_per_15min") + ) + self.max_concurrent_connections: Optional[int] = deserialize.integer( + payload.get("max_concurrent_connections") + ) + self.url: Optional[str] = payload.get("url") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class StatsTwilsockConcurrentconnectionsPage(Page): + def get_instance( + self, payload: Dict[str, Any] + ) -> StatsTwilsockConcurrentconnectionsInstance: + """ + Build an instance of StatsTwilsockConcurrentconnectionsInstance + + :param payload: Payload response from the API + """ + return StatsTwilsockConcurrentconnectionsInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class StatsTwilsockConcurrentconnectionsList(ListResource): + def __init__(self, version: Version): + """ + Initialize the StatsTwilsockConcurrentconnectionsList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Stats/Twilsock/ConcurrentConnections" + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[StatsTwilsockConcurrentconnectionsInstance]: + """ + Streams StatsTwilsockConcurrentconnectionsInstance 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[StatsTwilsockConcurrentconnectionsInstance]: + """ + Asynchronously streams StatsTwilsockConcurrentconnectionsInstance 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 stream_with_http_info( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams StatsTwilsockConcurrentconnectionsInstance and returns headers from first page + + + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info(page_size=limits["page_size"]) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams StatsTwilsockConcurrentconnectionsInstance and returns headers from first page + + + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + page_size=limits["page_size"] + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[StatsTwilsockConcurrentconnectionsInstance]: + """ + Lists StatsTwilsockConcurrentconnectionsInstance 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[StatsTwilsockConcurrentconnectionsInstance]: + """ + Asynchronously lists StatsTwilsockConcurrentconnectionsInstance 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 list_with_http_info( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists StatsTwilsockConcurrentconnectionsInstance and returns headers from first page + + + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists StatsTwilsockConcurrentconnectionsInstance and returns headers from first page + + + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> StatsTwilsockConcurrentconnectionsPage: + """ + Retrieve a single page of StatsTwilsockConcurrentconnectionsInstance 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 StatsTwilsockConcurrentconnectionsInstance + """ + 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 StatsTwilsockConcurrentconnectionsPage(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, + ) -> StatsTwilsockConcurrentconnectionsPage: + """ + Asynchronously retrieve a single page of StatsTwilsockConcurrentconnectionsInstance 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 StatsTwilsockConcurrentconnectionsInstance + """ + 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 StatsTwilsockConcurrentconnectionsPage(self._version, response) + + def page_with_http_info( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :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: ApiResponse with StatsTwilsockConcurrentconnectionsPage, status code, and headers + """ + 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, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = StatsTwilsockConcurrentconnectionsPage(self._version, response) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :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: ApiResponse with StatsTwilsockConcurrentconnectionsPage, status code, and headers + """ + 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, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = StatsTwilsockConcurrentconnectionsPage(self._version, response) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> StatsTwilsockConcurrentconnectionsPage: + """ + Retrieve a specific page of StatsTwilsockConcurrentconnectionsInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of StatsTwilsockConcurrentconnectionsInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return StatsTwilsockConcurrentconnectionsPage(self._version, response) + + async def get_page_async( + self, target_url: str + ) -> StatsTwilsockConcurrentconnectionsPage: + """ + Asynchronously retrieve a specific page of StatsTwilsockConcurrentconnectionsInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of StatsTwilsockConcurrentconnectionsInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return StatsTwilsockConcurrentconnectionsPage(self._version, response) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/conversations/v1/stats_twilsock_ratelimitingerrors.py b/twilio/rest/conversations/v1/stats_twilsock_ratelimitingerrors.py new file mode 100644 index 000000000..b133f7dc6 --- /dev/null +++ b/twilio/rest/conversations/v1/stats_twilsock_ratelimitingerrors.py @@ -0,0 +1,471 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.api_response import ApiResponse + +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 StatsTwilsockRatelimitingerrorsInstance(InstanceResource): + class Source(object): + TWILSOCK = "TWILSOCK" + + """ + :ivar timestamp: The date when particular error has occurred in ISO 8601 format. + :ivar source: + :ivar limit_type: Type of the limit which was hit. Can be per_connection etc. + :ivar action: Action which triggered the error. It can be CHANNEL-READ, CHANNEL-CREATE, USER-READ etc. + :ivar sdk_name: Name of the SDK where error has happened. Might be iOS, Android, JavaScript, etc. + :ivar app_name: Customer application name. Field is present only for SDK requests. + :ivar url: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.timestamp: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("timestamp") + ) + self.source: Optional[ + "StatsTwilsockRatelimitingerrorsInstance.Source" + ] = payload.get("source") + self.limit_type: Optional[str] = payload.get("limit_type") + self.action: Optional[str] = payload.get("action") + self.sdk_name: Optional[str] = payload.get("sdk_name") + self.app_name: Optional[str] = payload.get("app_name") + self.url: Optional[str] = payload.get("url") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class StatsTwilsockRatelimitingerrorsPage(Page): + def get_instance( + self, payload: Dict[str, Any] + ) -> StatsTwilsockRatelimitingerrorsInstance: + """ + Build an instance of StatsTwilsockRatelimitingerrorsInstance + + :param payload: Payload response from the API + """ + return StatsTwilsockRatelimitingerrorsInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class StatsTwilsockRatelimitingerrorsList(ListResource): + def __init__(self, version: Version): + """ + Initialize the StatsTwilsockRatelimitingerrorsList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Stats/Twilsock/RateLimitingErrors" + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[StatsTwilsockRatelimitingerrorsInstance]: + """ + Streams StatsTwilsockRatelimitingerrorsInstance 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[StatsTwilsockRatelimitingerrorsInstance]: + """ + Asynchronously streams StatsTwilsockRatelimitingerrorsInstance 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 stream_with_http_info( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams StatsTwilsockRatelimitingerrorsInstance and returns headers from first page + + + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info(page_size=limits["page_size"]) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams StatsTwilsockRatelimitingerrorsInstance and returns headers from first page + + + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + page_size=limits["page_size"] + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[StatsTwilsockRatelimitingerrorsInstance]: + """ + Lists StatsTwilsockRatelimitingerrorsInstance 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[StatsTwilsockRatelimitingerrorsInstance]: + """ + Asynchronously lists StatsTwilsockRatelimitingerrorsInstance 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 list_with_http_info( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists StatsTwilsockRatelimitingerrorsInstance and returns headers from first page + + + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists StatsTwilsockRatelimitingerrorsInstance and returns headers from first page + + + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> StatsTwilsockRatelimitingerrorsPage: + """ + Retrieve a single page of StatsTwilsockRatelimitingerrorsInstance 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 StatsTwilsockRatelimitingerrorsInstance + """ + 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 StatsTwilsockRatelimitingerrorsPage(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, + ) -> StatsTwilsockRatelimitingerrorsPage: + """ + Asynchronously retrieve a single page of StatsTwilsockRatelimitingerrorsInstance 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 StatsTwilsockRatelimitingerrorsInstance + """ + 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 StatsTwilsockRatelimitingerrorsPage(self._version, response) + + def page_with_http_info( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :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: ApiResponse with StatsTwilsockRatelimitingerrorsPage, status code, and headers + """ + 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, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = StatsTwilsockRatelimitingerrorsPage(self._version, response) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :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: ApiResponse with StatsTwilsockRatelimitingerrorsPage, status code, and headers + """ + 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, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = StatsTwilsockRatelimitingerrorsPage(self._version, response) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> StatsTwilsockRatelimitingerrorsPage: + """ + Retrieve a specific page of StatsTwilsockRatelimitingerrorsInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of StatsTwilsockRatelimitingerrorsInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return StatsTwilsockRatelimitingerrorsPage(self._version, response) + + async def get_page_async( + self, target_url: str + ) -> StatsTwilsockRatelimitingerrorsPage: + """ + Asynchronously retrieve a specific page of StatsTwilsockRatelimitingerrorsInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of StatsTwilsockRatelimitingerrorsInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return StatsTwilsockRatelimitingerrorsPage(self._version, response) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/conversations/v1/user/__init__.py b/twilio/rest/conversations/v1/user/__init__.py index 6a857df09..d383f0d4e 100644 --- a/twilio/rest/conversations/v1/user/__init__.py +++ b/twilio/rest/conversations/v1/user/__init__.py @@ -12,6 +12,7 @@ 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 @@ -25,7 +26,6 @@ class UserInstance(InstanceResource): - class WebhookEnabledType(object): TRUE = "true" FALSE = "false" @@ -315,7 +315,6 @@ def __repr__(self) -> str: class UserContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the UserContext @@ -758,7 +757,6 @@ def __repr__(self) -> str: class UserPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> UserInstance: """ Build an instance of UserInstance @@ -777,7 +775,6 @@ def __repr__(self) -> str: class UserList(ListResource): - def __init__(self, version: Version): """ Initialize the UserList @@ -1322,10 +1319,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = UserPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/conversations/v1/user/user_conversation.py b/twilio/rest/conversations/v1/user/user_conversation.py index ad3640b7f..6b06e39b5 100644 --- a/twilio/rest/conversations/v1/user/user_conversation.py +++ b/twilio/rest/conversations/v1/user/user_conversation.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class UserConversationInstance(InstanceResource): - class NotificationLevel(object): DEFAULT = "default" MUTED = "muted" @@ -76,9 +76,9 @@ def __init__( self.participant_sid: Optional[str] = payload.get("participant_sid") self.user_sid: Optional[str] = payload.get("user_sid") self.friendly_name: Optional[str] = payload.get("friendly_name") - self.conversation_state: Optional["UserConversationInstance.State"] = ( - payload.get("conversation_state") - ) + self.conversation_state: Optional[ + "UserConversationInstance.State" + ] = payload.get("conversation_state") self.timers: Optional[Dict[str, object]] = payload.get("timers") self.attributes: Optional[str] = payload.get("attributes") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( @@ -292,7 +292,6 @@ def __repr__(self) -> str: class UserConversationContext(InstanceContext): - def __init__(self, version: Version, user_sid: str, conversation_sid: str): """ Initialize the UserConversationContext @@ -667,7 +666,6 @@ def __repr__(self) -> str: class UserConversationPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> UserConversationInstance: """ Build an instance of UserConversationInstance @@ -688,7 +686,6 @@ def __repr__(self) -> str: class UserConversationList(ListResource): - def __init__(self, version: Version, user_sid: str): """ Initialize the UserConversationList @@ -1036,10 +1033,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = UserConversationPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/conversations/v1/webhook.py b/twilio/rest/conversations/v1/webhook.py new file mode 100644 index 000000000..9748cd055 --- /dev/null +++ b/twilio/rest/conversations/v1/webhook.py @@ -0,0 +1,544 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from typing import Any, Dict, List, Optional, Union +from twilio.base import serialize, values +from twilio.base.api_response import ApiResponse +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 WebhookInstance(InstanceResource): + class Method(object): + GET = "GET" + POST = "POST" + + class Target(object): + WEBHOOK = "webhook" + FLEX = "flex" + + """ + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + :ivar method: + :ivar filters: The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved` + :ivar pre_webhook_url: The absolute url the pre-event webhook request should be sent to. + :ivar post_webhook_url: The absolute url the post-event webhook request should be sent to. + :ivar target: + :ivar url: An absolute API resource URL for this webhook. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.method: Optional["WebhookInstance.Method"] = payload.get("method") + self.filters: Optional[List[str]] = payload.get("filters") + self.pre_webhook_url: Optional[str] = payload.get("pre_webhook_url") + self.post_webhook_url: Optional[str] = payload.get("post_webhook_url") + self.target: Optional["WebhookInstance.Target"] = payload.get("target") + self.url: Optional[str] = payload.get("url") + + self._context: Optional[WebhookContext] = None + + @property + def _proxy(self) -> "WebhookContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: WebhookContext for this WebhookInstance + """ + if self._context is None: + self._context = WebhookContext( + self._version, + ) + return self._context + + def fetch(self) -> "WebhookInstance": + """ + Fetch the WebhookInstance + + + :returns: The fetched WebhookInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "WebhookInstance": + """ + Asynchronous coroutine to fetch the WebhookInstance + + + :returns: The fetched WebhookInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the WebhookInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the WebhookInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_async() + + def update( + self, + method: Union[str, object] = values.unset, + filters: Union[List[str], object] = values.unset, + pre_webhook_url: Union[str, object] = values.unset, + post_webhook_url: Union[str, object] = values.unset, + target: Union["WebhookInstance.Target", object] = values.unset, + ) -> "WebhookInstance": + """ + Update the WebhookInstance + + :param method: The HTTP method to be used when sending a webhook request. + :param filters: The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved` + :param pre_webhook_url: The absolute url the pre-event webhook request should be sent to. + :param post_webhook_url: The absolute url the post-event webhook request should be sent to. + :param target: + + :returns: The updated WebhookInstance + """ + return self._proxy.update( + method=method, + filters=filters, + pre_webhook_url=pre_webhook_url, + post_webhook_url=post_webhook_url, + target=target, + ) + + async def update_async( + self, + method: Union[str, object] = values.unset, + filters: Union[List[str], object] = values.unset, + pre_webhook_url: Union[str, object] = values.unset, + post_webhook_url: Union[str, object] = values.unset, + target: Union["WebhookInstance.Target", object] = values.unset, + ) -> "WebhookInstance": + """ + Asynchronous coroutine to update the WebhookInstance + + :param method: The HTTP method to be used when sending a webhook request. + :param filters: The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved` + :param pre_webhook_url: The absolute url the pre-event webhook request should be sent to. + :param post_webhook_url: The absolute url the post-event webhook request should be sent to. + :param target: + + :returns: The updated WebhookInstance + """ + return await self._proxy.update_async( + method=method, + filters=filters, + pre_webhook_url=pre_webhook_url, + post_webhook_url=post_webhook_url, + target=target, + ) + + def update_with_http_info( + self, + method: Union[str, object] = values.unset, + filters: Union[List[str], object] = values.unset, + pre_webhook_url: Union[str, object] = values.unset, + post_webhook_url: Union[str, object] = values.unset, + target: Union["WebhookInstance.Target", object] = values.unset, + ) -> ApiResponse: + """ + Update the WebhookInstance with HTTP info + + :param method: The HTTP method to be used when sending a webhook request. + :param filters: The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved` + :param pre_webhook_url: The absolute url the pre-event webhook request should be sent to. + :param post_webhook_url: The absolute url the post-event webhook request should be sent to. + :param target: + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.update_with_http_info( + method=method, + filters=filters, + pre_webhook_url=pre_webhook_url, + post_webhook_url=post_webhook_url, + target=target, + ) + + async def update_with_http_info_async( + self, + method: Union[str, object] = values.unset, + filters: Union[List[str], object] = values.unset, + pre_webhook_url: Union[str, object] = values.unset, + post_webhook_url: Union[str, object] = values.unset, + target: Union["WebhookInstance.Target", object] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to update the WebhookInstance with HTTP info + + :param method: The HTTP method to be used when sending a webhook request. + :param filters: The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved` + :param pre_webhook_url: The absolute url the pre-event webhook request should be sent to. + :param post_webhook_url: The absolute url the post-event webhook request should be sent to. + :param target: + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.update_with_http_info_async( + method=method, + filters=filters, + pre_webhook_url=pre_webhook_url, + post_webhook_url=post_webhook_url, + target=target, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class WebhookContext(InstanceContext): + def __init__(self, version: Version): + """ + Initialize the WebhookContext + + :param version: Version that contains the resource + """ + super().__init__(version) + + self._uri = "/Conversations/Webhooks" + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> WebhookInstance: + """ + Fetch the WebhookInstance + + + :returns: The fetched WebhookInstance + """ + payload, _, _ = self._fetch() + return WebhookInstance( + self._version, + payload, + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the WebhookInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = WebhookInstance( + self._version, + payload, + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> WebhookInstance: + """ + Asynchronous coroutine to fetch the WebhookInstance + + + :returns: The fetched WebhookInstance + """ + payload, _, _ = await self._fetch_async() + return WebhookInstance( + self._version, + payload, + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the WebhookInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = WebhookInstance( + self._version, + payload, + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def _update( + self, + method: Union[str, object] = values.unset, + filters: Union[List[str], object] = values.unset, + pre_webhook_url: Union[str, object] = values.unset, + post_webhook_url: Union[str, object] = values.unset, + target: Union["WebhookInstance.Target", object] = values.unset, + ) -> tuple: + """ + Internal helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "Method": method, + "Filters": serialize.map(filters, lambda e: e), + "PreWebhookUrl": pre_webhook_url, + "PostWebhookUrl": post_webhook_url, + "Target": target, + } + ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return self._version.update_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def update( + self, + method: Union[str, object] = values.unset, + filters: Union[List[str], object] = values.unset, + pre_webhook_url: Union[str, object] = values.unset, + post_webhook_url: Union[str, object] = values.unset, + target: Union["WebhookInstance.Target", object] = values.unset, + ) -> WebhookInstance: + """ + Update the WebhookInstance + + :param method: The HTTP method to be used when sending a webhook request. + :param filters: The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved` + :param pre_webhook_url: The absolute url the pre-event webhook request should be sent to. + :param post_webhook_url: The absolute url the post-event webhook request should be sent to. + :param target: + + :returns: The updated WebhookInstance + """ + payload, _, _ = self._update( + method=method, + filters=filters, + pre_webhook_url=pre_webhook_url, + post_webhook_url=post_webhook_url, + target=target, + ) + return WebhookInstance(self._version, payload) + + def update_with_http_info( + self, + method: Union[str, object] = values.unset, + filters: Union[List[str], object] = values.unset, + pre_webhook_url: Union[str, object] = values.unset, + post_webhook_url: Union[str, object] = values.unset, + target: Union["WebhookInstance.Target", object] = values.unset, + ) -> ApiResponse: + """ + Update the WebhookInstance and return response metadata + + :param method: The HTTP method to be used when sending a webhook request. + :param filters: The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved` + :param pre_webhook_url: The absolute url the pre-event webhook request should be sent to. + :param post_webhook_url: The absolute url the post-event webhook request should be sent to. + :param target: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._update( + method=method, + filters=filters, + pre_webhook_url=pre_webhook_url, + post_webhook_url=post_webhook_url, + target=target, + ) + instance = WebhookInstance(self._version, payload) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _update_async( + self, + method: Union[str, object] = values.unset, + filters: Union[List[str], object] = values.unset, + pre_webhook_url: Union[str, object] = values.unset, + post_webhook_url: Union[str, object] = values.unset, + target: Union["WebhookInstance.Target", object] = values.unset, + ) -> tuple: + """ + Internal async helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "Method": method, + "Filters": serialize.map(filters, lambda e: e), + "PreWebhookUrl": pre_webhook_url, + "PostWebhookUrl": post_webhook_url, + "Target": target, + } + ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return await self._version.update_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def update_async( + self, + method: Union[str, object] = values.unset, + filters: Union[List[str], object] = values.unset, + pre_webhook_url: Union[str, object] = values.unset, + post_webhook_url: Union[str, object] = values.unset, + target: Union["WebhookInstance.Target", object] = values.unset, + ) -> WebhookInstance: + """ + Asynchronous coroutine to update the WebhookInstance + + :param method: The HTTP method to be used when sending a webhook request. + :param filters: The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved` + :param pre_webhook_url: The absolute url the pre-event webhook request should be sent to. + :param post_webhook_url: The absolute url the post-event webhook request should be sent to. + :param target: + + :returns: The updated WebhookInstance + """ + payload, _, _ = await self._update_async( + method=method, + filters=filters, + pre_webhook_url=pre_webhook_url, + post_webhook_url=post_webhook_url, + target=target, + ) + return WebhookInstance(self._version, payload) + + async def update_with_http_info_async( + self, + method: Union[str, object] = values.unset, + filters: Union[List[str], object] = values.unset, + pre_webhook_url: Union[str, object] = values.unset, + post_webhook_url: Union[str, object] = values.unset, + target: Union["WebhookInstance.Target", object] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to update the WebhookInstance and return response metadata + + :param method: The HTTP method to be used when sending a webhook request. + :param filters: The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved` + :param pre_webhook_url: The absolute url the pre-event webhook request should be sent to. + :param post_webhook_url: The absolute url the post-event webhook request should be sent to. + :param target: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._update_async( + method=method, + filters=filters, + pre_webhook_url=pre_webhook_url, + post_webhook_url=post_webhook_url, + target=target, + ) + instance = WebhookInstance(self._version, payload) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class WebhookList(ListResource): + def __init__(self, version: Version): + """ + Initialize the WebhookList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self) -> WebhookContext: + """ + Constructs a WebhookContext + + """ + return WebhookContext(self._version) + + def __call__(self) -> WebhookContext: + """ + Constructs a WebhookContext + + """ + return WebhookContext(self._version) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/conversations/v2/__init__.py b/twilio/rest/conversations/v2/__init__.py new file mode 100644 index 000000000..bf83963aa --- /dev/null +++ b/twilio/rest/conversations/v2/__init__.py @@ -0,0 +1,76 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Maestro (Conversations) + Manage configurations, conversations, participants, and communications. Create configurations to define capture rules and channel settings, then use conversations to group related communications. + + 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.conversations.v2.communication import CommunicationList +from twilio.rest.conversations.v2.communication_in_conversation import ( + CommunicationInConversationList, +) +from twilio.rest.conversations.v2.configuration import ConfigurationList +from twilio.rest.conversations.v2.conversation import ConversationList +from twilio.rest.conversations.v2.participant import ParticipantList + + +class V2(Version): + def __init__(self, domain: Domain): + """ + Initialize the V2 version of Conversations + + :param domain: The Twilio.conversations domain + """ + super().__init__(domain, "v2") + self._communications: Optional[CommunicationList] = None + self._communications: Optional[CommunicationInConversationList] = None + self._configurations: Optional[ConfigurationList] = None + self._conversations: Optional[ConversationList] = None + self._participants: Optional[ParticipantList] = None + + @property + def communications(self) -> CommunicationList: + if self._communications is None: + self._communications = CommunicationList(self) + return self._communications + + @property + def communications(self) -> CommunicationInConversationList: + if self._communications is None: + self._communications = CommunicationInConversationList(self) + return self._communications + + @property + def configurations(self) -> ConfigurationList: + if self._configurations is None: + self._configurations = ConfigurationList(self) + return self._configurations + + @property + def conversations(self) -> ConversationList: + if self._conversations is None: + self._conversations = ConversationList(self) + return self._conversations + + @property + def participants(self) -> ParticipantList: + if self._participants is None: + self._participants = ParticipantList(self) + return self._participants + + def __repr__(self) -> str: + """ + Provide a friendly representation + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/conversations/v2/communication.py b/twilio/rest/conversations/v2/communication.py new file mode 100644 index 000000000..4cc4b3973 --- /dev/null +++ b/twilio/rest/conversations/v2/communication.py @@ -0,0 +1,789 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Maestro (Conversations) + Manage configurations, conversations, participants, and communications. Create configurations to define capture rules and channel settings, then use conversations to group related communications. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from datetime import datetime +from typing import Any, Dict, List, Optional, Union +from twilio.base import deserialize, values +from twilio.base.api_response import ApiResponse +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 CommunicationInstance(InstanceResource): + class ContentTranscriptionTranscription(object): + """ + :ivar channel: Audio channel identifier (0 for inbound, 1 for outbound). + :ivar confidence: Overall confidence score for the transcription (0.0-1.0). + :ivar engine: Transcription engine used. + :ivar words: Word-level transcription data with timing information. + """ + + def __init__(self, payload: Dict[str, Any]): + self.channel: Optional[int] = payload.get("channel") + self.confidence: Optional[float] = payload.get("confidence") + self.engine: Optional[str] = payload.get("engine") + self.words: Optional[ + List[CommunicationList.ContentTranscriptionTranscriptionWords] + ] = payload.get("words") + + def to_dict(self): + return { + "channel": self.channel, + "confidence": self.confidence, + "engine": self.engine, + "words": [words.to_dict() for words in self.words] + if self.words is not None + else None, + } + + class ContentTranscriptionTranscriptionWords(object): + """ + :ivar text: The transcribed word. + :ivar start_time: Start timestamp of this word. + :ivar end_time: End timestamp of this word. + """ + + def __init__(self, payload: Dict[str, Any]): + self.text: Optional[str] = payload.get("text") + self.start_time: Optional[datetime] = payload.get("start_time") + self.end_time: Optional[datetime] = payload.get("end_time") + + def to_dict(self): + return { + "text": self.text, + "start_time": self.start_time, + "end_time": self.end_time, + } + + class CreateCommunicationRequest(object): + """ + :ivar conversation_id: Optional. Routes to an existing conversation. If provided, the communication will be sent within this conversation. + :ivar configuration_id: Optional. Used for routing and conversation resolution. If provided without conversationId, the system will resolve or create a conversation based on participant addresses. + :ivar author: + :ivar recipients: The recipients of this communication. + :ivar content: + :ivar channel_id: Optional external reference identifier (e.g., MessageSid, CallSid). + """ + + def __init__(self, payload: Dict[str, Any]): + self.conversation_id: Optional[str] = payload.get("conversation_id") + self.configuration_id: Optional[str] = payload.get("configuration_id") + self.author: Optional[ + CommunicationList.CreateCommunicationRequestAuthor + ] = payload.get("author") + self.recipients: Optional[ + List[CommunicationList.CreateCommunicationRequestAuthor] + ] = payload.get("recipients") + self.content: Optional[ + CommunicationList.CreateCommunicationRequestContent + ] = payload.get("content") + self.channel_id: Optional[str] = payload.get("channel_id") + + def to_dict(self): + return { + "conversation_id": self.conversation_id, + "configuration_id": self.configuration_id, + "author": self.author.to_dict() if self.author is not None else None, + "recipients": [recipients.to_dict() for recipients in self.recipients] + if self.recipients is not None + else None, + "content": self.content.to_dict() if self.content is not None else None, + "channel_id": self.channel_id, + } + + class CreateCommunicationRequestAuthor(object): + """ + :ivar address: The address value formatted according to channel type: - SMS: E.164 phone number (such as \"+18005550100\") - WHATSAPP: Phone number with whatsapp prefix (such as \"whatsapp:+18005550100\") - RCS: Sender ID or phone number with rcs prefix (such as \"rcs:brand_acme_agent\" or \"rcs:+18005550100\") - CHAT: Customer-defined string identifier + :ivar channel: Channel type for sending communications. Note: VOICE is receive-only and not supported for send operations. + :ivar participant_id: Optional Participant ID. If omitted, the system will resolve or create the participant based on address and channel. + """ + + def __init__(self, payload: Dict[str, Any]): + self.address: Optional[str] = payload.get("address") + self.channel: Optional["CommunicationInstance.str"] = payload.get("channel") + self.participant_id: Optional[str] = payload.get("participant_id") + + def to_dict(self): + return { + "address": self.address, + "channel": self.channel, + "participant_id": self.participant_id, + } + + class CreateCommunicationRequestContent(object): + """ + :ivar type: Content type discriminator. + :ivar text: Transcribed text. + :ivar transcription: + """ + + def __init__(self, payload: Dict[str, Any]): + self.type: Optional["CommunicationInstance.str"] = payload.get("type") + self.text: Optional[str] = payload.get("text") + self.transcription: Optional[ + CommunicationList.ContentTranscriptionTranscription + ] = payload.get("transcription") + + def to_dict(self): + return { + "type": self.type, + "text": self.text, + "transcription": self.transcription.to_dict() + if self.transcription is not None + else None, + } + + """ + :ivar message: Status message indicating the request was accepted. + :ivar conversation_id: The ID of the conversation (may be newly created). + :ivar communication_id: The ID of the created communication, if available. May be absent when endpoint performs setup-only without persisting a communication record. + :ivar channel_id: Channel-specific message ID if available (e.g., MessageSid from messaging adapter). + :ivar id: Communication ID. + :ivar account_id: Account ID. + :ivar author: + :ivar content: + :ivar recipients: Communication recipients. + :ivar created_at: Timestamp when this Communication was created. + :ivar updated_at: Timestamp when this Communication was last updated. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + conversation_sid: Optional[str] = None, + sid: Optional[str] = None, + ): + super().__init__(version) + + self.message: Optional[str] = payload.get("message") + self.conversation_id: Optional[str] = payload.get("conversationId") + self.communication_id: Optional[str] = payload.get("communicationId") + self.channel_id: Optional[str] = payload.get("channelId") + self.id: Optional[str] = payload.get("id") + self.account_id: Optional[str] = payload.get("accountId") + self.author: Optional[str] = payload.get("author") + self.content: Optional[str] = payload.get("content") + self.recipients: Optional[List[str]] = payload.get("recipients") + self.created_at: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("createdAt") + ) + self.updated_at: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("updatedAt") + ) + + self._solution = { + "conversation_sid": conversation_sid or self.conversation_sid, + "sid": sid or self.sid, + } + self._context: Optional[CommunicationContext] = None + + @property + def _proxy(self) -> "CommunicationContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: CommunicationContext for this CommunicationInstance + """ + if self._context is None: + self._context = CommunicationContext( + self._version, + conversation_sid=self._solution["conversation_sid"], + sid=self._solution["sid"], + ) + return self._context + + def fetch(self) -> "CommunicationInstance": + """ + Fetch the CommunicationInstance + + + :returns: The fetched CommunicationInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "CommunicationInstance": + """ + Asynchronous coroutine to fetch the CommunicationInstance + + + :returns: The fetched CommunicationInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the CommunicationInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the CommunicationInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_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 CommunicationContext(InstanceContext): + class ContentTranscriptionTranscription(object): + """ + :ivar channel: Audio channel identifier (0 for inbound, 1 for outbound). + :ivar confidence: Overall confidence score for the transcription (0.0-1.0). + :ivar engine: Transcription engine used. + :ivar words: Word-level transcription data with timing information. + """ + + def __init__(self, payload: Dict[str, Any]): + self.channel: Optional[int] = payload.get("channel") + self.confidence: Optional[float] = payload.get("confidence") + self.engine: Optional[str] = payload.get("engine") + self.words: Optional[ + List[CommunicationList.ContentTranscriptionTranscriptionWords] + ] = payload.get("words") + + def to_dict(self): + return { + "channel": self.channel, + "confidence": self.confidence, + "engine": self.engine, + "words": [words.to_dict() for words in self.words] + if self.words is not None + else None, + } + + class ContentTranscriptionTranscriptionWords(object): + """ + :ivar text: The transcribed word. + :ivar start_time: Start timestamp of this word. + :ivar end_time: End timestamp of this word. + """ + + def __init__(self, payload: Dict[str, Any]): + self.text: Optional[str] = payload.get("text") + self.start_time: Optional[datetime] = payload.get("start_time") + self.end_time: Optional[datetime] = payload.get("end_time") + + def to_dict(self): + return { + "text": self.text, + "start_time": self.start_time, + "end_time": self.end_time, + } + + class CreateCommunicationRequest(object): + """ + :ivar conversation_id: Optional. Routes to an existing conversation. If provided, the communication will be sent within this conversation. + :ivar configuration_id: Optional. Used for routing and conversation resolution. If provided without conversationId, the system will resolve or create a conversation based on participant addresses. + :ivar author: + :ivar recipients: The recipients of this communication. + :ivar content: + :ivar channel_id: Optional external reference identifier (e.g., MessageSid, CallSid). + """ + + def __init__(self, payload: Dict[str, Any]): + self.conversation_id: Optional[str] = payload.get("conversation_id") + self.configuration_id: Optional[str] = payload.get("configuration_id") + self.author: Optional[ + CommunicationList.CreateCommunicationRequestAuthor + ] = payload.get("author") + self.recipients: Optional[ + List[CommunicationList.CreateCommunicationRequestAuthor] + ] = payload.get("recipients") + self.content: Optional[ + CommunicationList.CreateCommunicationRequestContent + ] = payload.get("content") + self.channel_id: Optional[str] = payload.get("channel_id") + + def to_dict(self): + return { + "conversation_id": self.conversation_id, + "configuration_id": self.configuration_id, + "author": self.author.to_dict() if self.author is not None else None, + "recipients": [recipients.to_dict() for recipients in self.recipients] + if self.recipients is not None + else None, + "content": self.content.to_dict() if self.content is not None else None, + "channel_id": self.channel_id, + } + + class CreateCommunicationRequestAuthor(object): + """ + :ivar address: The address value formatted according to channel type: - SMS: E.164 phone number (such as \"+18005550100\") - WHATSAPP: Phone number with whatsapp prefix (such as \"whatsapp:+18005550100\") - RCS: Sender ID or phone number with rcs prefix (such as \"rcs:brand_acme_agent\" or \"rcs:+18005550100\") - CHAT: Customer-defined string identifier + :ivar channel: Channel type for sending communications. Note: VOICE is receive-only and not supported for send operations. + :ivar participant_id: Optional Participant ID. If omitted, the system will resolve or create the participant based on address and channel. + """ + + def __init__(self, payload: Dict[str, Any]): + self.address: Optional[str] = payload.get("address") + self.channel: Optional["CommunicationInstance.str"] = payload.get("channel") + self.participant_id: Optional[str] = payload.get("participant_id") + + def to_dict(self): + return { + "address": self.address, + "channel": self.channel, + "participant_id": self.participant_id, + } + + class CreateCommunicationRequestContent(object): + """ + :ivar type: Content type discriminator. + :ivar text: Transcribed text. + :ivar transcription: + """ + + def __init__(self, payload: Dict[str, Any]): + self.type: Optional["CommunicationInstance.str"] = payload.get("type") + self.text: Optional[str] = payload.get("text") + self.transcription: Optional[ + CommunicationList.ContentTranscriptionTranscription + ] = payload.get("transcription") + + def to_dict(self): + return { + "type": self.type, + "text": self.text, + "transcription": self.transcription.to_dict() + if self.transcription is not None + else None, + } + + def __init__(self, version: Version, conversation_sid: str, sid: str): + """ + Initialize the CommunicationContext + + :param version: Version that contains the resource + :param conversation_sid: + :param sid: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "conversation_sid": conversation_sid, + "sid": sid, + } + self._uri = "/Conversations/{conversation_sid}/Communications/{sid}".format( + **self._solution + ) + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> CommunicationInstance: + """ + Fetch the CommunicationInstance + + + :returns: The fetched CommunicationInstance + """ + payload, _, _ = self._fetch() + return CommunicationInstance( + self._version, + payload, + conversation_sid=self._solution["conversation_sid"], + sid=self._solution["sid"], + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the CommunicationInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = CommunicationInstance( + self._version, + payload, + conversation_sid=self._solution["conversation_sid"], + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> CommunicationInstance: + """ + Asynchronous coroutine to fetch the CommunicationInstance + + + :returns: The fetched CommunicationInstance + """ + payload, _, _ = await self._fetch_async() + return CommunicationInstance( + self._version, + payload, + conversation_sid=self._solution["conversation_sid"], + sid=self._solution["sid"], + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the CommunicationInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = CommunicationInstance( + self._version, + payload, + conversation_sid=self._solution["conversation_sid"], + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class CommunicationList(ListResource): + class ContentTranscriptionTranscription(object): + """ + :ivar channel: Audio channel identifier (0 for inbound, 1 for outbound). + :ivar confidence: Overall confidence score for the transcription (0.0-1.0). + :ivar engine: Transcription engine used. + :ivar words: Word-level transcription data with timing information. + """ + + def __init__(self, payload: Dict[str, Any]): + self.channel: Optional[int] = payload.get("channel") + self.confidence: Optional[float] = payload.get("confidence") + self.engine: Optional[str] = payload.get("engine") + self.words: Optional[ + List[CommunicationList.ContentTranscriptionTranscriptionWords] + ] = payload.get("words") + + def to_dict(self): + return { + "channel": self.channel, + "confidence": self.confidence, + "engine": self.engine, + "words": [words.to_dict() for words in self.words] + if self.words is not None + else None, + } + + class ContentTranscriptionTranscriptionWords(object): + """ + :ivar text: The transcribed word. + :ivar start_time: Start timestamp of this word. + :ivar end_time: End timestamp of this word. + """ + + def __init__(self, payload: Dict[str, Any]): + self.text: Optional[str] = payload.get("text") + self.start_time: Optional[datetime] = payload.get("start_time") + self.end_time: Optional[datetime] = payload.get("end_time") + + def to_dict(self): + return { + "text": self.text, + "start_time": self.start_time, + "end_time": self.end_time, + } + + class CreateCommunicationRequest(object): + """ + :ivar conversation_id: Optional. Routes to an existing conversation. If provided, the communication will be sent within this conversation. + :ivar configuration_id: Optional. Used for routing and conversation resolution. If provided without conversationId, the system will resolve or create a conversation based on participant addresses. + :ivar author: + :ivar recipients: The recipients of this communication. + :ivar content: + :ivar channel_id: Optional external reference identifier (e.g., MessageSid, CallSid). + """ + + def __init__(self, payload: Dict[str, Any]): + self.conversation_id: Optional[str] = payload.get("conversation_id") + self.configuration_id: Optional[str] = payload.get("configuration_id") + self.author: Optional[ + CommunicationList.CreateCommunicationRequestAuthor + ] = payload.get("author") + self.recipients: Optional[ + List[CommunicationList.CreateCommunicationRequestAuthor] + ] = payload.get("recipients") + self.content: Optional[ + CommunicationList.CreateCommunicationRequestContent + ] = payload.get("content") + self.channel_id: Optional[str] = payload.get("channel_id") + + def to_dict(self): + return { + "conversation_id": self.conversation_id, + "configuration_id": self.configuration_id, + "author": self.author.to_dict() if self.author is not None else None, + "recipients": [recipients.to_dict() for recipients in self.recipients] + if self.recipients is not None + else None, + "content": self.content.to_dict() if self.content is not None else None, + "channel_id": self.channel_id, + } + + class CreateCommunicationRequestAuthor(object): + """ + :ivar address: The address value formatted according to channel type: - SMS: E.164 phone number (such as \"+18005550100\") - WHATSAPP: Phone number with whatsapp prefix (such as \"whatsapp:+18005550100\") - RCS: Sender ID or phone number with rcs prefix (such as \"rcs:brand_acme_agent\" or \"rcs:+18005550100\") - CHAT: Customer-defined string identifier + :ivar channel: Channel type for sending communications. Note: VOICE is receive-only and not supported for send operations. + :ivar participant_id: Optional Participant ID. If omitted, the system will resolve or create the participant based on address and channel. + """ + + def __init__(self, payload: Dict[str, Any]): + self.address: Optional[str] = payload.get("address") + self.channel: Optional["CommunicationInstance.str"] = payload.get("channel") + self.participant_id: Optional[str] = payload.get("participant_id") + + def to_dict(self): + return { + "address": self.address, + "channel": self.channel, + "participant_id": self.participant_id, + } + + class CreateCommunicationRequestContent(object): + """ + :ivar type: Content type discriminator. + :ivar text: Transcribed text. + :ivar transcription: + """ + + def __init__(self, payload: Dict[str, Any]): + self.type: Optional["CommunicationInstance.str"] = payload.get("type") + self.text: Optional[str] = payload.get("text") + self.transcription: Optional[ + CommunicationList.ContentTranscriptionTranscription + ] = payload.get("transcription") + + def to_dict(self): + return { + "type": self.type, + "text": self.text, + "transcription": self.transcription.to_dict() + if self.transcription is not None + else None, + } + + def __init__(self, version: Version): + """ + Initialize the CommunicationList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Communications" + + def _create( + self, + create_communication_request: Union[ + CreateCommunicationRequest, object + ] = values.unset, + ) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = create_communication_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, + create_communication_request: Union[ + CreateCommunicationRequest, object + ] = values.unset, + ) -> CommunicationInstance: + """ + Create the CommunicationInstance + + :param create_communication_request: The communication to send + + :returns: The created CommunicationInstance + """ + payload, _, _ = self._create( + create_communication_request=create_communication_request + ) + return CommunicationInstance(self._version, payload) + + def create_with_http_info( + self, + create_communication_request: Union[ + CreateCommunicationRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Create the CommunicationInstance and return response metadata + + :param create_communication_request: The communication to send + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create( + create_communication_request=create_communication_request + ) + instance = CommunicationInstance(self._version, payload) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async( + self, + create_communication_request: Union[ + CreateCommunicationRequest, object + ] = values.unset, + ) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = create_communication_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, + create_communication_request: Union[ + CreateCommunicationRequest, object + ] = values.unset, + ) -> CommunicationInstance: + """ + Asynchronously create the CommunicationInstance + + :param create_communication_request: The communication to send + + :returns: The created CommunicationInstance + """ + payload, _, _ = await self._create_async( + create_communication_request=create_communication_request + ) + return CommunicationInstance(self._version, payload) + + async def create_with_http_info_async( + self, + create_communication_request: Union[ + CreateCommunicationRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Asynchronously create the CommunicationInstance and return response metadata + + :param create_communication_request: The communication to send + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + create_communication_request=create_communication_request + ) + instance = CommunicationInstance(self._version, payload) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def get(self, conversation_sid: str, sid: str) -> CommunicationContext: + """ + Constructs a CommunicationContext + + :param conversation_sid: + :param sid: + """ + return CommunicationContext( + self._version, conversation_sid=conversation_sid, sid=sid + ) + + def __call__(self, conversation_sid: str, sid: str) -> CommunicationContext: + """ + Constructs a CommunicationContext + + :param conversation_sid: + :param sid: + """ + return CommunicationContext( + self._version, conversation_sid=conversation_sid, sid=sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/conversations/v2/communication_in_conversation.py b/twilio/rest/conversations/v2/communication_in_conversation.py new file mode 100644 index 000000000..ee30f479f --- /dev/null +++ b/twilio/rest/conversations/v2/communication_in_conversation.py @@ -0,0 +1,942 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Maestro (Conversations) + Manage configurations, conversations, participants, and communications. Create configurations to define capture rules and channel settings, then use conversations to group related communications. + + 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.api_response import ApiResponse + +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 CommunicationInConversationInstance(InstanceResource): + class ContentTranscription1Transcription(object): + """ + :ivar channel: + :ivar confidence: + :ivar engine: + """ + + def __init__(self, payload: Dict[str, Any]): + self.channel: Optional[int] = payload.get("channel") + self.confidence: Optional[float] = payload.get("confidence") + self.engine: Optional[str] = payload.get("engine") + + def to_dict(self): + return { + "channel": self.channel, + "confidence": self.confidence, + "engine": self.engine, + } + + class ContentTranscriptionTranscription(object): + """ + :ivar channel: Audio channel identifier (0 for inbound, 1 for outbound). + :ivar confidence: Overall confidence score for the transcription (0.0-1.0). + :ivar engine: Transcription engine used. + :ivar words: Word-level transcription data with timing information. + """ + + def __init__(self, payload: Dict[str, Any]): + self.channel: Optional[int] = payload.get("channel") + self.confidence: Optional[float] = payload.get("confidence") + self.engine: Optional[str] = payload.get("engine") + self.words: Optional[ + List[CommunicationList.ContentTranscriptionTranscriptionWords] + ] = payload.get("words") + + def to_dict(self): + return { + "channel": self.channel, + "confidence": self.confidence, + "engine": self.engine, + "words": [words.to_dict() for words in self.words] + if self.words is not None + else None, + } + + class ContentTranscriptionTranscriptionWords(object): + """ + :ivar text: The transcribed word. + :ivar start_time: Start timestamp of this word. + :ivar end_time: End timestamp of this word. + """ + + def __init__(self, payload: Dict[str, Any]): + self.text: Optional[str] = payload.get("text") + self.start_time: Optional[datetime] = payload.get("start_time") + self.end_time: Optional[datetime] = payload.get("end_time") + + def to_dict(self): + return { + "text": self.text, + "start_time": self.start_time, + "end_time": self.end_time, + } + + class CreateCommunicationInConversationRequest(object): + """ + :ivar author: + :ivar content: + :ivar channel_id: + :ivar recipients: + """ + + def __init__(self, payload: Dict[str, Any]): + self.author: Optional[ + CommunicationInConversationList.CreateCommunicationInConversationRequestAuthor + ] = payload.get("author") + self.content: Optional[ + CommunicationInConversationList.CreateCommunicationInConversationRequestContent + ] = payload.get("content") + self.channel_id: Optional[str] = payload.get("channel_id") + self.recipients: Optional[ + List[ + CommunicationInConversationList.CreateCommunicationInConversationRequestAuthor + ] + ] = payload.get("recipients") + + def to_dict(self): + return { + "author": self.author.to_dict() if self.author is not None else None, + "content": self.content.to_dict() if self.content is not None else None, + "channel_id": self.channel_id, + "recipients": [recipients.to_dict() for recipients in self.recipients] + if self.recipients is not None + else None, + } + + class CreateCommunicationInConversationRequestAuthor(object): + """ + :ivar address: + :ivar channel: + :ivar participant_id: + """ + + def __init__(self, payload: Dict[str, Any]): + self.address: Optional[str] = payload.get("address") + self.channel: Optional[ + "CommunicationInConversationInstance.str" + ] = payload.get("channel") + self.participant_id: Optional[str] = payload.get("participant_id") + + def to_dict(self): + return { + "address": self.address, + "channel": self.channel, + "participant_id": self.participant_id, + } + + class CreateCommunicationInConversationRequestContent(object): + """ + :ivar type: + :ivar text: + :ivar transcription: + """ + + def __init__(self, payload: Dict[str, Any]): + self.type: Optional[ + "CommunicationInConversationInstance.str" + ] = payload.get("type") + self.text: Optional[str] = payload.get("text") + self.transcription: Optional[ + CommunicationInConversationList.ContentTranscription1Transcription + ] = payload.get("transcription") + + def to_dict(self): + return { + "type": self.type, + "text": self.text, + "transcription": self.transcription.to_dict() + if self.transcription is not None + else None, + } + + """ + :ivar id: Communication ID. + :ivar conversation_id: Conversation ID. + :ivar account_id: Account ID. + :ivar author: + :ivar content: + :ivar channel_id: Channel-specific reference ID. + :ivar recipients: Communication recipients. + :ivar created_at: Timestamp when this Communication was created. + :ivar updated_at: Timestamp when this Communication was last updated. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + conversation_sid: Optional[str] = None, + ): + super().__init__(version) + + self.id: Optional[str] = payload.get("id") + self.conversation_id: Optional[str] = payload.get("conversationId") + self.account_id: Optional[str] = payload.get("accountId") + self.author: Optional[str] = payload.get("author") + self.content: Optional[str] = payload.get("content") + self.channel_id: Optional[str] = payload.get("channelId") + self.recipients: Optional[List[str]] = payload.get("recipients") + self.created_at: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("createdAt") + ) + self.updated_at: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("updatedAt") + ) + + self._solution = { + "conversation_sid": conversation_sid or self.conversation_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 CommunicationInConversationPage(Page): + def get_instance( + self, payload: Dict[str, Any] + ) -> CommunicationInConversationInstance: + """ + Build an instance of CommunicationInConversationInstance + + :param payload: Payload response from the API + """ + return CommunicationInConversationInstance( + self._version, payload, conversation_sid=self._solution["conversation_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class CommunicationInConversationList(ListResource): + class ContentTranscription1Transcription(object): + """ + :ivar channel: + :ivar confidence: + :ivar engine: + """ + + def __init__(self, payload: Dict[str, Any]): + self.channel: Optional[int] = payload.get("channel") + self.confidence: Optional[float] = payload.get("confidence") + self.engine: Optional[str] = payload.get("engine") + + def to_dict(self): + return { + "channel": self.channel, + "confidence": self.confidence, + "engine": self.engine, + } + + class ContentTranscriptionTranscription(object): + """ + :ivar channel: Audio channel identifier (0 for inbound, 1 for outbound). + :ivar confidence: Overall confidence score for the transcription (0.0-1.0). + :ivar engine: Transcription engine used. + :ivar words: Word-level transcription data with timing information. + """ + + def __init__(self, payload: Dict[str, Any]): + self.channel: Optional[int] = payload.get("channel") + self.confidence: Optional[float] = payload.get("confidence") + self.engine: Optional[str] = payload.get("engine") + self.words: Optional[ + List[CommunicationList.ContentTranscriptionTranscriptionWords] + ] = payload.get("words") + + def to_dict(self): + return { + "channel": self.channel, + "confidence": self.confidence, + "engine": self.engine, + "words": [words.to_dict() for words in self.words] + if self.words is not None + else None, + } + + class ContentTranscriptionTranscriptionWords(object): + """ + :ivar text: The transcribed word. + :ivar start_time: Start timestamp of this word. + :ivar end_time: End timestamp of this word. + """ + + def __init__(self, payload: Dict[str, Any]): + self.text: Optional[str] = payload.get("text") + self.start_time: Optional[datetime] = payload.get("start_time") + self.end_time: Optional[datetime] = payload.get("end_time") + + def to_dict(self): + return { + "text": self.text, + "start_time": self.start_time, + "end_time": self.end_time, + } + + class CreateCommunicationInConversationRequest(object): + """ + :ivar author: + :ivar content: + :ivar channel_id: + :ivar recipients: + """ + + def __init__(self, payload: Dict[str, Any]): + self.author: Optional[ + CommunicationInConversationList.CreateCommunicationInConversationRequestAuthor + ] = payload.get("author") + self.content: Optional[ + CommunicationInConversationList.CreateCommunicationInConversationRequestContent + ] = payload.get("content") + self.channel_id: Optional[str] = payload.get("channel_id") + self.recipients: Optional[ + List[ + CommunicationInConversationList.CreateCommunicationInConversationRequestAuthor + ] + ] = payload.get("recipients") + + def to_dict(self): + return { + "author": self.author.to_dict() if self.author is not None else None, + "content": self.content.to_dict() if self.content is not None else None, + "channel_id": self.channel_id, + "recipients": [recipients.to_dict() for recipients in self.recipients] + if self.recipients is not None + else None, + } + + class CreateCommunicationInConversationRequestAuthor(object): + """ + :ivar address: + :ivar channel: + :ivar participant_id: + """ + + def __init__(self, payload: Dict[str, Any]): + self.address: Optional[str] = payload.get("address") + self.channel: Optional[ + "CommunicationInConversationInstance.str" + ] = payload.get("channel") + self.participant_id: Optional[str] = payload.get("participant_id") + + def to_dict(self): + return { + "address": self.address, + "channel": self.channel, + "participant_id": self.participant_id, + } + + class CreateCommunicationInConversationRequestContent(object): + """ + :ivar type: + :ivar text: + :ivar transcription: + """ + + def __init__(self, payload: Dict[str, Any]): + self.type: Optional[ + "CommunicationInConversationInstance.str" + ] = payload.get("type") + self.text: Optional[str] = payload.get("text") + self.transcription: Optional[ + CommunicationInConversationList.ContentTranscription1Transcription + ] = payload.get("transcription") + + def to_dict(self): + return { + "type": self.type, + "text": self.text, + "transcription": self.transcription.to_dict() + if self.transcription is not None + else None, + } + + def __init__(self, version: Version, conversation_sid: str): + """ + Initialize the CommunicationInConversationList + + :param version: Version that contains the resource + :param conversation_sid: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "conversation_sid": conversation_sid, + } + self._uri = "/Conversations/{conversation_sid}/Communications".format( + **self._solution + ) + + def _create( + self, + create_communication_in_conversation_request: Union[ + CreateCommunicationInConversationRequest, object + ] = values.unset, + ) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = create_communication_in_conversation_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, + create_communication_in_conversation_request: Union[ + CreateCommunicationInConversationRequest, object + ] = values.unset, + ) -> CommunicationInConversationInstance: + """ + Create the CommunicationInConversationInstance + + :param create_communication_in_conversation_request: + + :returns: The created CommunicationInConversationInstance + """ + payload, _, _ = self._create( + create_communication_in_conversation_request=create_communication_in_conversation_request + ) + return CommunicationInConversationInstance( + self._version, payload, conversation_sid=self._solution["conversation_sid"] + ) + + def create_with_http_info( + self, + create_communication_in_conversation_request: Union[ + CreateCommunicationInConversationRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Create the CommunicationInConversationInstance and return response metadata + + :param create_communication_in_conversation_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create( + create_communication_in_conversation_request=create_communication_in_conversation_request + ) + instance = CommunicationInConversationInstance( + self._version, payload, conversation_sid=self._solution["conversation_sid"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async( + self, + create_communication_in_conversation_request: Union[ + CreateCommunicationInConversationRequest, object + ] = values.unset, + ) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = create_communication_in_conversation_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, + create_communication_in_conversation_request: Union[ + CreateCommunicationInConversationRequest, object + ] = values.unset, + ) -> CommunicationInConversationInstance: + """ + Asynchronously create the CommunicationInConversationInstance + + :param create_communication_in_conversation_request: + + :returns: The created CommunicationInConversationInstance + """ + payload, _, _ = await self._create_async( + create_communication_in_conversation_request=create_communication_in_conversation_request + ) + return CommunicationInConversationInstance( + self._version, payload, conversation_sid=self._solution["conversation_sid"] + ) + + async def create_with_http_info_async( + self, + create_communication_in_conversation_request: Union[ + CreateCommunicationInConversationRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Asynchronously create the CommunicationInConversationInstance and return response metadata + + :param create_communication_in_conversation_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + create_communication_in_conversation_request=create_communication_in_conversation_request + ) + instance = CommunicationInConversationInstance( + self._version, payload, conversation_sid=self._solution["conversation_sid"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def stream( + self, + channel_id: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[CommunicationInConversationInstance]: + """ + Streams CommunicationInConversationInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str channel_id: Resource identifier to filter communications + :param limit: Upper limit for the number of records to return. stream() + guarantees to never return more than limit. Default is no limit + :param page_size: Number of records to fetch per request, when not set will use + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(channel_id=channel_id, page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + channel_id: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[CommunicationInConversationInstance]: + """ + Asynchronously streams CommunicationInConversationInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str channel_id: Resource identifier to filter communications + :param limit: Upper limit for the number of records to return. stream() + guarantees to never return more than limit. Default is no limit + :param page_size: Number of records to fetch per request, when not set will use + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async( + channel_id=channel_id, page_size=limits["page_size"] + ) + + return self._version.stream_async(page, limits["limit"]) + + def stream_with_http_info( + self, + channel_id: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams CommunicationInConversationInstance and returns headers from first page + + + :param str channel_id: Resource identifier to filter communications + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info( + channel_id=channel_id, page_size=limits["page_size"] + ) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + channel_id: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams CommunicationInConversationInstance and returns headers from first page + + + :param str channel_id: Resource identifier to filter communications + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + channel_id=channel_id, page_size=limits["page_size"] + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + channel_id: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[CommunicationInConversationInstance]: + """ + Lists CommunicationInConversationInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str channel_id: Resource identifier to filter communications + :param limit: Upper limit for the number of records to return. list() guarantees + never to return more than limit. Default is no limit + :param page_size: Number of records to fetch per request, when not set will use + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + channel_id=channel_id, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + channel_id: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[CommunicationInConversationInstance]: + """ + Asynchronously lists CommunicationInConversationInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str channel_id: Resource identifier to filter communications + :param limit: Upper limit for the number of records to return. list() guarantees + never to return more than limit. Default is no limit + :param page_size: Number of records to fetch per request, when not set will use + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + channel_id=channel_id, + limit=limit, + page_size=page_size, + ) + ] + + def list_with_http_info( + self, + channel_id: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists CommunicationInConversationInstance and returns headers from first page + + + :param str channel_id: Resource identifier to filter communications + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + channel_id=channel_id, + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + channel_id: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists CommunicationInConversationInstance and returns headers from first page + + + :param str channel_id: Resource identifier to filter communications + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + channel_id=channel_id, + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + channel_id: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> CommunicationInConversationPage: + """ + Retrieve a single page of CommunicationInConversationInstance records from the API. + Request is executed immediately + + :param channel_id: Resource identifier to filter communications + :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 CommunicationInConversationInstance + """ + data = values.of( + { + "channelId": channel_id, + "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 CommunicationInConversationPage(self._version, response, self._solution) + + async def page_async( + self, + channel_id: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> CommunicationInConversationPage: + """ + Asynchronously retrieve a single page of CommunicationInConversationInstance records from the API. + Request is executed immediately + + :param channel_id: Resource identifier to filter communications + :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 CommunicationInConversationInstance + """ + data = values.of( + { + "channelId": channel_id, + "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 CommunicationInConversationPage(self._version, response, self._solution) + + def page_with_http_info( + self, + channel_id: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :param channel_id: Resource identifier to filter communications + :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: ApiResponse with CommunicationInConversationPage, status code, and headers + """ + data = values.of( + { + "channelId": channel_id, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = CommunicationInConversationPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + channel_id: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :param channel_id: Resource identifier to filter communications + :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: ApiResponse with CommunicationInConversationPage, status code, and headers + """ + data = values.of( + { + "channelId": channel_id, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = CommunicationInConversationPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> CommunicationInConversationPage: + """ + Retrieve a specific page of CommunicationInConversationInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of CommunicationInConversationInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return CommunicationInConversationPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> CommunicationInConversationPage: + """ + Asynchronously retrieve a specific page of CommunicationInConversationInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of CommunicationInConversationInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return CommunicationInConversationPage(self._version, response, self._solution) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/conversations/v2/configuration.py b/twilio/rest/conversations/v2/configuration.py new file mode 100644 index 000000000..94db269aa --- /dev/null +++ b/twilio/rest/conversations/v2/configuration.py @@ -0,0 +1,1947 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Maestro (Conversations) + Manage configurations, conversations, participants, and communications. Create configurations to define capture rules and channel settings, then use conversations to group related communications. + + 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.api_response import ApiResponse +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 ConfigurationInstance(InstanceResource): + class ConversationsV2CaptureRule(object): + """ + :ivar _from: The from address. Use `*` for wildcard to match any from address. + :ivar to: The to address. Use `*` for wildcard to match any to address. + :ivar metadata: Additional matching criteria for the capture rule. For voice calls, can include `callType` (`PSTN`, `SIP`, and similar). + """ + + def __init__(self, payload: Dict[str, Any]): + self._from: Optional[str] = payload.get("_from") + self.to: Optional[str] = payload.get("to") + self.metadata: Optional[Dict[str, str]] = payload.get("metadata") + + def to_dict(self): + return { + "": self._from, + "": self.to, + "": self.metadata, + } + + class ConversationsV2StatusTimeouts(object): + """ + :ivar inactive: Inactivity timeout in minutes. + :ivar closed: Close timeout in minutes. + """ + + def __init__(self, payload: Dict[str, Any]): + self.inactive: Optional[int] = payload.get("inactive") + self.closed: Optional[int] = payload.get("closed") + + def to_dict(self): + return { + "": self.inactive, + "": self.closed, + } + + class CreateConfigurationRequest(object): + """ + :ivar display_name: A human-readable name for the configuration. Limited to 32 characters. + :ivar description: Human-readable description for the configuration. + :ivar conversation_grouping_type: The strategy Maestro (Conversations) uses to assign communications to conversations. + :ivar memory_store_id: The memory store ID that Maestro (Conversations) uses for profile resolution. + :ivar channel_settings: + :ivar status_callbacks: A list of webhook configurations. + :ivar intelligence_configuration_ids: A list of Conversational Intelligence configuration IDs. + """ + + def __init__(self, payload: Dict[str, Any]): + self.display_name: Optional[str] = payload.get("display_name") + self.description: Optional[str] = payload.get("description") + self.conversation_grouping_type: Optional[ + "ConfigurationInstance.str" + ] = payload.get("conversation_grouping_type") + self.memory_store_id: Optional[str] = payload.get("memory_store_id") + self.channel_settings: Optional[ + Dict[str, CreateConfigurationRequestChannelSettingsValue] + ] = payload.get("channel_settings") + self.status_callbacks: Optional[ + List[ConfigurationList.CreateConfigurationRequestStatusCallbacks] + ] = payload.get("status_callbacks") + self.intelligence_configuration_ids: Optional[List[str]] = payload.get( + "intelligence_configuration_ids" + ) + + def to_dict(self): + return { + "display_name": self.display_name, + "description": self.description, + "conversation_grouping_type": self.conversation_grouping_type, + "memory_store_id": self.memory_store_id, + "channel_settings": [ + channel_settings.to_dict() + for channel_settings in self.channel_settings + ] + if self.channel_settings is not None + else None, + "status_callbacks": [ + status_callbacks.to_dict() + for status_callbacks in self.status_callbacks + ] + if self.status_callbacks is not None + else None, + "intelligence_configuration_ids": self.intelligence_configuration_ids, + } + + class CreateConfigurationRequestChannelSettingsValue(object): + """ + :ivar status_timeouts: + :ivar capture_rules: + """ + + def __init__(self, payload: Dict[str, Any]): + self.status_timeouts: Optional[ + CreateConfigurationRequestChannelSettingsValueStatusTimeouts + ] = payload.get("status_timeouts") + self.capture_rules: Optional[ + List[CreateConfigurationRequestChannelSettingsValueCaptureRules] + ] = payload.get("capture_rules") + + def to_dict(self): + return { + "": self.status_timeouts.to_dict() + if self.status_timeouts is not None + else None, + "": [capture_rules.to_dict() for capture_rules in self.capture_rules] + if self.capture_rules is not None + else None, + } + + class CreateConfigurationRequestChannelSettingsValueCaptureRules(object): + """ + :ivar _from: The from address. Use '*' for wildcard. + :ivar to: The to address. Use '*' for wildcard. + :ivar metadata: + """ + + def __init__(self, payload: Dict[str, Any]): + self._from: Optional[str] = payload.get("_from") + self.to: Optional[str] = payload.get("to") + self.metadata: Optional[Dict[str, str]] = payload.get("metadata") + + def to_dict(self): + return { + "": self._from, + "": self.to, + "": self.metadata, + } + + class CreateConfigurationRequestChannelSettingsValueStatusTimeouts(object): + """ + :ivar inactive: The inactivity timeout in minutes. For more information, see [Conversation lifecycle](/docs/platform/conversations/concepts/lifecycle). + :ivar closed: The close timeout in minutes. For more information, see [Conversation lifecycle](/docs/platform/conversations/concepts/lifecycle). + """ + + def __init__(self, payload: Dict[str, Any]): + self.inactive: Optional[int] = payload.get("inactive") + self.closed: Optional[int] = payload.get("closed") + + def to_dict(self): + return { + "": self.inactive, + "": self.closed, + } + + class CreateConfigurationRequestStatusCallbacks(object): + """ + :ivar url: The destination URL for webhooks. + :ivar method: The HTTP method used to invoke the webhook URL. + """ + + def __init__(self, payload: Dict[str, Any]): + self.url: Optional[str] = payload.get("url") + self.method: Optional["ConfigurationInstance.str"] = payload.get("method") + + def to_dict(self): + return { + "url": self.url, + "method": self.method, + } + + class UpdateConfigurationRequest(object): + """ + :ivar display_name: A human-readable name for the configuration. Limited to 32 characters. + :ivar description: Human-readable description for the configuration. + :ivar conversation_grouping_type: The strategy Maestro (Conversations) uses to assign communications to conversations. + :ivar memory_store_id: The Memory Store ID for profile resolution. + :ivar channel_settings: + :ivar status_callbacks: + :ivar intelligence_configuration_ids: + """ + + def __init__(self, payload: Dict[str, Any]): + self.display_name: Optional[str] = payload.get("display_name") + self.description: Optional[str] = payload.get("description") + self.conversation_grouping_type: Optional[ + "ConfigurationInstance.str" + ] = payload.get("conversation_grouping_type") + self.memory_store_id: Optional[str] = payload.get("memory_store_id") + self.channel_settings: Optional[ + Dict[str, UpdateConfigurationRequestChannelSettingsValue] + ] = payload.get("channel_settings") + self.status_callbacks: Optional[ + List[ConfigurationList.UpdateConfigurationRequestStatusCallbacks] + ] = payload.get("status_callbacks") + self.intelligence_configuration_ids: Optional[List[str]] = payload.get( + "intelligence_configuration_ids" + ) + + def to_dict(self): + return { + "display_name": self.display_name, + "description": self.description, + "conversation_grouping_type": self.conversation_grouping_type, + "memory_store_id": self.memory_store_id, + "channel_settings": [ + channel_settings.to_dict() + for channel_settings in self.channel_settings + ] + if self.channel_settings is not None + else None, + "status_callbacks": [ + status_callbacks.to_dict() + for status_callbacks in self.status_callbacks + ] + if self.status_callbacks is not None + else None, + "intelligence_configuration_ids": self.intelligence_configuration_ids, + } + + class UpdateConfigurationRequestChannelSettingsValue(object): + """ + :ivar status_timeouts: + :ivar capture_rules: + """ + + def __init__(self, payload: Dict[str, Any]): + self.status_timeouts: Optional[ + UpdateConfigurationRequestChannelSettingsValueStatusTimeouts + ] = payload.get("status_timeouts") + self.capture_rules: Optional[ + List[UpdateConfigurationRequestChannelSettingsValueCaptureRules] + ] = payload.get("capture_rules") + + def to_dict(self): + return { + "": self.status_timeouts.to_dict() + if self.status_timeouts is not None + else None, + "": [capture_rules.to_dict() for capture_rules in self.capture_rules] + if self.capture_rules is not None + else None, + } + + class UpdateConfigurationRequestChannelSettingsValueCaptureRules(object): + """ + :ivar _from: + :ivar to: + :ivar metadata: + """ + + def __init__(self, payload: Dict[str, Any]): + self._from: Optional[str] = payload.get("_from") + self.to: Optional[str] = payload.get("to") + self.metadata: Optional[Dict[str, str]] = payload.get("metadata") + + def to_dict(self): + return { + "": self._from, + "": self.to, + "": self.metadata, + } + + class UpdateConfigurationRequestChannelSettingsValueStatusTimeouts(object): + """ + :ivar inactive: + :ivar closed: + """ + + def __init__(self, payload: Dict[str, Any]): + self.inactive: Optional[int] = payload.get("inactive") + self.closed: Optional[int] = payload.get("closed") + + def to_dict(self): + return { + "": self.inactive, + "": self.closed, + } + + class UpdateConfigurationRequestStatusCallbacks(object): + """ + :ivar url: + :ivar method: + """ + + def __init__(self, payload: Dict[str, Any]): + self.url: Optional[str] = payload.get("url") + self.method: Optional["ConfigurationInstance.str"] = payload.get("method") + + def to_dict(self): + return { + "url": self.url, + "method": self.method, + } + + """ + :ivar id: Configuration ID. + :ivar display_name: A human-readable name for the configuration. Limited to 32 characters. + :ivar description: Human-readable description for the Configuration. Allows spaces and special characters, typically limited to a paragraph of text. This serves as a descriptive field rather than just a name. + :ivar conversation_grouping_type: Type of Conversation grouping strategy: - `GROUP_BY_PARTICIPANT_ADDRESSES`: Groups Communications by Participant addresses across all channels. A customer using +18005550100 will be in the same Conversation whether they contact by SMS, WhatsApp, or RCS. - `GROUP_BY_PARTICIPANT_ADDRESSES_AND_CHANNEL_TYPE`: Groups Communications by both Participant addresses AND channel. A customer using +18005550100 by SMS will be in a different Conversation than the same customer by Voice. + :ivar memory_store_id: Memory Store ID for Profile resolution. + :ivar channel_settings: Channel-specific configuration settings by channel type. Keys should be valid channel types (`VOICE`, `SMS`, `RCS`, `WHATSAPP`, `CHAT`). + :ivar status_callbacks: List of default webhook configurations applied to Conversations under this Configuration. + :ivar intelligence_configuration_ids: A list of Conversational Intelligence configuration IDs. + :ivar created_at: Timestamp when this Configuration was created. + :ivar updated_at: Timestamp when this Configuration was last updated. + :ivar version: Version number used for optimistic locking. + :ivar code: Twilio-specific error code + :ivar message: Error message + :ivar more_info: Link to Error Code References + :ivar status: HTTP response status code + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): + super().__init__(version) + + self.id: Optional[str] = payload.get("id") + self.display_name: Optional[str] = payload.get("displayName") + self.description: Optional[str] = payload.get("description") + self.conversation_grouping_type: Optional[str] = payload.get( + "conversationGroupingType" + ) + self.memory_store_id: Optional[str] = payload.get("memoryStoreId") + self.channel_settings: Optional[Dict[str, str]] = payload.get("channelSettings") + self.status_callbacks: Optional[List[str]] = payload.get("statusCallbacks") + self.intelligence_configuration_ids: Optional[List[str]] = payload.get( + "intelligenceConfigurationIds" + ) + self.created_at: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("createdAt") + ) + self.updated_at: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("updatedAt") + ) + self.version: Optional[int] = payload.get("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._solution = { + "sid": sid or self.sid, + } + self._context: Optional[ConfigurationContext] = None + + @property + def _proxy(self) -> "ConfigurationContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: ConfigurationContext for this ConfigurationInstance + """ + if self._context is None: + self._context = ConfigurationContext( + self._version, + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the ConfigurationInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the ConfigurationInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the ConfigurationInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return self._proxy.delete_with_http_info() + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the ConfigurationInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return await self._proxy.delete_with_http_info_async() + + def fetch(self) -> "ConfigurationInstance": + """ + Fetch the ConfigurationInstance + + + :returns: The fetched ConfigurationInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "ConfigurationInstance": + """ + Asynchronous coroutine to fetch the ConfigurationInstance + + + :returns: The fetched ConfigurationInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the ConfigurationInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the ConfigurationInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_async() + + def update( + self, + update_configuration_request: Union[ + UpdateConfigurationRequest, object + ] = values.unset, + ) -> "ConfigurationInstance": + """ + Update the ConfigurationInstance + + :param update_configuration_request: The configuration to update + + :returns: The updated ConfigurationInstance + """ + return self._proxy.update( + update_configuration_request=update_configuration_request, + ) + + async def update_async( + self, + update_configuration_request: Union[ + UpdateConfigurationRequest, object + ] = values.unset, + ) -> "ConfigurationInstance": + """ + Asynchronous coroutine to update the ConfigurationInstance + + :param update_configuration_request: The configuration to update + + :returns: The updated ConfigurationInstance + """ + return await self._proxy.update_async( + update_configuration_request=update_configuration_request, + ) + + def update_with_http_info( + self, + update_configuration_request: Union[ + UpdateConfigurationRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Update the ConfigurationInstance with HTTP info + + :param update_configuration_request: The configuration to update + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.update_with_http_info( + update_configuration_request=update_configuration_request, + ) + + async def update_with_http_info_async( + self, + update_configuration_request: Union[ + UpdateConfigurationRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to update the ConfigurationInstance with HTTP info + + :param update_configuration_request: The configuration to update + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.update_with_http_info_async( + update_configuration_request=update_configuration_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 ConfigurationContext(InstanceContext): + class ConversationsV2CaptureRule(object): + """ + :ivar _from: The from address. Use `*` for wildcard to match any from address. + :ivar to: The to address. Use `*` for wildcard to match any to address. + :ivar metadata: Additional matching criteria for the capture rule. For voice calls, can include `callType` (`PSTN`, `SIP`, and similar). + """ + + def __init__(self, payload: Dict[str, Any]): + self._from: Optional[str] = payload.get("_from") + self.to: Optional[str] = payload.get("to") + self.metadata: Optional[Dict[str, str]] = payload.get("metadata") + + def to_dict(self): + return { + "": self._from, + "": self.to, + "": self.metadata, + } + + class ConversationsV2StatusTimeouts(object): + """ + :ivar inactive: Inactivity timeout in minutes. + :ivar closed: Close timeout in minutes. + """ + + def __init__(self, payload: Dict[str, Any]): + self.inactive: Optional[int] = payload.get("inactive") + self.closed: Optional[int] = payload.get("closed") + + def to_dict(self): + return { + "": self.inactive, + "": self.closed, + } + + class CreateConfigurationRequest(object): + """ + :ivar display_name: A human-readable name for the configuration. Limited to 32 characters. + :ivar description: Human-readable description for the configuration. + :ivar conversation_grouping_type: The strategy Maestro (Conversations) uses to assign communications to conversations. + :ivar memory_store_id: The memory store ID that Maestro (Conversations) uses for profile resolution. + :ivar channel_settings: + :ivar status_callbacks: A list of webhook configurations. + :ivar intelligence_configuration_ids: A list of Conversational Intelligence configuration IDs. + """ + + def __init__(self, payload: Dict[str, Any]): + self.display_name: Optional[str] = payload.get("display_name") + self.description: Optional[str] = payload.get("description") + self.conversation_grouping_type: Optional[ + "ConfigurationInstance.str" + ] = payload.get("conversation_grouping_type") + self.memory_store_id: Optional[str] = payload.get("memory_store_id") + self.channel_settings: Optional[ + Dict[str, CreateConfigurationRequestChannelSettingsValue] + ] = payload.get("channel_settings") + self.status_callbacks: Optional[ + List[ConfigurationList.CreateConfigurationRequestStatusCallbacks] + ] = payload.get("status_callbacks") + self.intelligence_configuration_ids: Optional[List[str]] = payload.get( + "intelligence_configuration_ids" + ) + + def to_dict(self): + return { + "display_name": self.display_name, + "description": self.description, + "conversation_grouping_type": self.conversation_grouping_type, + "memory_store_id": self.memory_store_id, + "channel_settings": [ + channel_settings.to_dict() + for channel_settings in self.channel_settings + ] + if self.channel_settings is not None + else None, + "status_callbacks": [ + status_callbacks.to_dict() + for status_callbacks in self.status_callbacks + ] + if self.status_callbacks is not None + else None, + "intelligence_configuration_ids": self.intelligence_configuration_ids, + } + + class CreateConfigurationRequestChannelSettingsValue(object): + """ + :ivar status_timeouts: + :ivar capture_rules: + """ + + def __init__(self, payload: Dict[str, Any]): + self.status_timeouts: Optional[ + CreateConfigurationRequestChannelSettingsValueStatusTimeouts + ] = payload.get("status_timeouts") + self.capture_rules: Optional[ + List[CreateConfigurationRequestChannelSettingsValueCaptureRules] + ] = payload.get("capture_rules") + + def to_dict(self): + return { + "": self.status_timeouts.to_dict() + if self.status_timeouts is not None + else None, + "": [capture_rules.to_dict() for capture_rules in self.capture_rules] + if self.capture_rules is not None + else None, + } + + class CreateConfigurationRequestChannelSettingsValueCaptureRules(object): + """ + :ivar _from: The from address. Use '*' for wildcard. + :ivar to: The to address. Use '*' for wildcard. + :ivar metadata: + """ + + def __init__(self, payload: Dict[str, Any]): + self._from: Optional[str] = payload.get("_from") + self.to: Optional[str] = payload.get("to") + self.metadata: Optional[Dict[str, str]] = payload.get("metadata") + + def to_dict(self): + return { + "": self._from, + "": self.to, + "": self.metadata, + } + + class CreateConfigurationRequestChannelSettingsValueStatusTimeouts(object): + """ + :ivar inactive: The inactivity timeout in minutes. For more information, see [Conversation lifecycle](/docs/platform/conversations/concepts/lifecycle). + :ivar closed: The close timeout in minutes. For more information, see [Conversation lifecycle](/docs/platform/conversations/concepts/lifecycle). + """ + + def __init__(self, payload: Dict[str, Any]): + self.inactive: Optional[int] = payload.get("inactive") + self.closed: Optional[int] = payload.get("closed") + + def to_dict(self): + return { + "": self.inactive, + "": self.closed, + } + + class CreateConfigurationRequestStatusCallbacks(object): + """ + :ivar url: The destination URL for webhooks. + :ivar method: The HTTP method used to invoke the webhook URL. + """ + + def __init__(self, payload: Dict[str, Any]): + self.url: Optional[str] = payload.get("url") + self.method: Optional["ConfigurationInstance.str"] = payload.get("method") + + def to_dict(self): + return { + "url": self.url, + "method": self.method, + } + + class UpdateConfigurationRequest(object): + """ + :ivar display_name: A human-readable name for the configuration. Limited to 32 characters. + :ivar description: Human-readable description for the configuration. + :ivar conversation_grouping_type: The strategy Maestro (Conversations) uses to assign communications to conversations. + :ivar memory_store_id: The Memory Store ID for profile resolution. + :ivar channel_settings: + :ivar status_callbacks: + :ivar intelligence_configuration_ids: + """ + + def __init__(self, payload: Dict[str, Any]): + self.display_name: Optional[str] = payload.get("display_name") + self.description: Optional[str] = payload.get("description") + self.conversation_grouping_type: Optional[ + "ConfigurationInstance.str" + ] = payload.get("conversation_grouping_type") + self.memory_store_id: Optional[str] = payload.get("memory_store_id") + self.channel_settings: Optional[ + Dict[str, UpdateConfigurationRequestChannelSettingsValue] + ] = payload.get("channel_settings") + self.status_callbacks: Optional[ + List[ConfigurationList.UpdateConfigurationRequestStatusCallbacks] + ] = payload.get("status_callbacks") + self.intelligence_configuration_ids: Optional[List[str]] = payload.get( + "intelligence_configuration_ids" + ) + + def to_dict(self): + return { + "display_name": self.display_name, + "description": self.description, + "conversation_grouping_type": self.conversation_grouping_type, + "memory_store_id": self.memory_store_id, + "channel_settings": [ + channel_settings.to_dict() + for channel_settings in self.channel_settings + ] + if self.channel_settings is not None + else None, + "status_callbacks": [ + status_callbacks.to_dict() + for status_callbacks in self.status_callbacks + ] + if self.status_callbacks is not None + else None, + "intelligence_configuration_ids": self.intelligence_configuration_ids, + } + + class UpdateConfigurationRequestChannelSettingsValue(object): + """ + :ivar status_timeouts: + :ivar capture_rules: + """ + + def __init__(self, payload: Dict[str, Any]): + self.status_timeouts: Optional[ + UpdateConfigurationRequestChannelSettingsValueStatusTimeouts + ] = payload.get("status_timeouts") + self.capture_rules: Optional[ + List[UpdateConfigurationRequestChannelSettingsValueCaptureRules] + ] = payload.get("capture_rules") + + def to_dict(self): + return { + "": self.status_timeouts.to_dict() + if self.status_timeouts is not None + else None, + "": [capture_rules.to_dict() for capture_rules in self.capture_rules] + if self.capture_rules is not None + else None, + } + + class UpdateConfigurationRequestChannelSettingsValueCaptureRules(object): + """ + :ivar _from: + :ivar to: + :ivar metadata: + """ + + def __init__(self, payload: Dict[str, Any]): + self._from: Optional[str] = payload.get("_from") + self.to: Optional[str] = payload.get("to") + self.metadata: Optional[Dict[str, str]] = payload.get("metadata") + + def to_dict(self): + return { + "": self._from, + "": self.to, + "": self.metadata, + } + + class UpdateConfigurationRequestChannelSettingsValueStatusTimeouts(object): + """ + :ivar inactive: + :ivar closed: + """ + + def __init__(self, payload: Dict[str, Any]): + self.inactive: Optional[int] = payload.get("inactive") + self.closed: Optional[int] = payload.get("closed") + + def to_dict(self): + return { + "": self.inactive, + "": self.closed, + } + + class UpdateConfigurationRequestStatusCallbacks(object): + """ + :ivar url: + :ivar method: + """ + + def __init__(self, payload: Dict[str, Any]): + self.url: Optional[str] = payload.get("url") + self.method: Optional["ConfigurationInstance.str"] = payload.get("method") + + def to_dict(self): + return { + "url": self.url, + "method": self.method, + } + + def __init__(self, version: Version, sid: str): + """ + Initialize the ConfigurationContext + + :param version: Version that contains the resource + :param sid: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "sid": sid, + } + self._uri = "/ControlPlane/Configurations/{sid}".format(**self._solution) + + def _delete(self) -> tuple: + """ + Internal helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.delete_with_response_info( + method="DELETE", uri=self._uri, headers=headers + ) + + def delete(self) -> bool: + """ + Deletes the ConfigurationInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = self._delete() + return success + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the ConfigurationInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = self._delete() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + async def _delete_async(self) -> tuple: + """ + Internal async helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.delete_with_response_info_async( + method="DELETE", uri=self._uri, headers=headers + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the ConfigurationInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = await self._delete_async() + return success + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the ConfigurationInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = await self._delete_async() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> ConfigurationInstance: + """ + Fetch the ConfigurationInstance + + + :returns: The fetched ConfigurationInstance + """ + payload, _, _ = self._fetch() + return ConfigurationInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the ConfigurationInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = ConfigurationInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> ConfigurationInstance: + """ + Asynchronous coroutine to fetch the ConfigurationInstance + + + :returns: The fetched ConfigurationInstance + """ + payload, _, _ = await self._fetch_async() + return ConfigurationInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the ConfigurationInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = ConfigurationInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def _update( + self, + update_configuration_request: Union[ + UpdateConfigurationRequest, object + ] = values.unset, + ) -> tuple: + """ + Internal helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = update_configuration_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.update_with_response_info( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + def update( + self, + update_configuration_request: Union[ + UpdateConfigurationRequest, object + ] = values.unset, + ) -> ConfigurationInstance: + """ + Update the ConfigurationInstance + + :param update_configuration_request: The configuration to update + + :returns: The updated ConfigurationInstance + """ + payload, _, _ = self._update( + update_configuration_request=update_configuration_request + ) + return ConfigurationInstance(self._version, payload, sid=self._solution["sid"]) + + def update_with_http_info( + self, + update_configuration_request: Union[ + UpdateConfigurationRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Update the ConfigurationInstance and return response metadata + + :param update_configuration_request: The configuration to update + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._update( + update_configuration_request=update_configuration_request + ) + instance = ConfigurationInstance( + self._version, payload, sid=self._solution["sid"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _update_async( + self, + update_configuration_request: Union[ + UpdateConfigurationRequest, object + ] = values.unset, + ) -> tuple: + """ + Internal async helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = update_configuration_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.update_with_response_info_async( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + async def update_async( + self, + update_configuration_request: Union[ + UpdateConfigurationRequest, object + ] = values.unset, + ) -> ConfigurationInstance: + """ + Asynchronous coroutine to update the ConfigurationInstance + + :param update_configuration_request: The configuration to update + + :returns: The updated ConfigurationInstance + """ + payload, _, _ = await self._update_async( + update_configuration_request=update_configuration_request + ) + return ConfigurationInstance(self._version, payload, sid=self._solution["sid"]) + + async def update_with_http_info_async( + self, + update_configuration_request: Union[ + UpdateConfigurationRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to update the ConfigurationInstance and return response metadata + + :param update_configuration_request: The configuration to update + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._update_async( + update_configuration_request=update_configuration_request + ) + instance = ConfigurationInstance( + self._version, payload, sid=self._solution["sid"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class ConfigurationPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ConfigurationInstance: + """ + Build an instance of ConfigurationInstance + + :param payload: Payload response from the API + """ + return ConfigurationInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class ConfigurationList(ListResource): + class ConversationsV2CaptureRule(object): + """ + :ivar _from: The from address. Use `*` for wildcard to match any from address. + :ivar to: The to address. Use `*` for wildcard to match any to address. + :ivar metadata: Additional matching criteria for the capture rule. For voice calls, can include `callType` (`PSTN`, `SIP`, and similar). + """ + + def __init__(self, payload: Dict[str, Any]): + self._from: Optional[str] = payload.get("_from") + self.to: Optional[str] = payload.get("to") + self.metadata: Optional[Dict[str, str]] = payload.get("metadata") + + def to_dict(self): + return { + "": self._from, + "": self.to, + "": self.metadata, + } + + class ConversationsV2StatusTimeouts(object): + """ + :ivar inactive: Inactivity timeout in minutes. + :ivar closed: Close timeout in minutes. + """ + + def __init__(self, payload: Dict[str, Any]): + self.inactive: Optional[int] = payload.get("inactive") + self.closed: Optional[int] = payload.get("closed") + + def to_dict(self): + return { + "": self.inactive, + "": self.closed, + } + + class CreateConfigurationRequest(object): + """ + :ivar display_name: A human-readable name for the configuration. Limited to 32 characters. + :ivar description: Human-readable description for the configuration. + :ivar conversation_grouping_type: The strategy Maestro (Conversations) uses to assign communications to conversations. + :ivar memory_store_id: The memory store ID that Maestro (Conversations) uses for profile resolution. + :ivar channel_settings: + :ivar status_callbacks: A list of webhook configurations. + :ivar intelligence_configuration_ids: A list of Conversational Intelligence configuration IDs. + """ + + def __init__(self, payload: Dict[str, Any]): + self.display_name: Optional[str] = payload.get("display_name") + self.description: Optional[str] = payload.get("description") + self.conversation_grouping_type: Optional[ + "ConfigurationInstance.str" + ] = payload.get("conversation_grouping_type") + self.memory_store_id: Optional[str] = payload.get("memory_store_id") + self.channel_settings: Optional[ + Dict[str, CreateConfigurationRequestChannelSettingsValue] + ] = payload.get("channel_settings") + self.status_callbacks: Optional[ + List[ConfigurationList.CreateConfigurationRequestStatusCallbacks] + ] = payload.get("status_callbacks") + self.intelligence_configuration_ids: Optional[List[str]] = payload.get( + "intelligence_configuration_ids" + ) + + def to_dict(self): + return { + "display_name": self.display_name, + "description": self.description, + "conversation_grouping_type": self.conversation_grouping_type, + "memory_store_id": self.memory_store_id, + "channel_settings": [ + channel_settings.to_dict() + for channel_settings in self.channel_settings + ] + if self.channel_settings is not None + else None, + "status_callbacks": [ + status_callbacks.to_dict() + for status_callbacks in self.status_callbacks + ] + if self.status_callbacks is not None + else None, + "intelligence_configuration_ids": self.intelligence_configuration_ids, + } + + class CreateConfigurationRequestChannelSettingsValue(object): + """ + :ivar status_timeouts: + :ivar capture_rules: + """ + + def __init__(self, payload: Dict[str, Any]): + self.status_timeouts: Optional[ + CreateConfigurationRequestChannelSettingsValueStatusTimeouts + ] = payload.get("status_timeouts") + self.capture_rules: Optional[ + List[CreateConfigurationRequestChannelSettingsValueCaptureRules] + ] = payload.get("capture_rules") + + def to_dict(self): + return { + "": self.status_timeouts.to_dict() + if self.status_timeouts is not None + else None, + "": [capture_rules.to_dict() for capture_rules in self.capture_rules] + if self.capture_rules is not None + else None, + } + + class CreateConfigurationRequestChannelSettingsValueCaptureRules(object): + """ + :ivar _from: The from address. Use '*' for wildcard. + :ivar to: The to address. Use '*' for wildcard. + :ivar metadata: + """ + + def __init__(self, payload: Dict[str, Any]): + self._from: Optional[str] = payload.get("_from") + self.to: Optional[str] = payload.get("to") + self.metadata: Optional[Dict[str, str]] = payload.get("metadata") + + def to_dict(self): + return { + "": self._from, + "": self.to, + "": self.metadata, + } + + class CreateConfigurationRequestChannelSettingsValueStatusTimeouts(object): + """ + :ivar inactive: The inactivity timeout in minutes. For more information, see [Conversation lifecycle](/docs/platform/conversations/concepts/lifecycle). + :ivar closed: The close timeout in minutes. For more information, see [Conversation lifecycle](/docs/platform/conversations/concepts/lifecycle). + """ + + def __init__(self, payload: Dict[str, Any]): + self.inactive: Optional[int] = payload.get("inactive") + self.closed: Optional[int] = payload.get("closed") + + def to_dict(self): + return { + "": self.inactive, + "": self.closed, + } + + class CreateConfigurationRequestStatusCallbacks(object): + """ + :ivar url: The destination URL for webhooks. + :ivar method: The HTTP method used to invoke the webhook URL. + """ + + def __init__(self, payload: Dict[str, Any]): + self.url: Optional[str] = payload.get("url") + self.method: Optional["ConfigurationInstance.str"] = payload.get("method") + + def to_dict(self): + return { + "url": self.url, + "method": self.method, + } + + class UpdateConfigurationRequest(object): + """ + :ivar display_name: A human-readable name for the configuration. Limited to 32 characters. + :ivar description: Human-readable description for the configuration. + :ivar conversation_grouping_type: The strategy Maestro (Conversations) uses to assign communications to conversations. + :ivar memory_store_id: The Memory Store ID for profile resolution. + :ivar channel_settings: + :ivar status_callbacks: + :ivar intelligence_configuration_ids: + """ + + def __init__(self, payload: Dict[str, Any]): + self.display_name: Optional[str] = payload.get("display_name") + self.description: Optional[str] = payload.get("description") + self.conversation_grouping_type: Optional[ + "ConfigurationInstance.str" + ] = payload.get("conversation_grouping_type") + self.memory_store_id: Optional[str] = payload.get("memory_store_id") + self.channel_settings: Optional[ + Dict[str, UpdateConfigurationRequestChannelSettingsValue] + ] = payload.get("channel_settings") + self.status_callbacks: Optional[ + List[ConfigurationList.UpdateConfigurationRequestStatusCallbacks] + ] = payload.get("status_callbacks") + self.intelligence_configuration_ids: Optional[List[str]] = payload.get( + "intelligence_configuration_ids" + ) + + def to_dict(self): + return { + "display_name": self.display_name, + "description": self.description, + "conversation_grouping_type": self.conversation_grouping_type, + "memory_store_id": self.memory_store_id, + "channel_settings": [ + channel_settings.to_dict() + for channel_settings in self.channel_settings + ] + if self.channel_settings is not None + else None, + "status_callbacks": [ + status_callbacks.to_dict() + for status_callbacks in self.status_callbacks + ] + if self.status_callbacks is not None + else None, + "intelligence_configuration_ids": self.intelligence_configuration_ids, + } + + class UpdateConfigurationRequestChannelSettingsValue(object): + """ + :ivar status_timeouts: + :ivar capture_rules: + """ + + def __init__(self, payload: Dict[str, Any]): + self.status_timeouts: Optional[ + UpdateConfigurationRequestChannelSettingsValueStatusTimeouts + ] = payload.get("status_timeouts") + self.capture_rules: Optional[ + List[UpdateConfigurationRequestChannelSettingsValueCaptureRules] + ] = payload.get("capture_rules") + + def to_dict(self): + return { + "": self.status_timeouts.to_dict() + if self.status_timeouts is not None + else None, + "": [capture_rules.to_dict() for capture_rules in self.capture_rules] + if self.capture_rules is not None + else None, + } + + class UpdateConfigurationRequestChannelSettingsValueCaptureRules(object): + """ + :ivar _from: + :ivar to: + :ivar metadata: + """ + + def __init__(self, payload: Dict[str, Any]): + self._from: Optional[str] = payload.get("_from") + self.to: Optional[str] = payload.get("to") + self.metadata: Optional[Dict[str, str]] = payload.get("metadata") + + def to_dict(self): + return { + "": self._from, + "": self.to, + "": self.metadata, + } + + class UpdateConfigurationRequestChannelSettingsValueStatusTimeouts(object): + """ + :ivar inactive: + :ivar closed: + """ + + def __init__(self, payload: Dict[str, Any]): + self.inactive: Optional[int] = payload.get("inactive") + self.closed: Optional[int] = payload.get("closed") + + def to_dict(self): + return { + "": self.inactive, + "": self.closed, + } + + class UpdateConfigurationRequestStatusCallbacks(object): + """ + :ivar url: + :ivar method: + """ + + def __init__(self, payload: Dict[str, Any]): + self.url: Optional[str] = payload.get("url") + self.method: Optional["ConfigurationInstance.str"] = payload.get("method") + + def to_dict(self): + return { + "url": self.url, + "method": self.method, + } + + def __init__(self, version: Version): + """ + Initialize the ConfigurationList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/ControlPlane/Configurations" + + def _create( + self, + create_configuration_request: Union[ + CreateConfigurationRequest, object + ] = values.unset, + ) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = create_configuration_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, + create_configuration_request: Union[ + CreateConfigurationRequest, object + ] = values.unset, + ) -> ConfigurationInstance: + """ + Create the ConfigurationInstance + + :param create_configuration_request: The configuration to create + + :returns: The created ConfigurationInstance + """ + payload, _, _ = self._create( + create_configuration_request=create_configuration_request + ) + return ConfigurationInstance(self._version, payload) + + def create_with_http_info( + self, + create_configuration_request: Union[ + CreateConfigurationRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Create the ConfigurationInstance and return response metadata + + :param create_configuration_request: The configuration to create + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create( + create_configuration_request=create_configuration_request + ) + instance = ConfigurationInstance(self._version, payload) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async( + self, + create_configuration_request: Union[ + CreateConfigurationRequest, object + ] = values.unset, + ) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = create_configuration_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, + create_configuration_request: Union[ + CreateConfigurationRequest, object + ] = values.unset, + ) -> ConfigurationInstance: + """ + Asynchronously create the ConfigurationInstance + + :param create_configuration_request: The configuration to create + + :returns: The created ConfigurationInstance + """ + payload, _, _ = await self._create_async( + create_configuration_request=create_configuration_request + ) + return ConfigurationInstance(self._version, payload) + + async def create_with_http_info_async( + self, + create_configuration_request: Union[ + CreateConfigurationRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Asynchronously create the ConfigurationInstance and return response metadata + + :param create_configuration_request: The configuration to create + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + create_configuration_request=create_configuration_request + ) + instance = ConfigurationInstance(self._version, payload) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[ConfigurationInstance]: + """ + Streams ConfigurationInstance 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[ConfigurationInstance]: + """ + Asynchronously streams ConfigurationInstance 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 stream_with_http_info( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams ConfigurationInstance and returns headers from first page + + + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info(page_size=limits["page_size"]) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams ConfigurationInstance and returns headers from first page + + + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + page_size=limits["page_size"] + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[ConfigurationInstance]: + """ + Lists ConfigurationInstance 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[ConfigurationInstance]: + """ + Asynchronously lists ConfigurationInstance 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 list_with_http_info( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists ConfigurationInstance and returns headers from first page + + + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists ConfigurationInstance and returns headers from first page + + + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ConfigurationPage: + """ + Retrieve a single page of ConfigurationInstance 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 ConfigurationInstance + """ + 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 ConfigurationPage(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, + ) -> ConfigurationPage: + """ + Asynchronously retrieve a single page of ConfigurationInstance 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 ConfigurationInstance + """ + 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 ConfigurationPage(self._version, response) + + def page_with_http_info( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :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: ApiResponse with ConfigurationPage, status code, and headers + """ + 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, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = ConfigurationPage(self._version, response) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :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: ApiResponse with ConfigurationPage, status code, and headers + """ + 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, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = ConfigurationPage(self._version, response) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> ConfigurationPage: + """ + Retrieve a specific page of ConfigurationInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ConfigurationInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return ConfigurationPage(self._version, response) + + async def get_page_async(self, target_url: str) -> ConfigurationPage: + """ + Asynchronously retrieve a specific page of ConfigurationInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ConfigurationInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return ConfigurationPage(self._version, response) + + def get(self, sid: str) -> ConfigurationContext: + """ + Constructs a ConfigurationContext + + :param sid: + """ + return ConfigurationContext(self._version, sid=sid) + + def __call__(self, sid: str) -> ConfigurationContext: + """ + Constructs a ConfigurationContext + + :param sid: + """ + return ConfigurationContext(self._version, sid=sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/conversations/v2/conversation.py b/twilio/rest/conversations/v2/conversation.py new file mode 100644 index 000000000..46aea48cb --- /dev/null +++ b/twilio/rest/conversations/v2/conversation.py @@ -0,0 +1,1467 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Maestro (Conversations) + Manage configurations, conversations, participants, and communications. Create configurations to define capture rules and channel settings, then use conversations to group related communications. + + 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.api_response import ApiResponse +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 ConversationInstance(InstanceResource): + class ConversationsV2CaptureRule(object): + """ + :ivar _from: The from address. Use `*` for wildcard to match any from address. + :ivar to: The to address. Use `*` for wildcard to match any to address. + :ivar metadata: Additional matching criteria for the capture rule. For voice calls, can include `callType` (`PSTN`, `SIP`, and similar). + """ + + def __init__(self, payload: Dict[str, Any]): + self._from: Optional[str] = payload.get("_from") + self.to: Optional[str] = payload.get("to") + self.metadata: Optional[Dict[str, str]] = payload.get("metadata") + + def to_dict(self): + return { + "": self._from, + "": self.to, + "": self.metadata, + } + + class ConversationsV2StatusTimeouts(object): + """ + :ivar inactive: Inactivity timeout in minutes. + :ivar closed: Close timeout in minutes. + """ + + def __init__(self, payload: Dict[str, Any]): + self.inactive: Optional[int] = payload.get("inactive") + self.closed: Optional[int] = payload.get("closed") + + def to_dict(self): + return { + "": self.inactive, + "": self.closed, + } + + class CreateConversationWithConfigRequest(object): + """ + :ivar configuration_id: The ID of an existing configuration. + :ivar name: The name of the conversation. + """ + + def __init__(self, payload: Dict[str, Any]): + self.configuration_id: Optional[str] = payload.get("configuration_id") + self.name: Optional[str] = payload.get("name") + + def to_dict(self): + return { + "configuration_id": self.configuration_id, + "name": self.name, + } + + class UpdateConversationByIdRequest(object): + """ + :ivar name: The name of the Conversation. + :ivar status: The state of the Conversation. + :ivar configuration: + """ + + def __init__(self, payload: Dict[str, Any]): + self.name: Optional[str] = payload.get("name") + self.status: Optional["ConversationInstance.str"] = payload.get("status") + self.configuration: Optional[ + ConversationList.UpdateConversationByIdRequestConfiguration + ] = payload.get("configuration") + + def to_dict(self): + return { + "name": self.name, + "status": self.status, + "configuration": self.configuration.to_dict() + if self.configuration is not None + else None, + } + + class UpdateConversationByIdRequestConfiguration(object): + """ + :ivar intelligence_configuration_ids: A list of Conversational Intelligence configuration IDs. + """ + + def __init__(self, payload: Dict[str, Any]): + self.intelligence_configuration_ids: Optional[List[str]] = payload.get( + "intelligence_configuration_ids" + ) + + def to_dict(self): + return { + "intelligence_configuration_ids": self.intelligence_configuration_ids, + } + + """ + :ivar id: Conversation ID. + :ivar account_id: Account ID. + :ivar configuration_id: Configuration ID. + :ivar status: Conversation status. + :ivar name: Conversation name. + :ivar created_at: Timestamp when this Conversation was created. + :ivar updated_at: Timestamp when this Conversation was last updated. + :ivar configuration: + :ivar code: Twilio-specific error code + :ivar message: Error message + :ivar more_info: Link to Error Code References + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): + super().__init__(version) + + self.id: Optional[str] = payload.get("id") + self.account_id: Optional[str] = payload.get("accountId") + self.configuration_id: Optional[str] = payload.get("configurationId") + self.status: Optional[str] = payload.get("status") + self.name: Optional[str] = payload.get("name") + self.created_at: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("createdAt") + ) + self.updated_at: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("updatedAt") + ) + self.configuration: Optional[str] = payload.get("configuration") + self.code: Optional[int] = payload.get("code") + self.message: Optional[str] = payload.get("message") + self.more_info: Optional[str] = payload.get("more_info") + + self._solution = { + "sid": sid or self.sid, + } + self._context: Optional[ConversationContext] = None + + @property + def _proxy(self) -> "ConversationContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: ConversationContext for this ConversationInstance + """ + if self._context is None: + self._context = ConversationContext( + self._version, + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the ConversationInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the ConversationInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the ConversationInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return self._proxy.delete_with_http_info() + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the ConversationInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return await self._proxy.delete_with_http_info_async() + + def fetch(self) -> "ConversationInstance": + """ + Fetch the ConversationInstance + + + :returns: The fetched ConversationInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "ConversationInstance": + """ + Asynchronous coroutine to fetch the ConversationInstance + + + :returns: The fetched ConversationInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the ConversationInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the ConversationInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_async() + + def update( + self, + update_conversation_by_id_request: Union[ + UpdateConversationByIdRequest, object + ] = values.unset, + ) -> "ConversationInstance": + """ + Update the ConversationInstance + + :param update_conversation_by_id_request: The conversation to update + + :returns: The updated ConversationInstance + """ + return self._proxy.update( + update_conversation_by_id_request=update_conversation_by_id_request, + ) + + async def update_async( + self, + update_conversation_by_id_request: Union[ + UpdateConversationByIdRequest, object + ] = values.unset, + ) -> "ConversationInstance": + """ + Asynchronous coroutine to update the ConversationInstance + + :param update_conversation_by_id_request: The conversation to update + + :returns: The updated ConversationInstance + """ + return await self._proxy.update_async( + update_conversation_by_id_request=update_conversation_by_id_request, + ) + + def update_with_http_info( + self, + update_conversation_by_id_request: Union[ + UpdateConversationByIdRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Update the ConversationInstance with HTTP info + + :param update_conversation_by_id_request: The conversation to update + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.update_with_http_info( + update_conversation_by_id_request=update_conversation_by_id_request, + ) + + async def update_with_http_info_async( + self, + update_conversation_by_id_request: Union[ + UpdateConversationByIdRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to update the ConversationInstance with HTTP info + + :param update_conversation_by_id_request: The conversation to update + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.update_with_http_info_async( + update_conversation_by_id_request=update_conversation_by_id_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 ConversationContext(InstanceContext): + class ConversationsV2CaptureRule(object): + """ + :ivar _from: The from address. Use `*` for wildcard to match any from address. + :ivar to: The to address. Use `*` for wildcard to match any to address. + :ivar metadata: Additional matching criteria for the capture rule. For voice calls, can include `callType` (`PSTN`, `SIP`, and similar). + """ + + def __init__(self, payload: Dict[str, Any]): + self._from: Optional[str] = payload.get("_from") + self.to: Optional[str] = payload.get("to") + self.metadata: Optional[Dict[str, str]] = payload.get("metadata") + + def to_dict(self): + return { + "": self._from, + "": self.to, + "": self.metadata, + } + + class ConversationsV2StatusTimeouts(object): + """ + :ivar inactive: Inactivity timeout in minutes. + :ivar closed: Close timeout in minutes. + """ + + def __init__(self, payload: Dict[str, Any]): + self.inactive: Optional[int] = payload.get("inactive") + self.closed: Optional[int] = payload.get("closed") + + def to_dict(self): + return { + "": self.inactive, + "": self.closed, + } + + class CreateConversationWithConfigRequest(object): + """ + :ivar configuration_id: The ID of an existing configuration. + :ivar name: The name of the conversation. + """ + + def __init__(self, payload: Dict[str, Any]): + self.configuration_id: Optional[str] = payload.get("configuration_id") + self.name: Optional[str] = payload.get("name") + + def to_dict(self): + return { + "configuration_id": self.configuration_id, + "name": self.name, + } + + class UpdateConversationByIdRequest(object): + """ + :ivar name: The name of the Conversation. + :ivar status: The state of the Conversation. + :ivar configuration: + """ + + def __init__(self, payload: Dict[str, Any]): + self.name: Optional[str] = payload.get("name") + self.status: Optional["ConversationInstance.str"] = payload.get("status") + self.configuration: Optional[ + ConversationList.UpdateConversationByIdRequestConfiguration + ] = payload.get("configuration") + + def to_dict(self): + return { + "name": self.name, + "status": self.status, + "configuration": self.configuration.to_dict() + if self.configuration is not None + else None, + } + + class UpdateConversationByIdRequestConfiguration(object): + """ + :ivar intelligence_configuration_ids: A list of Conversational Intelligence configuration IDs. + """ + + def __init__(self, payload: Dict[str, Any]): + self.intelligence_configuration_ids: Optional[List[str]] = payload.get( + "intelligence_configuration_ids" + ) + + def to_dict(self): + return { + "intelligence_configuration_ids": self.intelligence_configuration_ids, + } + + def __init__(self, version: Version, sid: str): + """ + Initialize the ConversationContext + + :param version: Version that contains the resource + :param sid: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "sid": sid, + } + self._uri = "/Conversations/{sid}".format(**self._solution) + + def _delete(self) -> tuple: + """ + Internal helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.delete_with_response_info( + method="DELETE", uri=self._uri, headers=headers + ) + + def delete(self) -> bool: + """ + Deletes the ConversationInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = self._delete() + return success + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the ConversationInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = self._delete() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + async def _delete_async(self) -> tuple: + """ + Internal async helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.delete_with_response_info_async( + method="DELETE", uri=self._uri, headers=headers + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the ConversationInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = await self._delete_async() + return success + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the ConversationInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = await self._delete_async() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> ConversationInstance: + """ + Fetch the ConversationInstance + + + :returns: The fetched ConversationInstance + """ + payload, _, _ = self._fetch() + return ConversationInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the ConversationInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = ConversationInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> ConversationInstance: + """ + Asynchronous coroutine to fetch the ConversationInstance + + + :returns: The fetched ConversationInstance + """ + payload, _, _ = await self._fetch_async() + return ConversationInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the ConversationInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = ConversationInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def _update( + self, + update_conversation_by_id_request: Union[ + UpdateConversationByIdRequest, object + ] = values.unset, + ) -> tuple: + """ + Internal helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = update_conversation_by_id_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.update_with_response_info( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + def update( + self, + update_conversation_by_id_request: Union[ + UpdateConversationByIdRequest, object + ] = values.unset, + ) -> ConversationInstance: + """ + Update the ConversationInstance + + :param update_conversation_by_id_request: The conversation to update + + :returns: The updated ConversationInstance + """ + payload, _, _ = self._update( + update_conversation_by_id_request=update_conversation_by_id_request + ) + return ConversationInstance(self._version, payload, sid=self._solution["sid"]) + + def update_with_http_info( + self, + update_conversation_by_id_request: Union[ + UpdateConversationByIdRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Update the ConversationInstance and return response metadata + + :param update_conversation_by_id_request: The conversation to update + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._update( + update_conversation_by_id_request=update_conversation_by_id_request + ) + instance = ConversationInstance( + self._version, payload, sid=self._solution["sid"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _update_async( + self, + update_conversation_by_id_request: Union[ + UpdateConversationByIdRequest, object + ] = values.unset, + ) -> tuple: + """ + Internal async helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = update_conversation_by_id_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.update_with_response_info_async( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + async def update_async( + self, + update_conversation_by_id_request: Union[ + UpdateConversationByIdRequest, object + ] = values.unset, + ) -> ConversationInstance: + """ + Asynchronous coroutine to update the ConversationInstance + + :param update_conversation_by_id_request: The conversation to update + + :returns: The updated ConversationInstance + """ + payload, _, _ = await self._update_async( + update_conversation_by_id_request=update_conversation_by_id_request + ) + return ConversationInstance(self._version, payload, sid=self._solution["sid"]) + + async def update_with_http_info_async( + self, + update_conversation_by_id_request: Union[ + UpdateConversationByIdRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to update the ConversationInstance and return response metadata + + :param update_conversation_by_id_request: The conversation to update + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._update_async( + update_conversation_by_id_request=update_conversation_by_id_request + ) + instance = ConversationInstance( + self._version, payload, sid=self._solution["sid"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class ConversationPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ConversationInstance: + """ + Build an instance of ConversationInstance + + :param payload: Payload response from the API + """ + return ConversationInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class ConversationList(ListResource): + class ConversationsV2CaptureRule(object): + """ + :ivar _from: The from address. Use `*` for wildcard to match any from address. + :ivar to: The to address. Use `*` for wildcard to match any to address. + :ivar metadata: Additional matching criteria for the capture rule. For voice calls, can include `callType` (`PSTN`, `SIP`, and similar). + """ + + def __init__(self, payload: Dict[str, Any]): + self._from: Optional[str] = payload.get("_from") + self.to: Optional[str] = payload.get("to") + self.metadata: Optional[Dict[str, str]] = payload.get("metadata") + + def to_dict(self): + return { + "": self._from, + "": self.to, + "": self.metadata, + } + + class ConversationsV2StatusTimeouts(object): + """ + :ivar inactive: Inactivity timeout in minutes. + :ivar closed: Close timeout in minutes. + """ + + def __init__(self, payload: Dict[str, Any]): + self.inactive: Optional[int] = payload.get("inactive") + self.closed: Optional[int] = payload.get("closed") + + def to_dict(self): + return { + "": self.inactive, + "": self.closed, + } + + class CreateConversationWithConfigRequest(object): + """ + :ivar configuration_id: The ID of an existing configuration. + :ivar name: The name of the conversation. + """ + + def __init__(self, payload: Dict[str, Any]): + self.configuration_id: Optional[str] = payload.get("configuration_id") + self.name: Optional[str] = payload.get("name") + + def to_dict(self): + return { + "configuration_id": self.configuration_id, + "name": self.name, + } + + class UpdateConversationByIdRequest(object): + """ + :ivar name: The name of the Conversation. + :ivar status: The state of the Conversation. + :ivar configuration: + """ + + def __init__(self, payload: Dict[str, Any]): + self.name: Optional[str] = payload.get("name") + self.status: Optional["ConversationInstance.str"] = payload.get("status") + self.configuration: Optional[ + ConversationList.UpdateConversationByIdRequestConfiguration + ] = payload.get("configuration") + + def to_dict(self): + return { + "name": self.name, + "status": self.status, + "configuration": self.configuration.to_dict() + if self.configuration is not None + else None, + } + + class UpdateConversationByIdRequestConfiguration(object): + """ + :ivar intelligence_configuration_ids: A list of Conversational Intelligence configuration IDs. + """ + + def __init__(self, payload: Dict[str, Any]): + self.intelligence_configuration_ids: Optional[List[str]] = payload.get( + "intelligence_configuration_ids" + ) + + def to_dict(self): + return { + "intelligence_configuration_ids": self.intelligence_configuration_ids, + } + + def __init__(self, version: Version): + """ + Initialize the ConversationList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Conversations" + + def _create( + self, + create_conversation_with_config_request: Union[ + CreateConversationWithConfigRequest, object + ] = values.unset, + ) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = create_conversation_with_config_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, + create_conversation_with_config_request: Union[ + CreateConversationWithConfigRequest, object + ] = values.unset, + ) -> ConversationInstance: + """ + Create the ConversationInstance + + :param create_conversation_with_config_request: + + :returns: The created ConversationInstance + """ + payload, _, _ = self._create( + create_conversation_with_config_request=create_conversation_with_config_request + ) + return ConversationInstance(self._version, payload) + + def create_with_http_info( + self, + create_conversation_with_config_request: Union[ + CreateConversationWithConfigRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Create the ConversationInstance and return response metadata + + :param create_conversation_with_config_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create( + create_conversation_with_config_request=create_conversation_with_config_request + ) + instance = ConversationInstance(self._version, payload) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async( + self, + create_conversation_with_config_request: Union[ + CreateConversationWithConfigRequest, object + ] = values.unset, + ) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = create_conversation_with_config_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, + create_conversation_with_config_request: Union[ + CreateConversationWithConfigRequest, object + ] = values.unset, + ) -> ConversationInstance: + """ + Asynchronously create the ConversationInstance + + :param create_conversation_with_config_request: + + :returns: The created ConversationInstance + """ + payload, _, _ = await self._create_async( + create_conversation_with_config_request=create_conversation_with_config_request + ) + return ConversationInstance(self._version, payload) + + async def create_with_http_info_async( + self, + create_conversation_with_config_request: Union[ + CreateConversationWithConfigRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Asynchronously create the ConversationInstance and return response metadata + + :param create_conversation_with_config_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + create_conversation_with_config_request=create_conversation_with_config_request + ) + instance = ConversationInstance(self._version, payload) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def stream( + self, + status: Union[List[str], object] = values.unset, + channel_id: Union[str, object] = values.unset, + addresses: Union[List[str], object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[ConversationInstance]: + """ + Streams ConversationInstance 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 List[str] status: Filters for specific statuses + :param str channel_id: The resource identifier (such as callSid or messageSid) to filter conversations. + :param List[str] addresses: Filter Conversations by Participant addresses. Requires at least 2 addresses. Returns Conversations across all channels for the specified address pair. Must be URL-encoded ('+' becomes '%2B', '@' becomes '%40'). + :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( + status=status, + channel_id=channel_id, + addresses=addresses, + page_size=limits["page_size"], + ) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + status: Union[List[str], object] = values.unset, + channel_id: Union[str, object] = values.unset, + addresses: Union[List[str], object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[ConversationInstance]: + """ + Asynchronously streams ConversationInstance 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 List[str] status: Filters for specific statuses + :param str channel_id: The resource identifier (such as callSid or messageSid) to filter conversations. + :param List[str] addresses: Filter Conversations by Participant addresses. Requires at least 2 addresses. Returns Conversations across all channels for the specified address pair. Must be URL-encoded ('+' becomes '%2B', '@' becomes '%40'). + :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( + status=status, + channel_id=channel_id, + addresses=addresses, + page_size=limits["page_size"], + ) + + return self._version.stream_async(page, limits["limit"]) + + def stream_with_http_info( + self, + status: Union[List[str], object] = values.unset, + channel_id: Union[str, object] = values.unset, + addresses: Union[List[str], object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams ConversationInstance and returns headers from first page + + + :param List[str] status: Filters for specific statuses + :param str channel_id: The resource identifier (such as callSid or messageSid) to filter conversations. + :param List[str] addresses: Filter Conversations by Participant addresses. Requires at least 2 addresses. Returns Conversations across all channels for the specified address pair. Must be URL-encoded ('+' becomes '%2B', '@' becomes '%40'). + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info( + status=status, + channel_id=channel_id, + addresses=addresses, + page_size=limits["page_size"], + ) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + status: Union[List[str], object] = values.unset, + channel_id: Union[str, object] = values.unset, + addresses: Union[List[str], object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams ConversationInstance and returns headers from first page + + + :param List[str] status: Filters for specific statuses + :param str channel_id: The resource identifier (such as callSid or messageSid) to filter conversations. + :param List[str] addresses: Filter Conversations by Participant addresses. Requires at least 2 addresses. Returns Conversations across all channels for the specified address pair. Must be URL-encoded ('+' becomes '%2B', '@' becomes '%40'). + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + status=status, + channel_id=channel_id, + addresses=addresses, + page_size=limits["page_size"], + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + status: Union[List[str], object] = values.unset, + channel_id: Union[str, object] = values.unset, + addresses: Union[List[str], object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[ConversationInstance]: + """ + Lists ConversationInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param List[str] status: Filters for specific statuses + :param str channel_id: The resource identifier (such as callSid or messageSid) to filter conversations. + :param List[str] addresses: Filter Conversations by Participant addresses. Requires at least 2 addresses. Returns Conversations across all channels for the specified address pair. Must be URL-encoded ('+' becomes '%2B', '@' becomes '%40'). + :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( + status=status, + channel_id=channel_id, + addresses=addresses, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + status: Union[List[str], object] = values.unset, + channel_id: Union[str, object] = values.unset, + addresses: Union[List[str], object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[ConversationInstance]: + """ + Asynchronously lists ConversationInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param List[str] status: Filters for specific statuses + :param str channel_id: The resource identifier (such as callSid or messageSid) to filter conversations. + :param List[str] addresses: Filter Conversations by Participant addresses. Requires at least 2 addresses. Returns Conversations across all channels for the specified address pair. Must be URL-encoded ('+' becomes '%2B', '@' becomes '%40'). + :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( + status=status, + channel_id=channel_id, + addresses=addresses, + limit=limit, + page_size=page_size, + ) + ] + + def list_with_http_info( + self, + status: Union[List[str], object] = values.unset, + channel_id: Union[str, object] = values.unset, + addresses: Union[List[str], object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists ConversationInstance and returns headers from first page + + + :param List[str] status: Filters for specific statuses + :param str channel_id: The resource identifier (such as callSid or messageSid) to filter conversations. + :param List[str] addresses: Filter Conversations by Participant addresses. Requires at least 2 addresses. Returns Conversations across all channels for the specified address pair. Must be URL-encoded ('+' becomes '%2B', '@' becomes '%40'). + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + status=status, + channel_id=channel_id, + addresses=addresses, + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + status: Union[List[str], object] = values.unset, + channel_id: Union[str, object] = values.unset, + addresses: Union[List[str], object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists ConversationInstance and returns headers from first page + + + :param List[str] status: Filters for specific statuses + :param str channel_id: The resource identifier (such as callSid or messageSid) to filter conversations. + :param List[str] addresses: Filter Conversations by Participant addresses. Requires at least 2 addresses. Returns Conversations across all channels for the specified address pair. Must be URL-encoded ('+' becomes '%2B', '@' becomes '%40'). + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + status=status, + channel_id=channel_id, + addresses=addresses, + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + status: Union[List[str], object] = values.unset, + channel_id: Union[str, object] = values.unset, + addresses: Union[List[str], object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ConversationPage: + """ + Retrieve a single page of ConversationInstance records from the API. + Request is executed immediately + + :param status: Filters for specific statuses + :param channel_id: The resource identifier (such as callSid or messageSid) to filter conversations. + :param addresses: Filter Conversations by Participant addresses. Requires at least 2 addresses. Returns Conversations across all channels for the specified address pair. Must be URL-encoded ('+' becomes '%2B', '@' becomes '%40'). + :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 ConversationInstance + """ + data = values.of( + { + "status": serialize.map(status, lambda e: e), + "channelId": channel_id, + "addresses": serialize.map(addresses, lambda e: e), + "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 ConversationPage(self._version, response) + + async def page_async( + self, + status: Union[List[str], object] = values.unset, + channel_id: Union[str, object] = values.unset, + addresses: Union[List[str], object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ConversationPage: + """ + Asynchronously retrieve a single page of ConversationInstance records from the API. + Request is executed immediately + + :param status: Filters for specific statuses + :param channel_id: The resource identifier (such as callSid or messageSid) to filter conversations. + :param addresses: Filter Conversations by Participant addresses. Requires at least 2 addresses. Returns Conversations across all channels for the specified address pair. Must be URL-encoded ('+' becomes '%2B', '@' becomes '%40'). + :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 ConversationInstance + """ + data = values.of( + { + "status": serialize.map(status, lambda e: e), + "channelId": channel_id, + "addresses": serialize.map(addresses, lambda e: e), + "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 ConversationPage(self._version, response) + + def page_with_http_info( + self, + status: Union[List[str], object] = values.unset, + channel_id: Union[str, object] = values.unset, + addresses: Union[List[str], object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :param status: Filters for specific statuses + :param channel_id: The resource identifier (such as callSid or messageSid) to filter conversations. + :param addresses: Filter Conversations by Participant addresses. Requires at least 2 addresses. Returns Conversations across all channels for the specified address pair. Must be URL-encoded ('+' becomes '%2B', '@' becomes '%40'). + :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: ApiResponse with ConversationPage, status code, and headers + """ + data = values.of( + { + "status": serialize.map(status, lambda e: e), + "channelId": channel_id, + "addresses": serialize.map(addresses, lambda e: e), + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = ConversationPage(self._version, response) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + status: Union[List[str], object] = values.unset, + channel_id: Union[str, object] = values.unset, + addresses: Union[List[str], object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :param status: Filters for specific statuses + :param channel_id: The resource identifier (such as callSid or messageSid) to filter conversations. + :param addresses: Filter Conversations by Participant addresses. Requires at least 2 addresses. Returns Conversations across all channels for the specified address pair. Must be URL-encoded ('+' becomes '%2B', '@' becomes '%40'). + :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: ApiResponse with ConversationPage, status code, and headers + """ + data = values.of( + { + "status": serialize.map(status, lambda e: e), + "channelId": channel_id, + "addresses": serialize.map(addresses, lambda e: e), + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = ConversationPage(self._version, response) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> ConversationPage: + """ + Retrieve a specific page of ConversationInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ConversationInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return ConversationPage(self._version, response) + + async def get_page_async(self, target_url: str) -> ConversationPage: + """ + Asynchronously retrieve a specific page of ConversationInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ConversationInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return ConversationPage(self._version, response) + + def get(self, sid: str) -> ConversationContext: + """ + Constructs a ConversationContext + + :param sid: + """ + return ConversationContext(self._version, sid=sid) + + def __call__(self, sid: str) -> ConversationContext: + """ + Constructs a ConversationContext + + :param sid: + """ + return ConversationContext(self._version, sid=sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/conversations/v2/participant.py b/twilio/rest/conversations/v2/participant.py new file mode 100644 index 000000000..d36e9acb4 --- /dev/null +++ b/twilio/rest/conversations/v2/participant.py @@ -0,0 +1,1162 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Maestro (Conversations) + Manage configurations, conversations, participants, and communications. Create configurations to define capture rules and channel settings, then use conversations to group related communications. + + 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.api_response import ApiResponse +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 ParticipantInstance(InstanceResource): + class CreateParticipantInConversationRequest(object): + """ + :ivar name: + :ivar type: + :ivar profile_id: + :ivar addresses: + """ + + def __init__(self, payload: Dict[str, Any]): + self.name: Optional[str] = payload.get("name") + self.type: Optional["ParticipantInstance.str"] = payload.get("type") + self.profile_id: Optional[str] = payload.get("profile_id") + self.addresses: Optional[ + List[ParticipantList.CreateParticipantInConversationRequestAddresses] + ] = payload.get("addresses") + + def to_dict(self): + return { + "name": self.name, + "type": self.type, + "profile_id": self.profile_id, + "addresses": [addresses.to_dict() for addresses in self.addresses] + if self.addresses is not None + else None, + } + + class CreateParticipantInConversationRequestAddresses(object): + """ + :ivar channel: + :ivar address: + :ivar channel_id: + """ + + def __init__(self, payload: Dict[str, Any]): + self.channel: Optional["ParticipantInstance.str"] = payload.get("channel") + self.address: Optional[str] = payload.get("address") + self.channel_id: Optional[str] = payload.get("channel_id") + + def to_dict(self): + return { + "channel": self.channel, + "address": self.address, + "channel_id": self.channel_id, + } + + """ + :ivar id: Participant ID. + :ivar conversation_id: Conversation ID. + :ivar account_id: Account ID. + :ivar name: Participant display name. + :ivar type: Type of Participant in the Conversation. + :ivar profile_id: Profile ID. Note: This field is only resolved for `CUSTOMER` participant types, not for `HUMAN_AGENT` or `AI_AGENT` participants. + :ivar addresses: Communication addresses for this Participant. Address format varies by channel: - SMS/VOICE: E.164 phone number (such as \"+18005550100\") - EMAIL: Email address (such as \"user@example.com\") - WHATSAPP: Phone number with whatsapp prefix (such as \"whatsapp:+18005550100\") - RCS: Sender ID or phone number with rcs prefix (such as \"rcs:brand_acme_agent\" or \"rcs:+18005550100\") + :ivar created_at: Timestamp when this Participant was created. + :ivar updated_at: Timestamp when this Participant was last updated. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + conversation_sid: Optional[str] = None, + sid: Optional[str] = None, + ): + super().__init__(version) + + self.id: Optional[str] = payload.get("id") + self.conversation_id: Optional[str] = payload.get("conversationId") + self.account_id: Optional[str] = payload.get("accountId") + self.name: Optional[str] = payload.get("name") + self.type: Optional[str] = payload.get("type") + self.profile_id: Optional[str] = payload.get("profileId") + self.addresses: Optional[List[str]] = payload.get("addresses") + self.created_at: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("createdAt") + ) + self.updated_at: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("updatedAt") + ) + + self._solution = { + "conversation_sid": conversation_sid or self.conversation_sid, + "sid": sid or self.sid, + } + self._context: Optional[ParticipantContext] = None + + @property + def _proxy(self) -> "ParticipantContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: ParticipantContext for this ParticipantInstance + """ + if self._context is None: + self._context = ParticipantContext( + self._version, + conversation_sid=self._solution["conversation_sid"], + sid=self._solution["sid"], + ) + return self._context + + def fetch(self) -> "ParticipantInstance": + """ + Fetch the ParticipantInstance + + + :returns: The fetched ParticipantInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "ParticipantInstance": + """ + Asynchronous coroutine to fetch the ParticipantInstance + + + :returns: The fetched ParticipantInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the ParticipantInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the ParticipantInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_async() + + def update( + self, + create_participant_in_conversation_request: Union[ + CreateParticipantInConversationRequest, object + ] = values.unset, + ) -> "ParticipantInstance": + """ + Update the ParticipantInstance + + :param create_participant_in_conversation_request: + + :returns: The updated ParticipantInstance + """ + return self._proxy.update( + create_participant_in_conversation_request=create_participant_in_conversation_request, + ) + + async def update_async( + self, + create_participant_in_conversation_request: Union[ + CreateParticipantInConversationRequest, object + ] = values.unset, + ) -> "ParticipantInstance": + """ + Asynchronous coroutine to update the ParticipantInstance + + :param create_participant_in_conversation_request: + + :returns: The updated ParticipantInstance + """ + return await self._proxy.update_async( + create_participant_in_conversation_request=create_participant_in_conversation_request, + ) + + def update_with_http_info( + self, + create_participant_in_conversation_request: Union[ + CreateParticipantInConversationRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Update the ParticipantInstance with HTTP info + + :param create_participant_in_conversation_request: + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.update_with_http_info( + create_participant_in_conversation_request=create_participant_in_conversation_request, + ) + + async def update_with_http_info_async( + self, + create_participant_in_conversation_request: Union[ + CreateParticipantInConversationRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to update the ParticipantInstance with HTTP info + + :param create_participant_in_conversation_request: + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.update_with_http_info_async( + create_participant_in_conversation_request=create_participant_in_conversation_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 ParticipantContext(InstanceContext): + class CreateParticipantInConversationRequest(object): + """ + :ivar name: + :ivar type: + :ivar profile_id: + :ivar addresses: + """ + + def __init__(self, payload: Dict[str, Any]): + self.name: Optional[str] = payload.get("name") + self.type: Optional["ParticipantInstance.str"] = payload.get("type") + self.profile_id: Optional[str] = payload.get("profile_id") + self.addresses: Optional[ + List[ParticipantList.CreateParticipantInConversationRequestAddresses] + ] = payload.get("addresses") + + def to_dict(self): + return { + "name": self.name, + "type": self.type, + "profile_id": self.profile_id, + "addresses": [addresses.to_dict() for addresses in self.addresses] + if self.addresses is not None + else None, + } + + class CreateParticipantInConversationRequestAddresses(object): + """ + :ivar channel: + :ivar address: + :ivar channel_id: + """ + + def __init__(self, payload: Dict[str, Any]): + self.channel: Optional["ParticipantInstance.str"] = payload.get("channel") + self.address: Optional[str] = payload.get("address") + self.channel_id: Optional[str] = payload.get("channel_id") + + def to_dict(self): + return { + "channel": self.channel, + "address": self.address, + "channel_id": self.channel_id, + } + + def __init__(self, version: Version, conversation_sid: str, sid: str): + """ + Initialize the ParticipantContext + + :param version: Version that contains the resource + :param conversation_sid: + :param sid: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "conversation_sid": conversation_sid, + "sid": sid, + } + self._uri = "/Conversations/{conversation_sid}/Participants/{sid}".format( + **self._solution + ) + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> ParticipantInstance: + """ + Fetch the ParticipantInstance + + + :returns: The fetched ParticipantInstance + """ + payload, _, _ = self._fetch() + return ParticipantInstance( + self._version, + payload, + conversation_sid=self._solution["conversation_sid"], + sid=self._solution["sid"], + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the ParticipantInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = ParticipantInstance( + self._version, + payload, + conversation_sid=self._solution["conversation_sid"], + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> ParticipantInstance: + """ + Asynchronous coroutine to fetch the ParticipantInstance + + + :returns: The fetched ParticipantInstance + """ + payload, _, _ = await self._fetch_async() + return ParticipantInstance( + self._version, + payload, + conversation_sid=self._solution["conversation_sid"], + sid=self._solution["sid"], + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the ParticipantInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = ParticipantInstance( + self._version, + payload, + conversation_sid=self._solution["conversation_sid"], + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def _update( + self, + create_participant_in_conversation_request: Union[ + CreateParticipantInConversationRequest, object + ] = values.unset, + ) -> tuple: + """ + Internal helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = create_participant_in_conversation_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.update_with_response_info( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + def update( + self, + create_participant_in_conversation_request: Union[ + CreateParticipantInConversationRequest, object + ] = values.unset, + ) -> ParticipantInstance: + """ + Update the ParticipantInstance + + :param create_participant_in_conversation_request: + + :returns: The updated ParticipantInstance + """ + payload, _, _ = self._update( + create_participant_in_conversation_request=create_participant_in_conversation_request + ) + return ParticipantInstance( + self._version, + payload, + conversation_sid=self._solution["conversation_sid"], + sid=self._solution["sid"], + ) + + def update_with_http_info( + self, + create_participant_in_conversation_request: Union[ + CreateParticipantInConversationRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Update the ParticipantInstance and return response metadata + + :param create_participant_in_conversation_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._update( + create_participant_in_conversation_request=create_participant_in_conversation_request + ) + instance = ParticipantInstance( + self._version, + payload, + conversation_sid=self._solution["conversation_sid"], + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _update_async( + self, + create_participant_in_conversation_request: Union[ + CreateParticipantInConversationRequest, object + ] = values.unset, + ) -> tuple: + """ + Internal async helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = create_participant_in_conversation_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.update_with_response_info_async( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + async def update_async( + self, + create_participant_in_conversation_request: Union[ + CreateParticipantInConversationRequest, object + ] = values.unset, + ) -> ParticipantInstance: + """ + Asynchronous coroutine to update the ParticipantInstance + + :param create_participant_in_conversation_request: + + :returns: The updated ParticipantInstance + """ + payload, _, _ = await self._update_async( + create_participant_in_conversation_request=create_participant_in_conversation_request + ) + return ParticipantInstance( + self._version, + payload, + conversation_sid=self._solution["conversation_sid"], + sid=self._solution["sid"], + ) + + async def update_with_http_info_async( + self, + create_participant_in_conversation_request: Union[ + CreateParticipantInConversationRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to update the ParticipantInstance and return response metadata + + :param create_participant_in_conversation_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._update_async( + create_participant_in_conversation_request=create_participant_in_conversation_request + ) + instance = ParticipantInstance( + self._version, + payload, + conversation_sid=self._solution["conversation_sid"], + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class ParticipantPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ParticipantInstance: + """ + Build an instance of ParticipantInstance + + :param payload: Payload response from the API + """ + return ParticipantInstance( + self._version, payload, conversation_sid=self._solution["conversation_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class ParticipantList(ListResource): + class CreateParticipantInConversationRequest(object): + """ + :ivar name: + :ivar type: + :ivar profile_id: + :ivar addresses: + """ + + def __init__(self, payload: Dict[str, Any]): + self.name: Optional[str] = payload.get("name") + self.type: Optional["ParticipantInstance.str"] = payload.get("type") + self.profile_id: Optional[str] = payload.get("profile_id") + self.addresses: Optional[ + List[ParticipantList.CreateParticipantInConversationRequestAddresses] + ] = payload.get("addresses") + + def to_dict(self): + return { + "name": self.name, + "type": self.type, + "profile_id": self.profile_id, + "addresses": [addresses.to_dict() for addresses in self.addresses] + if self.addresses is not None + else None, + } + + class CreateParticipantInConversationRequestAddresses(object): + """ + :ivar channel: + :ivar address: + :ivar channel_id: + """ + + def __init__(self, payload: Dict[str, Any]): + self.channel: Optional["ParticipantInstance.str"] = payload.get("channel") + self.address: Optional[str] = payload.get("address") + self.channel_id: Optional[str] = payload.get("channel_id") + + def to_dict(self): + return { + "channel": self.channel, + "address": self.address, + "channel_id": self.channel_id, + } + + def __init__(self, version: Version, conversation_sid: str): + """ + Initialize the ParticipantList + + :param version: Version that contains the resource + :param conversation_sid: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "conversation_sid": conversation_sid, + } + self._uri = "/Conversations/{conversation_sid}/Participants".format( + **self._solution + ) + + def _create( + self, + create_participant_in_conversation_request: Union[ + CreateParticipantInConversationRequest, object + ] = values.unset, + ) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = create_participant_in_conversation_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, + create_participant_in_conversation_request: Union[ + CreateParticipantInConversationRequest, object + ] = values.unset, + ) -> ParticipantInstance: + """ + Create the ParticipantInstance + + :param create_participant_in_conversation_request: + + :returns: The created ParticipantInstance + """ + payload, _, _ = self._create( + create_participant_in_conversation_request=create_participant_in_conversation_request + ) + return ParticipantInstance( + self._version, payload, conversation_sid=self._solution["conversation_sid"] + ) + + def create_with_http_info( + self, + create_participant_in_conversation_request: Union[ + CreateParticipantInConversationRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Create the ParticipantInstance and return response metadata + + :param create_participant_in_conversation_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create( + create_participant_in_conversation_request=create_participant_in_conversation_request + ) + instance = ParticipantInstance( + self._version, payload, conversation_sid=self._solution["conversation_sid"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async( + self, + create_participant_in_conversation_request: Union[ + CreateParticipantInConversationRequest, object + ] = values.unset, + ) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = create_participant_in_conversation_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, + create_participant_in_conversation_request: Union[ + CreateParticipantInConversationRequest, object + ] = values.unset, + ) -> ParticipantInstance: + """ + Asynchronously create the ParticipantInstance + + :param create_participant_in_conversation_request: + + :returns: The created ParticipantInstance + """ + payload, _, _ = await self._create_async( + create_participant_in_conversation_request=create_participant_in_conversation_request + ) + return ParticipantInstance( + self._version, payload, conversation_sid=self._solution["conversation_sid"] + ) + + async def create_with_http_info_async( + self, + create_participant_in_conversation_request: Union[ + CreateParticipantInConversationRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Asynchronously create the ParticipantInstance and return response metadata + + :param create_participant_in_conversation_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + create_participant_in_conversation_request=create_participant_in_conversation_request + ) + instance = ParticipantInstance( + self._version, payload, conversation_sid=self._solution["conversation_sid"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[ParticipantInstance]: + """ + Streams ParticipantInstance 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[ParticipantInstance]: + """ + Asynchronously streams ParticipantInstance 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 stream_with_http_info( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams ParticipantInstance and returns headers from first page + + + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info(page_size=limits["page_size"]) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams ParticipantInstance and returns headers from first page + + + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + page_size=limits["page_size"] + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[ParticipantInstance]: + """ + Lists ParticipantInstance 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[ParticipantInstance]: + """ + Asynchronously lists ParticipantInstance 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 list_with_http_info( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists ParticipantInstance and returns headers from first page + + + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists ParticipantInstance and returns headers from first page + + + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ParticipantPage: + """ + Retrieve a single page of ParticipantInstance 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 ParticipantInstance + """ + 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 ParticipantPage(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, + ) -> ParticipantPage: + """ + Asynchronously retrieve a single page of ParticipantInstance 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 ParticipantInstance + """ + 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 ParticipantPage(self._version, response, self._solution) + + def page_with_http_info( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :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: ApiResponse with ParticipantPage, status code, and headers + """ + 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, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = ParticipantPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :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: ApiResponse with ParticipantPage, status code, and headers + """ + 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, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = ParticipantPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> ParticipantPage: + """ + Retrieve a specific page of ParticipantInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ParticipantInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return ParticipantPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> ParticipantPage: + """ + Asynchronously retrieve a specific page of ParticipantInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ParticipantInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return ParticipantPage(self._version, response, self._solution) + + def get(self, conversation_sid: str, sid: str) -> ParticipantContext: + """ + Constructs a ParticipantContext + + :param conversation_sid: + :param sid: + """ + return ParticipantContext( + self._version, conversation_sid=conversation_sid, sid=sid + ) + + def __call__(self, conversation_sid: str, sid: str) -> ParticipantContext: + """ + Constructs a ParticipantContext + + :param conversation_sid: + :param sid: + """ + return ParticipantContext( + self._version, conversation_sid=conversation_sid, sid=sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/events/EventsBase.py b/twilio/rest/events/EventsBase.py index eb2251ae4..17c087a1d 100644 --- a/twilio/rest/events/EventsBase.py +++ b/twilio/rest/events/EventsBase.py @@ -17,7 +17,6 @@ class EventsBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Events Domain diff --git a/twilio/rest/events/v1/__init__.py b/twilio/rest/events/v1/__init__.py index 6b9135544..d62e813d5 100644 --- a/twilio/rest/events/v1/__init__.py +++ b/twilio/rest/events/v1/__init__.py @@ -22,7 +22,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Events diff --git a/twilio/rest/events/v1/event_type.py b/twilio/rest/events/v1/event_type.py index f379c2437..8f9784e77 100644 --- a/twilio/rest/events/v1/event_type.py +++ b/twilio/rest/events/v1/event_type.py @@ -12,6 +12,7 @@ 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 @@ -24,10 +25,12 @@ class EventTypeInstance(InstanceResource): + """ :ivar type: A string that uniquely identifies this Event Type. :ivar schema_id: A string that uniquely identifies the Schema this Event Type adheres to. :ivar date_created: The date that this Event Type was created, given in ISO 8601 format. + :ivar public: :ivar date_updated: The date that this Event Type was updated, given in ISO 8601 format. :ivar description: A human readable description for this Event Type. :ivar status: A string that describes how this Event Type can be used. For example: `available`, `deprecated`, `restricted`, `discontinued`. When the status is `available`, the Event Type can be used normally. @@ -46,6 +49,7 @@ def __init__( self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) + self.public: Optional[bool] = payload.get("public") self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_updated") ) @@ -75,41 +79,61 @@ def _proxy(self) -> "EventTypeContext": ) return self._context - def fetch(self) -> "EventTypeInstance": + def fetch( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> "EventTypeInstance": """ Fetch the EventTypeInstance + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :returns: The fetched EventTypeInstance """ - return self._proxy.fetch() + return self._proxy.fetch( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, + ) - async def fetch_async(self) -> "EventTypeInstance": + async def fetch_async( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> "EventTypeInstance": """ Asynchronous coroutine to fetch the EventTypeInstance + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :returns: The fetched EventTypeInstance """ - return await self._proxy.fetch_async() + return await self._proxy.fetch_async( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, + ) - def fetch_with_http_info(self) -> ApiResponse: + def fetch_with_http_info( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> ApiResponse: """ Fetch the EventTypeInstance with HTTP info + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :returns: ApiResponse with instance, status code, and headers """ - return self._proxy.fetch_with_http_info() + return self._proxy.fetch_with_http_info( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, + ) - async def fetch_with_http_info_async(self) -> ApiResponse: + async def fetch_with_http_info_async( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> ApiResponse: """ Asynchronous coroutine to fetch the EventTypeInstance with HTTP info + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :returns: ApiResponse with instance, status code, and headers """ - return await self._proxy.fetch_with_http_info_async() + return await self._proxy.fetch_with_http_info_async( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, + ) def __repr__(self) -> str: """ @@ -122,7 +146,6 @@ def __repr__(self) -> str: class EventTypeContext(InstanceContext): - def __init__(self, version: Version, type: str): """ Initialize the EventTypeContext @@ -138,7 +161,9 @@ def __init__(self, version: Version, type: str): } self._uri = "/Types/{type}".format(**self._solution) - def _fetch(self) -> tuple: + def _fetch( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> tuple: """ Internal helper for fetch operation @@ -148,34 +173,50 @@ def _fetch(self) -> tuple: headers = values.of({}) + if not ( + x_twilio_catalog_waiver is values.unset + or ( + isinstance(x_twilio_catalog_waiver, str) and not x_twilio_catalog_waiver + ) + ): + headers["X-Twilio-Catalog-Waiver"] = x_twilio_catalog_waiver + headers["Accept"] = "application/json" return self._version.fetch_with_response_info( method="GET", uri=self._uri, headers=headers ) - def fetch(self) -> EventTypeInstance: + def fetch( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> EventTypeInstance: """ Fetch the EventTypeInstance + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :returns: The fetched EventTypeInstance """ - payload, _, _ = self._fetch() + payload, _, _ = self._fetch(x_twilio_catalog_waiver=x_twilio_catalog_waiver) return EventTypeInstance( self._version, payload, type=self._solution["type"], ) - def fetch_with_http_info(self) -> ApiResponse: + def fetch_with_http_info( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> ApiResponse: """ Fetch the EventTypeInstance and return response metadata + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :returns: ApiResponse with instance, status code, and headers """ - payload, status_code, headers = self._fetch() + payload, status_code, headers = self._fetch( + x_twilio_catalog_waiver=x_twilio_catalog_waiver + ) instance = EventTypeInstance( self._version, payload, @@ -183,7 +224,9 @@ def fetch_with_http_info(self) -> ApiResponse: ) return ApiResponse(data=instance, status_code=status_code, headers=headers) - async def _fetch_async(self) -> tuple: + async def _fetch_async( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> tuple: """ Internal async helper for fetch operation @@ -193,34 +236,52 @@ async def _fetch_async(self) -> tuple: headers = values.of({}) + if not ( + x_twilio_catalog_waiver is values.unset + or ( + isinstance(x_twilio_catalog_waiver, str) and not x_twilio_catalog_waiver + ) + ): + headers["X-Twilio-Catalog-Waiver"] = x_twilio_catalog_waiver + headers["Accept"] = "application/json" return await self._version.fetch_with_response_info_async( method="GET", uri=self._uri, headers=headers ) - async def fetch_async(self) -> EventTypeInstance: + async def fetch_async( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> EventTypeInstance: """ Asynchronous coroutine to fetch the EventTypeInstance + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :returns: The fetched EventTypeInstance """ - payload, _, _ = await self._fetch_async() + payload, _, _ = await self._fetch_async( + x_twilio_catalog_waiver=x_twilio_catalog_waiver + ) return EventTypeInstance( self._version, payload, type=self._solution["type"], ) - async def fetch_with_http_info_async(self) -> ApiResponse: + async def fetch_with_http_info_async( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> ApiResponse: """ Asynchronous coroutine to fetch the EventTypeInstance and return response metadata + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :returns: ApiResponse with instance, status code, and headers """ - payload, status_code, headers = await self._fetch_async() + payload, status_code, headers = await self._fetch_async( + x_twilio_catalog_waiver=x_twilio_catalog_waiver + ) instance = EventTypeInstance( self._version, payload, @@ -239,7 +300,6 @@ def __repr__(self) -> str: class EventTypePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> EventTypeInstance: """ Build an instance of EventTypeInstance @@ -258,7 +318,6 @@ def __repr__(self) -> str: class EventTypeList(ListResource): - def __init__(self, version: Version): """ Initialize the EventTypeList @@ -272,6 +331,7 @@ def __init__(self, version: Version): def stream( self, + x_twilio_catalog_waiver: Union[str, object] = values.unset, schema_id: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, @@ -282,6 +342,7 @@ def stream( is reached. The results are returned as a generator, so this operation is memory efficient. + :param str x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :param str schema_id: A string parameter filtering the results to return only the Event Types using a given schema. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit @@ -293,12 +354,17 @@ def stream( :returns: Generator that will yield up to limit results """ limits = self._version.read_limits(limit, page_size) - page = self.page(schema_id=schema_id, page_size=limits["page_size"]) + page = self.page( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, + schema_id=schema_id, + page_size=limits["page_size"], + ) return self._version.stream(page, limits["limit"]) async def stream_async( self, + x_twilio_catalog_waiver: Union[str, object] = values.unset, schema_id: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, @@ -309,6 +375,7 @@ async def stream_async( is reached. The results are returned as a generator, so this operation is memory efficient. + :param str x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :param str schema_id: A string parameter filtering the results to return only the Event Types using a given schema. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit @@ -320,12 +387,17 @@ async def stream_async( :returns: Generator that will yield up to limit results """ limits = self._version.read_limits(limit, page_size) - page = await self.page_async(schema_id=schema_id, page_size=limits["page_size"]) + page = await self.page_async( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, + schema_id=schema_id, + page_size=limits["page_size"], + ) return self._version.stream_async(page, limits["limit"]) def stream_with_http_info( self, + x_twilio_catalog_waiver: Union[str, object] = values.unset, schema_id: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, @@ -334,6 +406,7 @@ def stream_with_http_info( Streams EventTypeInstance and returns headers from first page + :param str x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :param str schema_id: A string parameter filtering the results to return only the Event Types using a given schema. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit @@ -346,7 +419,9 @@ def stream_with_http_info( """ limits = self._version.read_limits(limit, page_size) page_response = self.page_with_http_info( - schema_id=schema_id, page_size=limits["page_size"] + x_twilio_catalog_waiver=x_twilio_catalog_waiver, + schema_id=schema_id, + page_size=limits["page_size"], ) generator = self._version.stream(page_response.data, limits["limit"]) @@ -354,6 +429,7 @@ def stream_with_http_info( async def stream_with_http_info_async( self, + x_twilio_catalog_waiver: Union[str, object] = values.unset, schema_id: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, @@ -362,6 +438,7 @@ async def stream_with_http_info_async( Asynchronously streams EventTypeInstance and returns headers from first page + :param str x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :param str schema_id: A string parameter filtering the results to return only the Event Types using a given schema. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit @@ -374,7 +451,9 @@ async def stream_with_http_info_async( """ limits = self._version.read_limits(limit, page_size) page_response = await self.page_with_http_info_async( - schema_id=schema_id, page_size=limits["page_size"] + x_twilio_catalog_waiver=x_twilio_catalog_waiver, + schema_id=schema_id, + page_size=limits["page_size"], ) generator = self._version.stream_async(page_response.data, limits["limit"]) @@ -382,6 +461,7 @@ async def stream_with_http_info_async( def list( self, + x_twilio_catalog_waiver: Union[str, object] = values.unset, schema_id: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, @@ -391,6 +471,7 @@ def list( Unlike stream(), this operation is eager and will load `limit` records into memory before returning. + :param str x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :param str schema_id: A string parameter filtering the results to return only the Event Types using a given schema. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit @@ -403,6 +484,7 @@ def list( """ return list( self.stream( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, schema_id=schema_id, limit=limit, page_size=page_size, @@ -411,6 +493,7 @@ def list( async def list_async( self, + x_twilio_catalog_waiver: Union[str, object] = values.unset, schema_id: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, @@ -420,6 +503,7 @@ async def list_async( Unlike stream(), this operation is eager and will load `limit` records into memory before returning. + :param str x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :param str schema_id: A string parameter filtering the results to return only the Event Types using a given schema. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit @@ -433,6 +517,7 @@ async def list_async( return [ record async for record in await self.stream_async( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, schema_id=schema_id, limit=limit, page_size=page_size, @@ -441,6 +526,7 @@ async def list_async( def list_with_http_info( self, + x_twilio_catalog_waiver: Union[str, object] = values.unset, schema_id: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, @@ -449,6 +535,7 @@ def list_with_http_info( Lists EventTypeInstance and returns headers from first page + :param str x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :param str schema_id: A string parameter filtering the results to return only the Event Types using a given schema. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit @@ -460,6 +547,7 @@ def list_with_http_info( :returns: ApiResponse with list of instances, status code, and headers """ generator, status_code, headers = self.stream_with_http_info( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, schema_id=schema_id, limit=limit, page_size=page_size, @@ -469,6 +557,7 @@ def list_with_http_info( async def list_with_http_info_async( self, + x_twilio_catalog_waiver: Union[str, object] = values.unset, schema_id: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, @@ -477,6 +566,7 @@ async def list_with_http_info_async( Asynchronously lists EventTypeInstance and returns headers from first page + :param str x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :param str schema_id: A string parameter filtering the results to return only the Event Types using a given schema. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit @@ -488,6 +578,7 @@ async def list_with_http_info_async( :returns: ApiResponse with list of instances, status code, and headers """ generator, status_code, headers = await self.stream_with_http_info_async( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, schema_id=schema_id, limit=limit, page_size=page_size, @@ -497,6 +588,7 @@ async def list_with_http_info_async( def page( self, + x_twilio_catalog_waiver: Union[str, object] = values.unset, schema_id: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, @@ -506,6 +598,7 @@ def page( Retrieve a single page of EventTypeInstance records from the API. Request is executed immediately + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :param schema_id: A string parameter filtering the results to return only the Event Types using a given schema. :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state @@ -515,6 +608,7 @@ def page( """ data = values.of( { + "X-Twilio-Catalog-Waiver": x_twilio_catalog_waiver, "SchemaId": schema_id, "PageToken": page_token, "Page": page_number, @@ -522,7 +616,12 @@ def page( } ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers = values.of( + { + "X-Twilio-Catalog-Waiver": x_twilio_catalog_waiver, + "Content-Type": "application/x-www-form-urlencoded", + } + ) headers["Accept"] = "application/json" @@ -533,6 +632,7 @@ def page( async def page_async( self, + x_twilio_catalog_waiver: Union[str, object] = values.unset, schema_id: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, @@ -542,6 +642,7 @@ async def page_async( Asynchronously retrieve a single page of EventTypeInstance records from the API. Request is executed immediately + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :param schema_id: A string parameter filtering the results to return only the Event Types using a given schema. :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state @@ -551,6 +652,7 @@ async def page_async( """ data = values.of( { + "X-Twilio-Catalog-Waiver": x_twilio_catalog_waiver, "SchemaId": schema_id, "PageToken": page_token, "Page": page_number, @@ -558,7 +660,12 @@ async def page_async( } ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers = values.of( + { + "X-Twilio-Catalog-Waiver": x_twilio_catalog_waiver, + "Content-Type": "application/x-www-form-urlencoded", + } + ) headers["Accept"] = "application/json" @@ -569,6 +676,7 @@ async def page_async( def page_with_http_info( self, + x_twilio_catalog_waiver: Union[str, object] = values.unset, schema_id: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, @@ -578,6 +686,7 @@ def page_with_http_info( Retrieve a single page with response metadata + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :param schema_id: A string parameter filtering the results to return only the Event Types using a given schema. :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state @@ -587,6 +696,7 @@ def page_with_http_info( """ data = values.of( { + "X-Twilio-Catalog-Waiver": x_twilio_catalog_waiver, "SchemaId": schema_id, "PageToken": page_token, "Page": page_number, @@ -594,7 +704,12 @@ def page_with_http_info( } ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers = values.of( + { + "X-Twilio-Catalog-Waiver": x_twilio_catalog_waiver, + "Content-Type": "application/x-www-form-urlencoded", + } + ) headers["Accept"] = "application/json" @@ -606,6 +721,7 @@ def page_with_http_info( async def page_with_http_info_async( self, + x_twilio_catalog_waiver: Union[str, object] = values.unset, schema_id: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, @@ -615,6 +731,7 @@ async def page_with_http_info_async( Asynchronously retrieve a single page with response metadata + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :param schema_id: A string parameter filtering the results to return only the Event Types using a given schema. :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state @@ -624,6 +741,7 @@ async def page_with_http_info_async( """ data = values.of( { + "X-Twilio-Catalog-Waiver": x_twilio_catalog_waiver, "SchemaId": schema_id, "PageToken": page_token, "Page": page_number, @@ -631,14 +749,21 @@ async def page_with_http_info_async( } ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers = values.of( + { + "X-Twilio-Catalog-Waiver": x_twilio_catalog_waiver, + "Content-Type": "application/x-www-form-urlencoded", + } + ) headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = EventTypePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/events/v1/schema/__init__.py b/twilio/rest/events/v1/schema/__init__.py index e81b663f8..30b00d3f2 100644 --- a/twilio/rest/events/v1/schema/__init__.py +++ b/twilio/rest/events/v1/schema/__init__.py @@ -12,8 +12,9 @@ Do not edit the class manually. """ + from datetime import datetime -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union from twilio.base import deserialize, values from twilio.base.api_response import ApiResponse from twilio.base.instance_context import InstanceContext @@ -25,6 +26,7 @@ class SchemaInstance(InstanceResource): + """ :ivar id: The unique identifier of the schema. Each schema can have multiple versions, that share the same id. :ivar url: The URL of this resource. @@ -41,9 +43,9 @@ def __init__( self.id: Optional[str] = payload.get("id") self.url: Optional[str] = payload.get("url") self.links: Optional[Dict[str, object]] = payload.get("links") - self.latest_version_date_created: Optional[datetime] = ( - deserialize.iso8601_datetime(payload.get("latest_version_date_created")) - ) + self.latest_version_date_created: Optional[ + datetime + ] = deserialize.iso8601_datetime(payload.get("latest_version_date_created")) self.latest_version: Optional[int] = deserialize.integer( payload.get("latest_version") ) @@ -68,41 +70,61 @@ def _proxy(self) -> "SchemaContext": ) return self._context - def fetch(self) -> "SchemaInstance": + def fetch( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> "SchemaInstance": """ Fetch the SchemaInstance + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :returns: The fetched SchemaInstance """ - return self._proxy.fetch() + return self._proxy.fetch( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, + ) - async def fetch_async(self) -> "SchemaInstance": + async def fetch_async( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> "SchemaInstance": """ Asynchronous coroutine to fetch the SchemaInstance + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :returns: The fetched SchemaInstance """ - return await self._proxy.fetch_async() + return await self._proxy.fetch_async( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, + ) - def fetch_with_http_info(self) -> ApiResponse: + def fetch_with_http_info( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> ApiResponse: """ Fetch the SchemaInstance with HTTP info + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :returns: ApiResponse with instance, status code, and headers """ - return self._proxy.fetch_with_http_info() + return self._proxy.fetch_with_http_info( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, + ) - async def fetch_with_http_info_async(self) -> ApiResponse: + async def fetch_with_http_info_async( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> ApiResponse: """ Asynchronous coroutine to fetch the SchemaInstance with HTTP info + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :returns: ApiResponse with instance, status code, and headers """ - return await self._proxy.fetch_with_http_info_async() + return await self._proxy.fetch_with_http_info_async( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, + ) @property def versions(self) -> SchemaVersionList: @@ -122,7 +144,6 @@ def __repr__(self) -> str: class SchemaContext(InstanceContext): - def __init__(self, version: Version, id: str): """ Initialize the SchemaContext @@ -140,7 +161,9 @@ def __init__(self, version: Version, id: str): self._versions: Optional[SchemaVersionList] = None - def _fetch(self) -> tuple: + def _fetch( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> tuple: """ Internal helper for fetch operation @@ -150,34 +173,50 @@ def _fetch(self) -> tuple: headers = values.of({}) + if not ( + x_twilio_catalog_waiver is values.unset + or ( + isinstance(x_twilio_catalog_waiver, str) and not x_twilio_catalog_waiver + ) + ): + headers["X-Twilio-Catalog-Waiver"] = x_twilio_catalog_waiver + headers["Accept"] = "application/json" return self._version.fetch_with_response_info( method="GET", uri=self._uri, headers=headers ) - def fetch(self) -> SchemaInstance: + def fetch( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> SchemaInstance: """ Fetch the SchemaInstance + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :returns: The fetched SchemaInstance """ - payload, _, _ = self._fetch() + payload, _, _ = self._fetch(x_twilio_catalog_waiver=x_twilio_catalog_waiver) return SchemaInstance( self._version, payload, id=self._solution["id"], ) - def fetch_with_http_info(self) -> ApiResponse: + def fetch_with_http_info( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> ApiResponse: """ Fetch the SchemaInstance and return response metadata + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :returns: ApiResponse with instance, status code, and headers """ - payload, status_code, headers = self._fetch() + payload, status_code, headers = self._fetch( + x_twilio_catalog_waiver=x_twilio_catalog_waiver + ) instance = SchemaInstance( self._version, payload, @@ -185,7 +224,9 @@ def fetch_with_http_info(self) -> ApiResponse: ) return ApiResponse(data=instance, status_code=status_code, headers=headers) - async def _fetch_async(self) -> tuple: + async def _fetch_async( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> tuple: """ Internal async helper for fetch operation @@ -195,34 +236,52 @@ async def _fetch_async(self) -> tuple: headers = values.of({}) + if not ( + x_twilio_catalog_waiver is values.unset + or ( + isinstance(x_twilio_catalog_waiver, str) and not x_twilio_catalog_waiver + ) + ): + headers["X-Twilio-Catalog-Waiver"] = x_twilio_catalog_waiver + headers["Accept"] = "application/json" return await self._version.fetch_with_response_info_async( method="GET", uri=self._uri, headers=headers ) - async def fetch_async(self) -> SchemaInstance: + async def fetch_async( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> SchemaInstance: """ Asynchronous coroutine to fetch the SchemaInstance + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :returns: The fetched SchemaInstance """ - payload, _, _ = await self._fetch_async() + payload, _, _ = await self._fetch_async( + x_twilio_catalog_waiver=x_twilio_catalog_waiver + ) return SchemaInstance( self._version, payload, id=self._solution["id"], ) - async def fetch_with_http_info_async(self) -> ApiResponse: + async def fetch_with_http_info_async( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> ApiResponse: """ Asynchronous coroutine to fetch the SchemaInstance and return response metadata + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :returns: ApiResponse with instance, status code, and headers """ - payload, status_code, headers = await self._fetch_async() + payload, status_code, headers = await self._fetch_async( + x_twilio_catalog_waiver=x_twilio_catalog_waiver + ) instance = SchemaInstance( self._version, payload, @@ -253,7 +312,6 @@ def __repr__(self) -> str: class SchemaList(ListResource): - def __init__(self, version: Version): """ Initialize the SchemaList diff --git a/twilio/rest/events/v1/schema/schema_version.py b/twilio/rest/events/v1/schema/schema_version.py index d60210341..84d903d4b 100644 --- a/twilio/rest/events/v1/schema/schema_version.py +++ b/twilio/rest/events/v1/schema/schema_version.py @@ -12,6 +12,7 @@ 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 @@ -24,10 +25,12 @@ class SchemaVersionInstance(InstanceResource): + """ :ivar id: The unique identifier of the schema. Each schema can have multiple versions, that share the same id. :ivar schema_version: The version of this schema. :ivar date_created: The date the schema version was created, given in ISO 8601 format. + :ivar public: :ivar url: The URL of this resource. :ivar raw: """ @@ -48,6 +51,7 @@ def __init__( self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) + self.public: Optional[bool] = payload.get("public") self.url: Optional[str] = payload.get("url") self.raw: Optional[str] = payload.get("raw") @@ -73,41 +77,61 @@ def _proxy(self) -> "SchemaVersionContext": ) return self._context - def fetch(self) -> "SchemaVersionInstance": + def fetch( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> "SchemaVersionInstance": """ Fetch the SchemaVersionInstance + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :returns: The fetched SchemaVersionInstance """ - return self._proxy.fetch() + return self._proxy.fetch( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, + ) - async def fetch_async(self) -> "SchemaVersionInstance": + async def fetch_async( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> "SchemaVersionInstance": """ Asynchronous coroutine to fetch the SchemaVersionInstance + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :returns: The fetched SchemaVersionInstance """ - return await self._proxy.fetch_async() + return await self._proxy.fetch_async( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, + ) - def fetch_with_http_info(self) -> ApiResponse: + def fetch_with_http_info( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> ApiResponse: """ Fetch the SchemaVersionInstance with HTTP info + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :returns: ApiResponse with instance, status code, and headers """ - return self._proxy.fetch_with_http_info() + return self._proxy.fetch_with_http_info( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, + ) - async def fetch_with_http_info_async(self) -> ApiResponse: + async def fetch_with_http_info_async( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> ApiResponse: """ Asynchronous coroutine to fetch the SchemaVersionInstance with HTTP info + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :returns: ApiResponse with instance, status code, and headers """ - return await self._proxy.fetch_with_http_info_async() + return await self._proxy.fetch_with_http_info_async( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, + ) def __repr__(self) -> str: """ @@ -120,7 +144,6 @@ def __repr__(self) -> str: class SchemaVersionContext(InstanceContext): - def __init__(self, version: Version, id: str, schema_version: int): """ Initialize the SchemaVersionContext @@ -138,7 +161,9 @@ def __init__(self, version: Version, id: str, schema_version: int): } self._uri = "/Schemas/{id}/Versions/{schema_version}".format(**self._solution) - def _fetch(self) -> tuple: + def _fetch( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> tuple: """ Internal helper for fetch operation @@ -148,20 +173,31 @@ def _fetch(self) -> tuple: headers = values.of({}) + if not ( + x_twilio_catalog_waiver is values.unset + or ( + isinstance(x_twilio_catalog_waiver, str) and not x_twilio_catalog_waiver + ) + ): + headers["X-Twilio-Catalog-Waiver"] = x_twilio_catalog_waiver + headers["Accept"] = "application/json" return self._version.fetch_with_response_info( method="GET", uri=self._uri, headers=headers ) - def fetch(self) -> SchemaVersionInstance: + def fetch( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> SchemaVersionInstance: """ Fetch the SchemaVersionInstance + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :returns: The fetched SchemaVersionInstance """ - payload, _, _ = self._fetch() + payload, _, _ = self._fetch(x_twilio_catalog_waiver=x_twilio_catalog_waiver) return SchemaVersionInstance( self._version, payload, @@ -169,14 +205,19 @@ def fetch(self) -> SchemaVersionInstance: schema_version=self._solution["schema_version"], ) - def fetch_with_http_info(self) -> ApiResponse: + def fetch_with_http_info( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> ApiResponse: """ Fetch the SchemaVersionInstance and return response metadata + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :returns: ApiResponse with instance, status code, and headers """ - payload, status_code, headers = self._fetch() + payload, status_code, headers = self._fetch( + x_twilio_catalog_waiver=x_twilio_catalog_waiver + ) instance = SchemaVersionInstance( self._version, payload, @@ -185,7 +226,9 @@ def fetch_with_http_info(self) -> ApiResponse: ) return ApiResponse(data=instance, status_code=status_code, headers=headers) - async def _fetch_async(self) -> tuple: + async def _fetch_async( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> tuple: """ Internal async helper for fetch operation @@ -195,20 +238,33 @@ async def _fetch_async(self) -> tuple: headers = values.of({}) + if not ( + x_twilio_catalog_waiver is values.unset + or ( + isinstance(x_twilio_catalog_waiver, str) and not x_twilio_catalog_waiver + ) + ): + headers["X-Twilio-Catalog-Waiver"] = x_twilio_catalog_waiver + headers["Accept"] = "application/json" return await self._version.fetch_with_response_info_async( method="GET", uri=self._uri, headers=headers ) - async def fetch_async(self) -> SchemaVersionInstance: + async def fetch_async( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> SchemaVersionInstance: """ Asynchronous coroutine to fetch the SchemaVersionInstance + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :returns: The fetched SchemaVersionInstance """ - payload, _, _ = await self._fetch_async() + payload, _, _ = await self._fetch_async( + x_twilio_catalog_waiver=x_twilio_catalog_waiver + ) return SchemaVersionInstance( self._version, payload, @@ -216,14 +272,19 @@ async def fetch_async(self) -> SchemaVersionInstance: schema_version=self._solution["schema_version"], ) - async def fetch_with_http_info_async(self) -> ApiResponse: + async def fetch_with_http_info_async( + self, x_twilio_catalog_waiver: Union[str, object] = values.unset + ) -> ApiResponse: """ Asynchronous coroutine to fetch the SchemaVersionInstance and return response metadata + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :returns: ApiResponse with instance, status code, and headers """ - payload, status_code, headers = await self._fetch_async() + payload, status_code, headers = await self._fetch_async( + x_twilio_catalog_waiver=x_twilio_catalog_waiver + ) instance = SchemaVersionInstance( self._version, payload, @@ -243,7 +304,6 @@ def __repr__(self) -> str: class SchemaVersionPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SchemaVersionInstance: """ Build an instance of SchemaVersionInstance @@ -262,7 +322,6 @@ def __repr__(self) -> str: class SchemaVersionList(ListResource): - def __init__(self, version: Version, id: str): """ Initialize the SchemaVersionList @@ -281,6 +340,7 @@ def __init__(self, version: Version, id: str): def stream( self, + x_twilio_catalog_waiver: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> Iterator[SchemaVersionInstance]: @@ -290,6 +350,7 @@ def stream( is reached. The results are returned as a generator, so this operation is memory efficient. + :param str x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :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 @@ -300,12 +361,16 @@ def stream( :returns: Generator that will yield up to limit results """ limits = self._version.read_limits(limit, page_size) - page = self.page(page_size=limits["page_size"]) + page = self.page( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, + page_size=limits["page_size"], + ) return self._version.stream(page, limits["limit"]) async def stream_async( self, + x_twilio_catalog_waiver: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> AsyncIterator[SchemaVersionInstance]: @@ -315,6 +380,7 @@ async def stream_async( is reached. The results are returned as a generator, so this operation is memory efficient. + :param str x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :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 @@ -325,12 +391,16 @@ async def stream_async( :returns: Generator that will yield up to limit results """ limits = self._version.read_limits(limit, page_size) - page = await self.page_async(page_size=limits["page_size"]) + page = await self.page_async( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, + page_size=limits["page_size"], + ) return self._version.stream_async(page, limits["limit"]) def stream_with_http_info( self, + x_twilio_catalog_waiver: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> tuple: @@ -338,6 +408,7 @@ def stream_with_http_info( Streams SchemaVersionInstance and returns headers from first page + :param str x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :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 @@ -348,13 +419,17 @@ def stream_with_http_info( :returns: tuple of (generator, status_code, headers) where generator yields instances """ limits = self._version.read_limits(limit, page_size) - page_response = self.page_with_http_info(page_size=limits["page_size"]) + page_response = self.page_with_http_info( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, + page_size=limits["page_size"], + ) generator = self._version.stream(page_response.data, limits["limit"]) return (generator, page_response.status_code, page_response.headers) async def stream_with_http_info_async( self, + x_twilio_catalog_waiver: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> tuple: @@ -362,6 +437,7 @@ async def stream_with_http_info_async( Asynchronously streams SchemaVersionInstance and returns headers from first page + :param str x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :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 @@ -373,7 +449,8 @@ async def stream_with_http_info_async( """ limits = self._version.read_limits(limit, page_size) page_response = await self.page_with_http_info_async( - page_size=limits["page_size"] + x_twilio_catalog_waiver=x_twilio_catalog_waiver, + page_size=limits["page_size"], ) generator = self._version.stream_async(page_response.data, limits["limit"]) @@ -381,6 +458,7 @@ async def stream_with_http_info_async( def list( self, + x_twilio_catalog_waiver: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[SchemaVersionInstance]: @@ -389,6 +467,7 @@ def list( Unlike stream(), this operation is eager and will load `limit` records into memory before returning. + :param str x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :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 @@ -400,6 +479,7 @@ def list( """ return list( self.stream( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, limit=limit, page_size=page_size, ) @@ -407,6 +487,7 @@ def list( async def list_async( self, + x_twilio_catalog_waiver: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[SchemaVersionInstance]: @@ -415,6 +496,7 @@ async def list_async( Unlike stream(), this operation is eager and will load `limit` records into memory before returning. + :param str x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :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 @@ -427,6 +509,7 @@ async def list_async( return [ record async for record in await self.stream_async( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, limit=limit, page_size=page_size, ) @@ -434,6 +517,7 @@ async def list_async( def list_with_http_info( self, + x_twilio_catalog_waiver: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> ApiResponse: @@ -441,6 +525,7 @@ def list_with_http_info( Lists SchemaVersionInstance and returns headers from first page + :param str x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :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 @@ -451,6 +536,7 @@ def list_with_http_info( :returns: ApiResponse with list of instances, status code, and headers """ generator, status_code, headers = self.stream_with_http_info( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, limit=limit, page_size=page_size, ) @@ -459,6 +545,7 @@ def list_with_http_info( async def list_with_http_info_async( self, + x_twilio_catalog_waiver: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> ApiResponse: @@ -466,6 +553,7 @@ async def list_with_http_info_async( Asynchronously lists SchemaVersionInstance and returns headers from first page + :param str x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :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 @@ -476,6 +564,7 @@ async def list_with_http_info_async( :returns: ApiResponse with list of instances, status code, and headers """ generator, status_code, headers = await self.stream_with_http_info_async( + x_twilio_catalog_waiver=x_twilio_catalog_waiver, limit=limit, page_size=page_size, ) @@ -484,6 +573,7 @@ async def list_with_http_info_async( def page( self, + x_twilio_catalog_waiver: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -492,6 +582,7 @@ def page( Retrieve a single page of SchemaVersionInstance records from the API. Request is executed immediately + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :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 @@ -500,13 +591,19 @@ def page( """ data = values.of( { + "X-Twilio-Catalog-Waiver": x_twilio_catalog_waiver, "PageToken": page_token, "Page": page_number, "PageSize": page_size, } ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers = values.of( + { + "X-Twilio-Catalog-Waiver": x_twilio_catalog_waiver, + "Content-Type": "application/x-www-form-urlencoded", + } + ) headers["Accept"] = "application/json" @@ -517,6 +614,7 @@ def page( async def page_async( self, + x_twilio_catalog_waiver: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -525,6 +623,7 @@ async def page_async( Asynchronously retrieve a single page of SchemaVersionInstance records from the API. Request is executed immediately + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :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 @@ -533,13 +632,19 @@ async def page_async( """ data = values.of( { + "X-Twilio-Catalog-Waiver": x_twilio_catalog_waiver, "PageToken": page_token, "Page": page_number, "PageSize": page_size, } ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers = values.of( + { + "X-Twilio-Catalog-Waiver": x_twilio_catalog_waiver, + "Content-Type": "application/x-www-form-urlencoded", + } + ) headers["Accept"] = "application/json" @@ -550,6 +655,7 @@ async def page_async( def page_with_http_info( self, + x_twilio_catalog_waiver: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -558,6 +664,7 @@ def page_with_http_info( Retrieve a single page with response metadata + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :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 @@ -566,13 +673,19 @@ def page_with_http_info( """ data = values.of( { + "X-Twilio-Catalog-Waiver": x_twilio_catalog_waiver, "PageToken": page_token, "Page": page_number, "PageSize": page_size, } ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers = values.of( + { + "X-Twilio-Catalog-Waiver": x_twilio_catalog_waiver, + "Content-Type": "application/x-www-form-urlencoded", + } + ) headers["Accept"] = "application/json" @@ -584,6 +697,7 @@ def page_with_http_info( async def page_with_http_info_async( self, + x_twilio_catalog_waiver: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -592,6 +706,7 @@ async def page_with_http_info_async( Asynchronously retrieve a single page with response metadata + :param x_twilio_catalog_waiver: The X-Twilio-Catalog-Waiver HTTP request header :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 @@ -600,20 +715,28 @@ async def page_with_http_info_async( """ data = values.of( { + "X-Twilio-Catalog-Waiver": x_twilio_catalog_waiver, "PageToken": page_token, "Page": page_number, "PageSize": page_size, } ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers = values.of( + { + "X-Twilio-Catalog-Waiver": x_twilio_catalog_waiver, + "Content-Type": "application/x-www-form-urlencoded", + } + ) headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SchemaVersionPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/events/v1/sink/__init__.py b/twilio/rest/events/v1/sink/__init__.py index 8e9e73716..1cd86d322 100644 --- a/twilio/rest/events/v1/sink/__init__.py +++ b/twilio/rest/events/v1/sink/__init__.py @@ -12,6 +12,7 @@ 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 @@ -26,7 +27,6 @@ class SinkInstance(InstanceResource): - class SinkType(object): KINESIS = "kinesis" WEBHOOK = "webhook" @@ -237,7 +237,6 @@ def __repr__(self) -> str: class SinkContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the SinkContext @@ -543,7 +542,6 @@ def __repr__(self) -> str: class SinkPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SinkInstance: """ Build an instance of SinkInstance @@ -562,7 +560,6 @@ def __repr__(self) -> str: class SinkList(ListResource): - def __init__(self, version: Version): """ Initialize the SinkList @@ -1123,10 +1120,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SinkPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/events/v1/sink/sink_test.py b/twilio/rest/events/v1/sink/sink_test.py index 7d253b753..271d43dc4 100644 --- a/twilio/rest/events/v1/sink/sink_test.py +++ b/twilio/rest/events/v1/sink/sink_test.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class SinkTestInstance(InstanceResource): + """ :ivar result: Feedback indicating whether the test event was generated. """ @@ -46,7 +48,6 @@ def __repr__(self) -> str: class SinkTestList(ListResource): - def __init__(self, version: Version, sid: str): """ Initialize the SinkTestList diff --git a/twilio/rest/events/v1/sink/sink_validate.py b/twilio/rest/events/v1/sink/sink_validate.py index aa7a16967..d2ed57bb7 100644 --- a/twilio/rest/events/v1/sink/sink_validate.py +++ b/twilio/rest/events/v1/sink/sink_validate.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class SinkValidateInstance(InstanceResource): + """ :ivar result: Feedback indicating whether the given Sink was validated. """ @@ -46,7 +48,6 @@ def __repr__(self) -> str: class SinkValidateList(ListResource): - def __init__(self, version: Version, sid: str): """ Initialize the SinkValidateList diff --git a/twilio/rest/events/v1/subscription/__init__.py b/twilio/rest/events/v1/subscription/__init__.py index 72d842117..2939b65d4 100644 --- a/twilio/rest/events/v1/subscription/__init__.py +++ b/twilio/rest/events/v1/subscription/__init__.py @@ -12,6 +12,7 @@ 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 @@ -25,6 +26,7 @@ class SubscriptionInstance(InstanceResource): + """ :ivar account_sid: The unique SID identifier of the Account. :ivar sid: A 34 character string that uniquely identifies this Subscription. @@ -34,6 +36,8 @@ class SubscriptionInstance(InstanceResource): :ivar sink_sid: The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. :ivar url: The URL of this resource. :ivar links: Contains a dictionary of URL links to nested resources of this Subscription. + :ivar receive_events_from_subaccounts: Receive events from all children accounts in the parent account subscription. + :ivar filter: Filter out events that don't satisfy this expression. """ def __init__( @@ -53,6 +57,10 @@ def __init__( self.sink_sid: Optional[str] = payload.get("sink_sid") self.url: Optional[str] = payload.get("url") self.links: Optional[Dict[str, object]] = payload.get("links") + self.receive_events_from_subaccounts: Optional[bool] = payload.get( + "receive_events_from_subaccounts" + ) + self.filter: Optional[str] = payload.get("filter") self._solution = { "sid": sid or self.sid, @@ -147,59 +155,87 @@ async def fetch_with_http_info_async(self) -> ApiResponse: return await self._proxy.fetch_with_http_info_async() def update( - self, description: Union[str, object] = values.unset + self, + description: Union[str, object] = values.unset, + receive_events_from_subaccounts: Union[bool, object] = values.unset, + filter: Union[str, object] = values.unset, ) -> "SubscriptionInstance": """ Update the SubscriptionInstance :param description: A human readable description for the Subscription. + :param receive_events_from_subaccounts: Receive events from all children accounts in the parent account subscription. + :param filter: Filter out events that don't satisfy this expression. :returns: The updated SubscriptionInstance """ return self._proxy.update( description=description, + receive_events_from_subaccounts=receive_events_from_subaccounts, + filter=filter, ) async def update_async( - self, description: Union[str, object] = values.unset + self, + description: Union[str, object] = values.unset, + receive_events_from_subaccounts: Union[bool, object] = values.unset, + filter: Union[str, object] = values.unset, ) -> "SubscriptionInstance": """ Asynchronous coroutine to update the SubscriptionInstance :param description: A human readable description for the Subscription. + :param receive_events_from_subaccounts: Receive events from all children accounts in the parent account subscription. + :param filter: Filter out events that don't satisfy this expression. :returns: The updated SubscriptionInstance """ return await self._proxy.update_async( description=description, + receive_events_from_subaccounts=receive_events_from_subaccounts, + filter=filter, ) def update_with_http_info( - self, description: Union[str, object] = values.unset + self, + description: Union[str, object] = values.unset, + receive_events_from_subaccounts: Union[bool, object] = values.unset, + filter: Union[str, object] = values.unset, ) -> ApiResponse: """ Update the SubscriptionInstance with HTTP info :param description: A human readable description for the Subscription. + :param receive_events_from_subaccounts: Receive events from all children accounts in the parent account subscription. + :param filter: Filter out events that don't satisfy this expression. :returns: ApiResponse with instance, status code, and headers """ return self._proxy.update_with_http_info( description=description, + receive_events_from_subaccounts=receive_events_from_subaccounts, + filter=filter, ) async def update_with_http_info_async( - self, description: Union[str, object] = values.unset + self, + description: Union[str, object] = values.unset, + receive_events_from_subaccounts: Union[bool, object] = values.unset, + filter: Union[str, object] = values.unset, ) -> ApiResponse: """ Asynchronous coroutine to update the SubscriptionInstance with HTTP info :param description: A human readable description for the Subscription. + :param receive_events_from_subaccounts: Receive events from all children accounts in the parent account subscription. + :param filter: Filter out events that don't satisfy this expression. :returns: ApiResponse with instance, status code, and headers """ return await self._proxy.update_with_http_info_async( description=description, + receive_events_from_subaccounts=receive_events_from_subaccounts, + filter=filter, ) @property @@ -220,7 +256,6 @@ def __repr__(self) -> str: class SubscriptionContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the SubscriptionContext @@ -396,7 +431,12 @@ async def fetch_with_http_info_async(self) -> ApiResponse: ) return ApiResponse(data=instance, status_code=status_code, headers=headers) - def _update(self, description: Union[str, object] = values.unset) -> tuple: + def _update( + self, + description: Union[str, object] = values.unset, + receive_events_from_subaccounts: Union[bool, object] = values.unset, + filter: Union[str, object] = values.unset, + ) -> tuple: """ Internal helper for update operation @@ -407,6 +447,10 @@ def _update(self, description: Union[str, object] = values.unset) -> tuple: data = values.of( { "Description": description, + "ReceiveEventsFromSubaccounts": serialize.boolean_to_string( + receive_events_from_subaccounts + ), + "Filter": filter, } ) headers = values.of({}) @@ -420,36 +464,57 @@ def _update(self, description: Union[str, object] = values.unset) -> tuple: ) def update( - self, description: Union[str, object] = values.unset + self, + description: Union[str, object] = values.unset, + receive_events_from_subaccounts: Union[bool, object] = values.unset, + filter: Union[str, object] = values.unset, ) -> SubscriptionInstance: """ Update the SubscriptionInstance :param description: A human readable description for the Subscription. + :param receive_events_from_subaccounts: Receive events from all children accounts in the parent account subscription. + :param filter: Filter out events that don't satisfy this expression. :returns: The updated SubscriptionInstance """ - payload, _, _ = self._update(description=description) + payload, _, _ = self._update( + description=description, + receive_events_from_subaccounts=receive_events_from_subaccounts, + filter=filter, + ) return SubscriptionInstance(self._version, payload, sid=self._solution["sid"]) def update_with_http_info( - self, description: Union[str, object] = values.unset + self, + description: Union[str, object] = values.unset, + receive_events_from_subaccounts: Union[bool, object] = values.unset, + filter: Union[str, object] = values.unset, ) -> ApiResponse: """ Update the SubscriptionInstance and return response metadata :param description: A human readable description for the Subscription. + :param receive_events_from_subaccounts: Receive events from all children accounts in the parent account subscription. + :param filter: Filter out events that don't satisfy this expression. :returns: ApiResponse with instance, status code, and headers """ - payload, status_code, headers = self._update(description=description) + payload, status_code, headers = self._update( + description=description, + receive_events_from_subaccounts=receive_events_from_subaccounts, + filter=filter, + ) instance = SubscriptionInstance( self._version, payload, sid=self._solution["sid"] ) return ApiResponse(data=instance, status_code=status_code, headers=headers) async def _update_async( - self, description: Union[str, object] = values.unset + self, + description: Union[str, object] = values.unset, + receive_events_from_subaccounts: Union[bool, object] = values.unset, + filter: Union[str, object] = values.unset, ) -> tuple: """ Internal async helper for update operation @@ -461,6 +526,10 @@ async def _update_async( data = values.of( { "Description": description, + "ReceiveEventsFromSubaccounts": serialize.boolean_to_string( + receive_events_from_subaccounts + ), + "Filter": filter, } ) headers = values.of({}) @@ -474,30 +543,46 @@ async def _update_async( ) async def update_async( - self, description: Union[str, object] = values.unset + self, + description: Union[str, object] = values.unset, + receive_events_from_subaccounts: Union[bool, object] = values.unset, + filter: Union[str, object] = values.unset, ) -> SubscriptionInstance: """ Asynchronous coroutine to update the SubscriptionInstance :param description: A human readable description for the Subscription. + :param receive_events_from_subaccounts: Receive events from all children accounts in the parent account subscription. + :param filter: Filter out events that don't satisfy this expression. :returns: The updated SubscriptionInstance """ - payload, _, _ = await self._update_async(description=description) + payload, _, _ = await self._update_async( + description=description, + receive_events_from_subaccounts=receive_events_from_subaccounts, + filter=filter, + ) return SubscriptionInstance(self._version, payload, sid=self._solution["sid"]) async def update_with_http_info_async( - self, description: Union[str, object] = values.unset + self, + description: Union[str, object] = values.unset, + receive_events_from_subaccounts: Union[bool, object] = values.unset, + filter: Union[str, object] = values.unset, ) -> ApiResponse: """ Asynchronous coroutine to update the SubscriptionInstance and return response metadata :param description: A human readable description for the Subscription. + :param receive_events_from_subaccounts: Receive events from all children accounts in the parent account subscription. + :param filter: Filter out events that don't satisfy this expression. :returns: ApiResponse with instance, status code, and headers """ payload, status_code, headers = await self._update_async( - description=description + description=description, + receive_events_from_subaccounts=receive_events_from_subaccounts, + filter=filter, ) instance = SubscriptionInstance( self._version, payload, sid=self._solution["sid"] @@ -527,7 +612,6 @@ def __repr__(self) -> str: class SubscriptionPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SubscriptionInstance: """ Build an instance of SubscriptionInstance @@ -546,7 +630,6 @@ def __repr__(self) -> str: class SubscriptionList(ListResource): - def __init__(self, version: Version): """ Initialize the SubscriptionList @@ -558,7 +641,15 @@ def __init__(self, version: Version): self._uri = "/Subscriptions" - def _create(self, description: str, sink_sid: str, types: List[object]) -> tuple: + def _create( + self, + description: str, + sink_sid: str, + types: List[object], + x_twilio_subscriptions_waiver: Union[str, object] = values.unset, + receive_events_from_subaccounts: Union[bool, object] = values.unset, + filter: Union[str, object] = values.unset, + ) -> tuple: """ Internal helper for create operation @@ -571,9 +662,18 @@ def _create(self, description: str, sink_sid: str, types: List[object]) -> tuple "Description": description, "SinkSid": sink_sid, "Types": serialize.map(types, lambda e: serialize.object(e)), + "ReceiveEventsFromSubaccounts": serialize.boolean_to_string( + receive_events_from_subaccounts + ), + "Filter": filter, + } + ) + headers = values.of( + { + "X-Twilio-Subscriptions-Waiver": x_twilio_subscriptions_waiver, + "Content-Type": "application/x-www-form-urlencoded", } ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) headers["Content-Type"] = "application/x-www-form-urlencoded" @@ -584,7 +684,13 @@ def _create(self, description: str, sink_sid: str, types: List[object]) -> tuple ) def create( - self, description: str, sink_sid: str, types: List[object] + self, + description: str, + sink_sid: str, + types: List[object], + x_twilio_subscriptions_waiver: Union[str, object] = values.unset, + receive_events_from_subaccounts: Union[bool, object] = values.unset, + filter: Union[str, object] = values.unset, ) -> SubscriptionInstance: """ Create the SubscriptionInstance @@ -592,16 +698,30 @@ def create( :param description: A human readable description for the Subscription **This value should not contain PII.** :param sink_sid: The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. :param types: An array of objects containing the subscribed Event Types + :param x_twilio_subscriptions_waiver: The X-Twilio-Subscriptions-Waiver HTTP request header + :param receive_events_from_subaccounts: Receive events from all children accounts in the parent account subscription. + :param filter: Filter out events that don't satisfy this expression. :returns: The created SubscriptionInstance """ payload, _, _ = self._create( - description=description, sink_sid=sink_sid, types=types + description=description, + sink_sid=sink_sid, + types=types, + x_twilio_subscriptions_waiver=x_twilio_subscriptions_waiver, + receive_events_from_subaccounts=receive_events_from_subaccounts, + filter=filter, ) return SubscriptionInstance(self._version, payload) def create_with_http_info( - self, description: str, sink_sid: str, types: List[object] + self, + description: str, + sink_sid: str, + types: List[object], + x_twilio_subscriptions_waiver: Union[str, object] = values.unset, + receive_events_from_subaccounts: Union[bool, object] = values.unset, + filter: Union[str, object] = values.unset, ) -> ApiResponse: """ Create the SubscriptionInstance and return response metadata @@ -609,17 +729,31 @@ def create_with_http_info( :param description: A human readable description for the Subscription **This value should not contain PII.** :param sink_sid: The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. :param types: An array of objects containing the subscribed Event Types + :param x_twilio_subscriptions_waiver: The X-Twilio-Subscriptions-Waiver HTTP request header + :param receive_events_from_subaccounts: Receive events from all children accounts in the parent account subscription. + :param filter: Filter out events that don't satisfy this expression. :returns: ApiResponse with instance, status code, and headers """ payload, status_code, headers = self._create( - description=description, sink_sid=sink_sid, types=types + description=description, + sink_sid=sink_sid, + types=types, + x_twilio_subscriptions_waiver=x_twilio_subscriptions_waiver, + receive_events_from_subaccounts=receive_events_from_subaccounts, + filter=filter, ) instance = SubscriptionInstance(self._version, payload) return ApiResponse(data=instance, status_code=status_code, headers=headers) async def _create_async( - self, description: str, sink_sid: str, types: List[object] + self, + description: str, + sink_sid: str, + types: List[object], + x_twilio_subscriptions_waiver: Union[str, object] = values.unset, + receive_events_from_subaccounts: Union[bool, object] = values.unset, + filter: Union[str, object] = values.unset, ) -> tuple: """ Internal async helper for create operation @@ -633,9 +767,18 @@ async def _create_async( "Description": description, "SinkSid": sink_sid, "Types": serialize.map(types, lambda e: serialize.object(e)), + "ReceiveEventsFromSubaccounts": serialize.boolean_to_string( + receive_events_from_subaccounts + ), + "Filter": filter, + } + ) + headers = values.of( + { + "X-Twilio-Subscriptions-Waiver": x_twilio_subscriptions_waiver, + "Content-Type": "application/x-www-form-urlencoded", } ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) headers["Content-Type"] = "application/x-www-form-urlencoded" @@ -646,7 +789,13 @@ async def _create_async( ) async def create_async( - self, description: str, sink_sid: str, types: List[object] + self, + description: str, + sink_sid: str, + types: List[object], + x_twilio_subscriptions_waiver: Union[str, object] = values.unset, + receive_events_from_subaccounts: Union[bool, object] = values.unset, + filter: Union[str, object] = values.unset, ) -> SubscriptionInstance: """ Asynchronously create the SubscriptionInstance @@ -654,16 +803,30 @@ async def create_async( :param description: A human readable description for the Subscription **This value should not contain PII.** :param sink_sid: The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. :param types: An array of objects containing the subscribed Event Types + :param x_twilio_subscriptions_waiver: The X-Twilio-Subscriptions-Waiver HTTP request header + :param receive_events_from_subaccounts: Receive events from all children accounts in the parent account subscription. + :param filter: Filter out events that don't satisfy this expression. :returns: The created SubscriptionInstance """ payload, _, _ = await self._create_async( - description=description, sink_sid=sink_sid, types=types + description=description, + sink_sid=sink_sid, + types=types, + x_twilio_subscriptions_waiver=x_twilio_subscriptions_waiver, + receive_events_from_subaccounts=receive_events_from_subaccounts, + filter=filter, ) return SubscriptionInstance(self._version, payload) async def create_with_http_info_async( - self, description: str, sink_sid: str, types: List[object] + self, + description: str, + sink_sid: str, + types: List[object], + x_twilio_subscriptions_waiver: Union[str, object] = values.unset, + receive_events_from_subaccounts: Union[bool, object] = values.unset, + filter: Union[str, object] = values.unset, ) -> ApiResponse: """ Asynchronously create the SubscriptionInstance and return response metadata @@ -671,11 +834,19 @@ async def create_with_http_info_async( :param description: A human readable description for the Subscription **This value should not contain PII.** :param sink_sid: The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. :param types: An array of objects containing the subscribed Event Types + :param x_twilio_subscriptions_waiver: The X-Twilio-Subscriptions-Waiver HTTP request header + :param receive_events_from_subaccounts: Receive events from all children accounts in the parent account subscription. + :param filter: Filter out events that don't satisfy this expression. :returns: ApiResponse with instance, status code, and headers """ payload, status_code, headers = await self._create_async( - description=description, sink_sid=sink_sid, types=types + description=description, + sink_sid=sink_sid, + types=types, + x_twilio_subscriptions_waiver=x_twilio_subscriptions_waiver, + receive_events_from_subaccounts=receive_events_from_subaccounts, + filter=filter, ) instance = SubscriptionInstance(self._version, payload) return ApiResponse(data=instance, status_code=status_code, headers=headers) @@ -1045,10 +1216,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SubscriptionPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/events/v1/subscription/subscribed_event.py b/twilio/rest/events/v1/subscription/subscribed_event.py index a6db46c0f..e0461bf81 100644 --- a/twilio/rest/events/v1/subscription/subscribed_event.py +++ b/twilio/rest/events/v1/subscription/subscribed_event.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class SubscribedEventInstance(InstanceResource): + """ :ivar account_sid: The unique SID identifier of the Account. :ivar type: Type of event being subscribed to. @@ -143,58 +145,74 @@ async def fetch_with_http_info_async(self) -> ApiResponse: return await self._proxy.fetch_with_http_info_async() def update( - self, schema_version: Union[int, object] = values.unset + self, + x_twilio_subscriptions_waiver: Union[str, object] = values.unset, + schema_version: Union[int, object] = values.unset, ) -> "SubscribedEventInstance": """ Update the SubscribedEventInstance + :param x_twilio_subscriptions_waiver: The X-Twilio-Subscriptions-Waiver HTTP request header :param schema_version: The schema version that the Subscription should use. :returns: The updated SubscribedEventInstance """ return self._proxy.update( + x_twilio_subscriptions_waiver=x_twilio_subscriptions_waiver, schema_version=schema_version, ) async def update_async( - self, schema_version: Union[int, object] = values.unset + self, + x_twilio_subscriptions_waiver: Union[str, object] = values.unset, + schema_version: Union[int, object] = values.unset, ) -> "SubscribedEventInstance": """ Asynchronous coroutine to update the SubscribedEventInstance + :param x_twilio_subscriptions_waiver: The X-Twilio-Subscriptions-Waiver HTTP request header :param schema_version: The schema version that the Subscription should use. :returns: The updated SubscribedEventInstance """ return await self._proxy.update_async( + x_twilio_subscriptions_waiver=x_twilio_subscriptions_waiver, schema_version=schema_version, ) def update_with_http_info( - self, schema_version: Union[int, object] = values.unset + self, + x_twilio_subscriptions_waiver: Union[str, object] = values.unset, + schema_version: Union[int, object] = values.unset, ) -> ApiResponse: """ Update the SubscribedEventInstance with HTTP info + :param x_twilio_subscriptions_waiver: The X-Twilio-Subscriptions-Waiver HTTP request header :param schema_version: The schema version that the Subscription should use. :returns: ApiResponse with instance, status code, and headers """ return self._proxy.update_with_http_info( + x_twilio_subscriptions_waiver=x_twilio_subscriptions_waiver, schema_version=schema_version, ) async def update_with_http_info_async( - self, schema_version: Union[int, object] = values.unset + self, + x_twilio_subscriptions_waiver: Union[str, object] = values.unset, + schema_version: Union[int, object] = values.unset, ) -> ApiResponse: """ Asynchronous coroutine to update the SubscribedEventInstance with HTTP info + :param x_twilio_subscriptions_waiver: The X-Twilio-Subscriptions-Waiver HTTP request header :param schema_version: The schema version that the Subscription should use. :returns: ApiResponse with instance, status code, and headers """ return await self._proxy.update_with_http_info_async( + x_twilio_subscriptions_waiver=x_twilio_subscriptions_waiver, schema_version=schema_version, ) @@ -209,7 +227,6 @@ def __repr__(self) -> str: class SubscribedEventContext(InstanceContext): - def __init__(self, version: Version, subscription_sid: str, type: str): """ Initialize the SubscribedEventContext @@ -391,7 +408,11 @@ async def fetch_with_http_info_async(self) -> ApiResponse: ) return ApiResponse(data=instance, status_code=status_code, headers=headers) - def _update(self, schema_version: Union[int, object] = values.unset) -> tuple: + def _update( + self, + x_twilio_subscriptions_waiver: Union[str, object] = values.unset, + schema_version: Union[int, object] = values.unset, + ) -> tuple: """ Internal helper for update operation @@ -406,6 +427,15 @@ def _update(self, schema_version: Union[int, object] = values.unset) -> tuple: ) headers = values.of({}) + if not ( + x_twilio_subscriptions_waiver is values.unset + or ( + isinstance(x_twilio_subscriptions_waiver, str) + and not x_twilio_subscriptions_waiver + ) + ): + headers["X-Twilio-Subscriptions-Waiver"] = x_twilio_subscriptions_waiver + headers["Content-Type"] = "application/x-www-form-urlencoded" headers["Accept"] = "application/json" @@ -415,16 +445,22 @@ def _update(self, schema_version: Union[int, object] = values.unset) -> tuple: ) def update( - self, schema_version: Union[int, object] = values.unset + self, + x_twilio_subscriptions_waiver: Union[str, object] = values.unset, + schema_version: Union[int, object] = values.unset, ) -> SubscribedEventInstance: """ Update the SubscribedEventInstance + :param x_twilio_subscriptions_waiver: The X-Twilio-Subscriptions-Waiver HTTP request header :param schema_version: The schema version that the Subscription should use. :returns: The updated SubscribedEventInstance """ - payload, _, _ = self._update(schema_version=schema_version) + payload, _, _ = self._update( + x_twilio_subscriptions_waiver=x_twilio_subscriptions_waiver, + schema_version=schema_version, + ) return SubscribedEventInstance( self._version, payload, @@ -433,16 +469,22 @@ def update( ) def update_with_http_info( - self, schema_version: Union[int, object] = values.unset + self, + x_twilio_subscriptions_waiver: Union[str, object] = values.unset, + schema_version: Union[int, object] = values.unset, ) -> ApiResponse: """ Update the SubscribedEventInstance and return response metadata + :param x_twilio_subscriptions_waiver: The X-Twilio-Subscriptions-Waiver HTTP request header :param schema_version: The schema version that the Subscription should use. :returns: ApiResponse with instance, status code, and headers """ - payload, status_code, headers = self._update(schema_version=schema_version) + payload, status_code, headers = self._update( + x_twilio_subscriptions_waiver=x_twilio_subscriptions_waiver, + schema_version=schema_version, + ) instance = SubscribedEventInstance( self._version, payload, @@ -452,7 +494,9 @@ def update_with_http_info( return ApiResponse(data=instance, status_code=status_code, headers=headers) async def _update_async( - self, schema_version: Union[int, object] = values.unset + self, + x_twilio_subscriptions_waiver: Union[str, object] = values.unset, + schema_version: Union[int, object] = values.unset, ) -> tuple: """ Internal async helper for update operation @@ -468,6 +512,15 @@ async def _update_async( ) headers = values.of({}) + if not ( + x_twilio_subscriptions_waiver is values.unset + or ( + isinstance(x_twilio_subscriptions_waiver, str) + and not x_twilio_subscriptions_waiver + ) + ): + headers["X-Twilio-Subscriptions-Waiver"] = x_twilio_subscriptions_waiver + headers["Content-Type"] = "application/x-www-form-urlencoded" headers["Accept"] = "application/json" @@ -477,16 +530,22 @@ async def _update_async( ) async def update_async( - self, schema_version: Union[int, object] = values.unset + self, + x_twilio_subscriptions_waiver: Union[str, object] = values.unset, + schema_version: Union[int, object] = values.unset, ) -> SubscribedEventInstance: """ Asynchronous coroutine to update the SubscribedEventInstance + :param x_twilio_subscriptions_waiver: The X-Twilio-Subscriptions-Waiver HTTP request header :param schema_version: The schema version that the Subscription should use. :returns: The updated SubscribedEventInstance """ - payload, _, _ = await self._update_async(schema_version=schema_version) + payload, _, _ = await self._update_async( + x_twilio_subscriptions_waiver=x_twilio_subscriptions_waiver, + schema_version=schema_version, + ) return SubscribedEventInstance( self._version, payload, @@ -495,17 +554,21 @@ async def update_async( ) async def update_with_http_info_async( - self, schema_version: Union[int, object] = values.unset + self, + x_twilio_subscriptions_waiver: Union[str, object] = values.unset, + schema_version: Union[int, object] = values.unset, ) -> ApiResponse: """ Asynchronous coroutine to update the SubscribedEventInstance and return response metadata + :param x_twilio_subscriptions_waiver: The X-Twilio-Subscriptions-Waiver HTTP request header :param schema_version: The schema version that the Subscription should use. :returns: ApiResponse with instance, status code, and headers """ payload, status_code, headers = await self._update_async( - schema_version=schema_version + x_twilio_subscriptions_waiver=x_twilio_subscriptions_waiver, + schema_version=schema_version, ) instance = SubscribedEventInstance( self._version, @@ -526,7 +589,6 @@ def __repr__(self) -> str: class SubscribedEventPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SubscribedEventInstance: """ Build an instance of SubscribedEventInstance @@ -547,7 +609,6 @@ def __repr__(self) -> str: class SubscribedEventList(ListResource): - def __init__(self, version: Version, subscription_sid: str): """ Initialize the SubscribedEventList @@ -567,7 +628,10 @@ def __init__(self, version: Version, subscription_sid: str): ) def _create( - self, type: str, schema_version: Union[int, object] = values.unset + self, + type: str, + x_twilio_subscriptions_waiver: Union[str, object] = values.unset, + schema_version: Union[int, object] = values.unset, ) -> tuple: """ Internal helper for create operation @@ -582,7 +646,12 @@ def _create( "SchemaVersion": schema_version, } ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers = values.of( + { + "X-Twilio-Subscriptions-Waiver": x_twilio_subscriptions_waiver, + "Content-Type": "application/x-www-form-urlencoded", + } + ) headers["Content-Type"] = "application/x-www-form-urlencoded" @@ -593,34 +662,48 @@ def _create( ) def create( - self, type: str, schema_version: Union[int, object] = values.unset + self, + type: str, + x_twilio_subscriptions_waiver: Union[str, object] = values.unset, + schema_version: Union[int, object] = values.unset, ) -> SubscribedEventInstance: """ Create the SubscribedEventInstance :param type: Type of event being subscribed to. + :param x_twilio_subscriptions_waiver: The X-Twilio-Subscriptions-Waiver HTTP request header :param schema_version: The schema version that the Subscription should use. :returns: The created SubscribedEventInstance """ - payload, _, _ = self._create(type=type, schema_version=schema_version) + payload, _, _ = self._create( + type=type, + x_twilio_subscriptions_waiver=x_twilio_subscriptions_waiver, + schema_version=schema_version, + ) return SubscribedEventInstance( self._version, payload, subscription_sid=self._solution["subscription_sid"] ) def create_with_http_info( - self, type: str, schema_version: Union[int, object] = values.unset + self, + type: str, + x_twilio_subscriptions_waiver: Union[str, object] = values.unset, + schema_version: Union[int, object] = values.unset, ) -> ApiResponse: """ Create the SubscribedEventInstance and return response metadata :param type: Type of event being subscribed to. + :param x_twilio_subscriptions_waiver: The X-Twilio-Subscriptions-Waiver HTTP request header :param schema_version: The schema version that the Subscription should use. :returns: ApiResponse with instance, status code, and headers """ payload, status_code, headers = self._create( - type=type, schema_version=schema_version + type=type, + x_twilio_subscriptions_waiver=x_twilio_subscriptions_waiver, + schema_version=schema_version, ) instance = SubscribedEventInstance( self._version, payload, subscription_sid=self._solution["subscription_sid"] @@ -628,7 +711,10 @@ def create_with_http_info( return ApiResponse(data=instance, status_code=status_code, headers=headers) async def _create_async( - self, type: str, schema_version: Union[int, object] = values.unset + self, + type: str, + x_twilio_subscriptions_waiver: Union[str, object] = values.unset, + schema_version: Union[int, object] = values.unset, ) -> tuple: """ Internal async helper for create operation @@ -643,7 +729,12 @@ async def _create_async( "SchemaVersion": schema_version, } ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers = values.of( + { + "X-Twilio-Subscriptions-Waiver": x_twilio_subscriptions_waiver, + "Content-Type": "application/x-www-form-urlencoded", + } + ) headers["Content-Type"] = "application/x-www-form-urlencoded" @@ -654,36 +745,48 @@ async def _create_async( ) async def create_async( - self, type: str, schema_version: Union[int, object] = values.unset + self, + type: str, + x_twilio_subscriptions_waiver: Union[str, object] = values.unset, + schema_version: Union[int, object] = values.unset, ) -> SubscribedEventInstance: """ Asynchronously create the SubscribedEventInstance :param type: Type of event being subscribed to. + :param x_twilio_subscriptions_waiver: The X-Twilio-Subscriptions-Waiver HTTP request header :param schema_version: The schema version that the Subscription should use. :returns: The created SubscribedEventInstance """ payload, _, _ = await self._create_async( - type=type, schema_version=schema_version + type=type, + x_twilio_subscriptions_waiver=x_twilio_subscriptions_waiver, + schema_version=schema_version, ) return SubscribedEventInstance( self._version, payload, subscription_sid=self._solution["subscription_sid"] ) async def create_with_http_info_async( - self, type: str, schema_version: Union[int, object] = values.unset + self, + type: str, + x_twilio_subscriptions_waiver: Union[str, object] = values.unset, + schema_version: Union[int, object] = values.unset, ) -> ApiResponse: """ Asynchronously create the SubscribedEventInstance and return response metadata :param type: Type of event being subscribed to. + :param x_twilio_subscriptions_waiver: The X-Twilio-Subscriptions-Waiver HTTP request header :param schema_version: The schema version that the Subscription should use. :returns: ApiResponse with instance, status code, and headers """ payload, status_code, headers = await self._create_async( - type=type, schema_version=schema_version + type=type, + x_twilio_subscriptions_waiver=x_twilio_subscriptions_waiver, + schema_version=schema_version, ) instance = SubscribedEventInstance( self._version, payload, subscription_sid=self._solution["subscription_sid"] @@ -1021,10 +1124,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SubscribedEventPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/flex_api/FlexApiBase.py b/twilio/rest/flex_api/FlexApiBase.py index 3bda5b6b4..afdad4734 100644 --- a/twilio/rest/flex_api/FlexApiBase.py +++ b/twilio/rest/flex_api/FlexApiBase.py @@ -18,7 +18,6 @@ class FlexApiBase(Domain): - def __init__(self, twilio: Client): """ Initialize the FlexApi Domain diff --git a/twilio/rest/flex_api/v1/__init__.py b/twilio/rest/flex_api/v1/__init__.py index 7d824d4aa..b1e7e8b3c 100644 --- a/twilio/rest/flex_api/v1/__init__.py +++ b/twilio/rest/flex_api/v1/__init__.py @@ -20,6 +20,7 @@ from twilio.rest.flex_api.v1.configuration import ConfigurationList from twilio.rest.flex_api.v1.create_flex_instance import CreateFlexInstanceList from twilio.rest.flex_api.v1.flex_flow import FlexFlowList +from twilio.rest.flex_api.v1.flex_user import FlexUserList from twilio.rest.flex_api.v1.insights_assessments_comment import ( InsightsAssessmentsCommentList, ) @@ -54,7 +55,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of FlexApi @@ -67,9 +67,10 @@ def __init__(self, domain: Domain): self._configuration: Optional[ConfigurationList] = None self._create_flex_instance: Optional[CreateFlexInstanceList] = None self._flex_flow: Optional[FlexFlowList] = None - self._insights_assessments_comment: Optional[InsightsAssessmentsCommentList] = ( - None - ) + self._flex_user: Optional[FlexUserList] = None + self._insights_assessments_comment: Optional[ + InsightsAssessmentsCommentList + ] = None self._insights_conversations: Optional[InsightsConversationsList] = None self._insights_questionnaires: Optional[InsightsQuestionnairesList] = None self._insights_questionnaires_category: Optional[ @@ -89,9 +90,9 @@ def __init__(self, domain: Domain): self._plugins: Optional[PluginList] = None self._plugin_archive: Optional[PluginArchiveList] = None self._plugin_configurations: Optional[PluginConfigurationList] = None - self._plugin_configuration_archive: Optional[PluginConfigurationArchiveList] = ( - None - ) + self._plugin_configuration_archive: Optional[ + PluginConfigurationArchiveList + ] = None self._plugin_releases: Optional[PluginReleaseList] = None self._plugin_version_archive: Optional[PluginVersionArchiveList] = None self._provisioning_status: Optional[ProvisioningStatusList] = None @@ -127,6 +128,12 @@ def flex_flow(self) -> FlexFlowList: self._flex_flow = FlexFlowList(self) return self._flex_flow + @property + def flex_user(self) -> FlexUserList: + if self._flex_user is None: + self._flex_user = FlexUserList(self) + return self._flex_user + @property def insights_assessments_comment(self) -> InsightsAssessmentsCommentList: if self._insights_assessments_comment is None: diff --git a/twilio/rest/flex_api/v1/assessments.py b/twilio/rest/flex_api/v1/assessments.py index 55bde91eb..17b7571e8 100644 --- a/twilio/rest/flex_api/v1/assessments.py +++ b/twilio/rest/flex_api/v1/assessments.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class AssessmentsInstance(InstanceResource): + """ :ivar account_sid: The unique SID identifier of the Account. :ivar assessment_sid: The SID of the assessment @@ -190,7 +192,6 @@ def __repr__(self) -> str: class AssessmentsContext(InstanceContext): - def __init__(self, version: Version, assessment_sid: str): """ Initialize the AssessmentsContext @@ -403,7 +404,6 @@ def __repr__(self) -> str: class AssessmentsPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> AssessmentsInstance: """ Build an instance of AssessmentsInstance @@ -422,7 +422,6 @@ def __repr__(self) -> str: class AssessmentsList(ListResource): - def __init__(self, version: Version): """ Initialize the AssessmentsList @@ -1149,10 +1148,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AssessmentsPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/flex_api/v1/channel.py b/twilio/rest/flex_api/v1/channel.py index 27290bfe7..853e35275 100644 --- a/twilio/rest/flex_api/v1/channel.py +++ b/twilio/rest/flex_api/v1/channel.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class ChannelInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Channel resource and owns this Workflow. :ivar flex_flow_sid: The SID of the Flex Flow. @@ -156,7 +158,6 @@ def __repr__(self) -> str: class ChannelContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the ChannelContext @@ -341,7 +342,6 @@ def __repr__(self) -> str: class ChannelPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ChannelInstance: """ Build an instance of ChannelInstance @@ -360,7 +360,6 @@ def __repr__(self) -> str: class ChannelList(ListResource): - def __init__(self, version: Version): """ Initialize the ChannelList @@ -965,10 +964,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ChannelPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/flex_api/v1/configuration.py b/twilio/rest/flex_api/v1/configuration.py index 6e8f586a0..8581cb1b4 100644 --- a/twilio/rest/flex_api/v1/configuration.py +++ b/twilio/rest/flex_api/v1/configuration.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, List, Optional, Union from twilio.base import deserialize, values @@ -23,7 +24,6 @@ class ConfigurationInstance(InstanceResource): - class Status(object): OK = "ok" INPROGRESS = "inprogress" @@ -333,7 +333,6 @@ def __repr__(self) -> str: class ConfigurationContext(InstanceContext): - def __init__(self, version: Version): """ Initialize the ConfigurationContext @@ -559,7 +558,6 @@ def __repr__(self) -> str: class ConfigurationList(ListResource): - def __init__(self, version: Version): """ Initialize the ConfigurationList diff --git a/twilio/rest/flex_api/v1/create_flex_instance.py b/twilio/rest/flex_api/v1/create_flex_instance.py index 4f30381b4..b6b3b160a 100644 --- a/twilio/rest/flex_api/v1/create_flex_instance.py +++ b/twilio/rest/flex_api/v1/create_flex_instance.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, values @@ -23,25 +24,21 @@ class CreateFlexInstanceInstance(InstanceResource): - class CreateInstanceRequestBody(object): """ :ivar conversation: """ def __init__(self, payload: Dict[str, Any]): - self.conversation: Optional[ CreateFlexInstanceList.CreateInstanceRequestBodyConversation ] = payload.get("conversation") def to_dict(self): return { - "conversation": ( - self.conversation.to_dict() - if self.conversation is not None - else None - ), + "conversation": self.conversation.to_dict() + if self.conversation is not None + else None, } class CreateInstanceRequestBodyConversation(object): @@ -50,7 +47,6 @@ class CreateInstanceRequestBodyConversation(object): """ def __init__(self, payload: Dict[str, Any]): - self.default: Optional[bool] = payload.get("default") def to_dict(self): @@ -174,25 +170,21 @@ def __repr__(self) -> str: class CreateFlexInstanceContext(InstanceContext): - class CreateInstanceRequestBody(object): """ :ivar conversation: """ def __init__(self, payload: Dict[str, Any]): - self.conversation: Optional[ CreateFlexInstanceList.CreateInstanceRequestBodyConversation ] = payload.get("conversation") def to_dict(self): return { - "conversation": ( - self.conversation.to_dict() - if self.conversation is not None - else None - ), + "conversation": self.conversation.to_dict() + if self.conversation is not None + else None, } class CreateInstanceRequestBodyConversation(object): @@ -201,7 +193,6 @@ class CreateInstanceRequestBodyConversation(object): """ def __init__(self, payload: Dict[str, Any]): - self.default: Optional[bool] = payload.get("default") def to_dict(self): @@ -352,25 +343,21 @@ def __repr__(self) -> str: class CreateFlexInstanceList(ListResource): - class CreateInstanceRequestBody(object): """ :ivar conversation: """ def __init__(self, payload: Dict[str, Any]): - self.conversation: Optional[ CreateFlexInstanceList.CreateInstanceRequestBodyConversation ] = payload.get("conversation") def to_dict(self): return { - "conversation": ( - self.conversation.to_dict() - if self.conversation is not None - else None - ), + "conversation": self.conversation.to_dict() + if self.conversation is not None + else None, } class CreateInstanceRequestBodyConversation(object): @@ -379,7 +366,6 @@ class CreateInstanceRequestBodyConversation(object): """ def __init__(self, payload: Dict[str, Any]): - self.default: Optional[bool] = payload.get("default") def to_dict(self): diff --git a/twilio/rest/flex_api/v1/flex_flow.py b/twilio/rest/flex_api/v1/flex_flow.py index c29e9b81a..c3c03767f 100644 --- a/twilio/rest/flex_api/v1/flex_flow.py +++ b/twilio/rest/flex_api/v1/flex_flow.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class FlexFlowInstance(InstanceResource): - class ChannelType(object): WEB = "web" SMS = "sms" @@ -75,9 +75,9 @@ def __init__( ) self.contact_identity: Optional[str] = payload.get("contact_identity") self.enabled: Optional[bool] = payload.get("enabled") - self.integration_type: Optional["FlexFlowInstance.IntegrationType"] = ( - payload.get("integration_type") - ) + self.integration_type: Optional[ + "FlexFlowInstance.IntegrationType" + ] = payload.get("integration_type") self.integration: Optional[Dict[str, object]] = payload.get("integration") self.long_lived: Optional[bool] = payload.get("long_lived") self.janitor_enabled: Optional[bool] = payload.get("janitor_enabled") @@ -446,7 +446,6 @@ def __repr__(self) -> str: class FlexFlowContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the FlexFlowContext @@ -1021,7 +1020,6 @@ def __repr__(self) -> str: class FlexFlowPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> FlexFlowInstance: """ Build an instance of FlexFlowInstance @@ -1040,7 +1038,6 @@ def __repr__(self) -> str: class FlexFlowList(ListResource): - def __init__(self, version: Version): """ Initialize the FlexFlowList @@ -1809,10 +1806,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = FlexFlowPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/flex_api/v1/flex_user.py b/twilio/rest/flex_api/v1/flex_user.py new file mode 100644 index 000000000..2d337e1eb --- /dev/null +++ b/twilio/rest/flex_api/v1/flex_user.py @@ -0,0 +1,541 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Flex + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.api_response import ApiResponse + +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 FlexUserInstance(InstanceResource): + + """ + :ivar account_sid: + :ivar instance_sid: + :ivar user_sid: + :ivar flex_user_sid: + :ivar worker_sid: + :ivar workspace_sid: + :ivar flex_team_sid: + :ivar username: + :ivar email: + :ivar friendly_name: + :ivar full_name: + :ivar locale: + :ivar roles: + :ivar created_date: + :ivar updated_date: + :ivar deactivated: + :ivar deactivated_date: + :ivar version: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + instance_sid: Optional[str] = None, + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.instance_sid: Optional[str] = payload.get("instance_sid") + self.user_sid: Optional[str] = payload.get("user_sid") + self.flex_user_sid: Optional[str] = payload.get("flex_user_sid") + self.worker_sid: Optional[str] = payload.get("worker_sid") + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.flex_team_sid: Optional[str] = payload.get("flex_team_sid") + self.username: Optional[str] = payload.get("username") + self.email: Optional[str] = payload.get("email") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.full_name: Optional[str] = payload.get("full_name") + self.locale: Optional[str] = payload.get("locale") + self.roles: Optional[List[str]] = payload.get("roles") + self.created_date: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("created_date") + ) + self.updated_date: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("updated_date") + ) + self.deactivated: Optional[bool] = payload.get("deactivated") + self.deactivated_date: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("deactivated_date") + ) + self.version: Optional[int] = deserialize.integer(payload.get("version")) + + self._solution = { + "instance_sid": instance_sid or self.instance_sid, + } + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class FlexUserPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> FlexUserInstance: + """ + Build an instance of FlexUserInstance + + :param payload: Payload response from the API + """ + return FlexUserInstance( + self._version, payload, instance_sid=self._solution["instance_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class FlexUserList(ListResource): + def __init__(self, version: Version, instance_sid: str): + """ + Initialize the FlexUserList + + :param version: Version that contains the resource + :param instance_sid: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "instance_sid": instance_sid, + } + self._uri = "/Instances/{instance_sid}/Users".format(**self._solution) + + def stream( + self, + worker_sid: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[FlexUserInstance]: + """ + Streams FlexUserInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str worker_sid: + :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(worker_sid=worker_sid, page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + worker_sid: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[FlexUserInstance]: + """ + Asynchronously streams FlexUserInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str worker_sid: + :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( + worker_sid=worker_sid, page_size=limits["page_size"] + ) + + return self._version.stream_async(page, limits["limit"]) + + def stream_with_http_info( + self, + worker_sid: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams FlexUserInstance and returns headers from first page + + + :param str worker_sid: + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info( + worker_sid=worker_sid, page_size=limits["page_size"] + ) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + worker_sid: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams FlexUserInstance and returns headers from first page + + + :param str worker_sid: + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + worker_sid=worker_sid, page_size=limits["page_size"] + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + worker_sid: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[FlexUserInstance]: + """ + Lists FlexUserInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str worker_sid: + :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( + worker_sid=worker_sid, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + worker_sid: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[FlexUserInstance]: + """ + Asynchronously lists FlexUserInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str worker_sid: + :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( + worker_sid=worker_sid, + limit=limit, + page_size=page_size, + ) + ] + + def list_with_http_info( + self, + worker_sid: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists FlexUserInstance and returns headers from first page + + + :param str worker_sid: + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + worker_sid=worker_sid, + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + worker_sid: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists FlexUserInstance and returns headers from first page + + + :param str worker_sid: + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + worker_sid=worker_sid, + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + worker_sid: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> FlexUserPage: + """ + Retrieve a single page of FlexUserInstance records from the API. + Request is executed immediately + + :param worker_sid: + :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 FlexUserInstance + """ + data = values.of( + { + "WorkerSid": worker_sid, + "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 FlexUserPage(self._version, response, self._solution) + + async def page_async( + self, + worker_sid: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> FlexUserPage: + """ + Asynchronously retrieve a single page of FlexUserInstance records from the API. + Request is executed immediately + + :param worker_sid: + :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 FlexUserInstance + """ + data = values.of( + { + "WorkerSid": worker_sid, + "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 FlexUserPage(self._version, response, self._solution) + + def page_with_http_info( + self, + worker_sid: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :param worker_sid: + :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: ApiResponse with FlexUserPage, status code, and headers + """ + data = values.of( + { + "WorkerSid": worker_sid, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = FlexUserPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + worker_sid: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :param worker_sid: + :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: ApiResponse with FlexUserPage, status code, and headers + """ + data = values.of( + { + "WorkerSid": worker_sid, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = FlexUserPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> FlexUserPage: + """ + Retrieve a specific page of FlexUserInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of FlexUserInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return FlexUserPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> FlexUserPage: + """ + Asynchronously retrieve a specific page of FlexUserInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of FlexUserInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return FlexUserPage(self._version, response, self._solution) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/flex_api/v1/insights_assessments_comment.py b/twilio/rest/flex_api/v1/insights_assessments_comment.py index 5806901a5..abc98f178 100644 --- a/twilio/rest/flex_api/v1/insights_assessments_comment.py +++ b/twilio/rest/flex_api/v1/insights_assessments_comment.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class InsightsAssessmentsCommentInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. :ivar assessment_sid: The SID of the assessment. @@ -65,7 +67,6 @@ def __repr__(self) -> str: class InsightsAssessmentsCommentPage(Page): - def get_instance( self, payload: Dict[str, Any] ) -> InsightsAssessmentsCommentInstance: @@ -86,7 +87,6 @@ def __repr__(self) -> str: class InsightsAssessmentsCommentList(ListResource): - def __init__(self, version: Version): """ Initialize the InsightsAssessmentsCommentList @@ -785,10 +785,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = InsightsAssessmentsCommentPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/flex_api/v1/insights_conversations.py b/twilio/rest/flex_api/v1/insights_conversations.py index 9c12094ce..7e22de7ef 100644 --- a/twilio/rest/flex_api/v1/insights_conversations.py +++ b/twilio/rest/flex_api/v1/insights_conversations.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class InsightsConversationsInstance(InstanceResource): + """ :ivar account_id: The id of the account. :ivar conversation_id: The unique id of the conversation @@ -51,7 +53,6 @@ def __repr__(self) -> str: class InsightsConversationsPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> InsightsConversationsInstance: """ Build an instance of InsightsConversationsInstance @@ -70,7 +71,6 @@ def __repr__(self) -> str: class InsightsConversationsList(ListResource): - def __init__(self, version: Version): """ Initialize the InsightsConversationsList @@ -511,10 +511,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = InsightsConversationsPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/flex_api/v1/insights_questionnaires.py b/twilio/rest/flex_api/v1/insights_questionnaires.py index a54ee0ee7..7477ad88a 100644 --- a/twilio/rest/flex_api/v1/insights_questionnaires.py +++ b/twilio/rest/flex_api/v1/insights_questionnaires.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class InsightsQuestionnairesInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. :ivar questionnaire_sid: The sid of this questionnaire @@ -298,7 +300,6 @@ def __repr__(self) -> str: class InsightsQuestionnairesContext(InstanceContext): - def __init__(self, version: Version, questionnaire_sid: str): """ Initialize the InsightsQuestionnairesContext @@ -747,7 +748,6 @@ def __repr__(self) -> str: class InsightsQuestionnairesPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> InsightsQuestionnairesInstance: """ Build an instance of InsightsQuestionnairesInstance @@ -766,7 +766,6 @@ def __repr__(self) -> str: class InsightsQuestionnairesList(ListResource): - def __init__(self, version: Version): """ Initialize the InsightsQuestionnairesList @@ -1397,10 +1396,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = InsightsQuestionnairesPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/flex_api/v1/insights_questionnaires_category.py b/twilio/rest/flex_api/v1/insights_questionnaires_category.py index 953482110..812fb008c 100644 --- a/twilio/rest/flex_api/v1/insights_questionnaires_category.py +++ b/twilio/rest/flex_api/v1/insights_questionnaires_category.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class InsightsQuestionnairesCategoryInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. :ivar category_sid: The SID of the category @@ -194,7 +196,6 @@ def __repr__(self) -> str: class InsightsQuestionnairesCategoryContext(InstanceContext): - def __init__(self, version: Version, category_sid: str): """ Initialize the InsightsQuestionnairesCategoryContext @@ -449,7 +450,6 @@ def __repr__(self) -> str: class InsightsQuestionnairesCategoryPage(Page): - def get_instance( self, payload: Dict[str, Any] ) -> InsightsQuestionnairesCategoryInstance: @@ -470,7 +470,6 @@ def __repr__(self) -> str: class InsightsQuestionnairesCategoryList(ListResource): - def __init__(self, version: Version): """ Initialize the InsightsQuestionnairesCategoryList @@ -991,10 +990,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = InsightsQuestionnairesCategoryPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/flex_api/v1/insights_questionnaires_question.py b/twilio/rest/flex_api/v1/insights_questionnaires_question.py index 84dde17e2..7af693570 100644 --- a/twilio/rest/flex_api/v1/insights_questionnaires_question.py +++ b/twilio/rest/flex_api/v1/insights_questionnaires_question.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class InsightsQuestionnairesQuestionInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. :ivar question_sid: The SID of the question @@ -262,7 +264,6 @@ def __repr__(self) -> str: class InsightsQuestionnairesQuestionContext(InstanceContext): - def __init__(self, version: Version, question_sid: str): """ Initialize the InsightsQuestionnairesQuestionContext @@ -601,7 +602,6 @@ def __repr__(self) -> str: class InsightsQuestionnairesQuestionPage(Page): - def get_instance( self, payload: Dict[str, Any] ) -> InsightsQuestionnairesQuestionInstance: @@ -622,7 +622,6 @@ def __repr__(self) -> str: class InsightsQuestionnairesQuestionList(ListResource): - def __init__(self, version: Version): """ Initialize the InsightsQuestionnairesQuestionList @@ -1269,10 +1268,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = InsightsQuestionnairesQuestionPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/flex_api/v1/insights_segments.py b/twilio/rest/flex_api/v1/insights_segments.py index 79d6736ce..6a9fdc1cf 100644 --- a/twilio/rest/flex_api/v1/insights_segments.py +++ b/twilio/rest/flex_api/v1/insights_segments.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class InsightsSegmentsInstance(InstanceResource): + """ :ivar segment_id: To unique id of the segment :ivar external_id: The unique id for the conversation. @@ -95,7 +97,6 @@ def __repr__(self) -> str: class InsightsSegmentsPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> InsightsSegmentsInstance: """ Build an instance of InsightsSegmentsInstance @@ -114,7 +115,6 @@ def __repr__(self) -> str: class InsightsSegmentsList(ListResource): - def __init__(self, version: Version): """ Initialize the InsightsSegmentsList @@ -591,10 +591,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = InsightsSegmentsPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/flex_api/v1/insights_session.py b/twilio/rest/flex_api/v1/insights_session.py index d63393362..1c75ba13e 100644 --- a/twilio/rest/flex_api/v1/insights_session.py +++ b/twilio/rest/flex_api/v1/insights_session.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class InsightsSessionInstance(InstanceResource): + """ :ivar workspace_id: Unique ID to identify the user's workspace :ivar session_expiry: The session expiry date and time, given in ISO 8601 format. @@ -122,7 +124,6 @@ def __repr__(self) -> str: class InsightsSessionContext(InstanceContext): - def __init__(self, version: Version): """ Initialize the InsightsSessionContext @@ -248,7 +249,6 @@ def __repr__(self) -> str: class InsightsSessionList(ListResource): - def __init__(self, version: Version): """ Initialize the InsightsSessionList diff --git a/twilio/rest/flex_api/v1/insights_settings_answer_sets.py b/twilio/rest/flex_api/v1/insights_settings_answer_sets.py index 8f6938ded..454056fbe 100644 --- a/twilio/rest/flex_api/v1/insights_settings_answer_sets.py +++ b/twilio/rest/flex_api/v1/insights_settings_answer_sets.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class InsightsSettingsAnswerSetsInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. :ivar answer_sets: The lis of answer sets @@ -52,7 +54,6 @@ def __repr__(self) -> str: class InsightsSettingsAnswerSetsList(ListResource): - def __init__(self, version: Version): """ Initialize the InsightsSettingsAnswerSetsList diff --git a/twilio/rest/flex_api/v1/insights_settings_comment.py b/twilio/rest/flex_api/v1/insights_settings_comment.py index 44ca4f4d3..e6655098e 100644 --- a/twilio/rest/flex_api/v1/insights_settings_comment.py +++ b/twilio/rest/flex_api/v1/insights_settings_comment.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class InsightsSettingsCommentInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. :ivar comments: @@ -46,7 +48,6 @@ def __repr__(self) -> str: class InsightsSettingsCommentList(ListResource): - def __init__(self, version: Version): """ Initialize the InsightsSettingsCommentList diff --git a/twilio/rest/flex_api/v1/insights_user_roles.py b/twilio/rest/flex_api/v1/insights_user_roles.py index 33ef7c663..ae9ca749c 100644 --- a/twilio/rest/flex_api/v1/insights_user_roles.py +++ b/twilio/rest/flex_api/v1/insights_user_roles.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class InsightsUserRolesInstance(InstanceResource): + """ :ivar roles: Flex Insights roles for the user :ivar url: @@ -116,7 +118,6 @@ def __repr__(self) -> str: class InsightsUserRolesContext(InstanceContext): - def __init__(self, version: Version): """ Initialize the InsightsUserRolesContext @@ -252,7 +253,6 @@ def __repr__(self) -> str: class InsightsUserRolesList(ListResource): - def __init__(self, version: Version): """ Initialize the InsightsUserRolesList diff --git a/twilio/rest/flex_api/v1/interaction/__init__.py b/twilio/rest/flex_api/v1/interaction/__init__.py index dbbd63d81..e567a5cea 100644 --- a/twilio/rest/flex_api/v1/interaction/__init__.py +++ b/twilio/rest/flex_api/v1/interaction/__init__.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -26,6 +27,7 @@ class InteractionInstance(InstanceResource): + """ :ivar sid: The unique string created by Twilio to identify an Interaction resource, prefixed with KD. :ivar channel: A JSON object that defines the Interaction’s communication channel and includes details about the channel. See the [Outbound SMS](https://www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#agent-initiated-outbound-interactions) and [inbound (API-initiated)](https://www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#api-initiated-contact) Channel object examples. @@ -181,7 +183,6 @@ def __repr__(self) -> str: class InteractionContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the InteractionContext @@ -420,7 +421,6 @@ def __repr__(self) -> str: class InteractionList(ListResource): - def __init__(self, version: Version): """ Initialize the InteractionList diff --git a/twilio/rest/flex_api/v1/interaction/interaction_channel/__init__.py b/twilio/rest/flex_api/v1/interaction/interaction_channel/__init__.py index 99e775f08..f2cc6df8f 100644 --- a/twilio/rest/flex_api/v1/interaction/interaction_channel/__init__.py +++ b/twilio/rest/flex_api/v1/interaction/interaction_channel/__init__.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values from twilio.base.api_response import ApiResponse @@ -32,7 +33,6 @@ class InteractionChannelInstance(InstanceResource): - class ChannelStatus(object): SETUP = "setup" ACTIVE = "active" @@ -249,7 +249,6 @@ def __repr__(self) -> str: class InteractionChannelContext(InstanceContext): - def __init__(self, version: Version, interaction_sid: str, sid: str): """ Initialize the InteractionChannelContext @@ -561,7 +560,6 @@ def __repr__(self) -> str: class InteractionChannelPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> InteractionChannelInstance: """ Build an instance of InteractionChannelInstance @@ -582,7 +580,6 @@ def __repr__(self) -> str: class InteractionChannelList(ListResource): - def __init__(self, version: Version, interaction_sid: str): """ Initialize the InteractionChannelList @@ -930,10 +927,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = InteractionChannelPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.py b/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.py index c794b6d00..442371a19 100644 --- a/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.py +++ b/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class InteractionChannelInviteInstance(InstanceResource): + """ :ivar sid: The unique string created by Twilio to identify an Interaction Channel Invite resource. :ivar interaction_sid: The Interaction SID for this Channel. @@ -62,7 +64,6 @@ def __repr__(self) -> str: class InteractionChannelInvitePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> InteractionChannelInviteInstance: """ Build an instance of InteractionChannelInviteInstance @@ -86,7 +87,6 @@ def __repr__(self) -> str: class InteractionChannelInviteList(ListResource): - def __init__(self, version: Version, interaction_sid: str, channel_sid: str): """ Initialize the InteractionChannelInviteList @@ -552,10 +552,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = InteractionChannelInvitePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.py b/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.py index d85cc23f0..a9eafef20 100644 --- a/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.py +++ b/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -23,7 +24,6 @@ class InteractionChannelParticipantInstance(InstanceResource): - class Status(object): CLOSED = "closed" WRAPUP = "wrapup" @@ -158,7 +158,6 @@ def __repr__(self) -> str: class InteractionChannelParticipantContext(InstanceContext): - def __init__( self, version: Version, interaction_sid: str, channel_sid: str, sid: str ): @@ -321,7 +320,6 @@ def __repr__(self) -> str: class InteractionChannelParticipantPage(Page): - def get_instance( self, payload: Dict[str, Any] ) -> InteractionChannelParticipantInstance: @@ -347,7 +345,6 @@ def __repr__(self) -> str: class InteractionChannelParticipantList(ListResource): - def __init__(self, version: Version, interaction_sid: str, channel_sid: str): """ Initialize the InteractionChannelParticipantList @@ -875,10 +872,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = InteractionChannelParticipantPage( self._version, response, self._solution diff --git a/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_transfer.py b/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_transfer.py index 226db589d..38b3c9e2d 100644 --- a/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_transfer.py +++ b/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_transfer.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, values @@ -23,7 +24,6 @@ class InteractionTransferInstance(InstanceResource): - class TransferStatus(object): ACTIVE = "active" FAILED = "failed" @@ -71,9 +71,9 @@ def __init__( self.type: Optional["InteractionTransferInstance.TransferType"] = payload.get( "type" ) - self.status: Optional["InteractionTransferInstance.TransferStatus"] = ( - payload.get("status") - ) + self.status: Optional[ + "InteractionTransferInstance.TransferStatus" + ] = payload.get("status") self._from: Optional[str] = payload.get("from") self.to: Optional[str] = payload.get("to") self.note_sid: Optional[str] = payload.get("note_sid") @@ -213,7 +213,6 @@ def __repr__(self) -> str: class InteractionTransferContext(InstanceContext): - def __init__( self, version: Version, interaction_sid: str, channel_sid: str, sid: str ): @@ -462,7 +461,6 @@ def __repr__(self) -> str: class InteractionTransferList(ListResource): - def __init__(self, version: Version, interaction_sid: str, channel_sid: str): """ Initialize the InteractionTransferList diff --git a/twilio/rest/flex_api/v1/plugin/__init__.py b/twilio/rest/flex_api/v1/plugin/__init__.py index be9809cc5..393a29581 100644 --- a/twilio/rest/flex_api/v1/plugin/__init__.py +++ b/twilio/rest/flex_api/v1/plugin/__init__.py @@ -12,6 +12,7 @@ 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 @@ -25,6 +26,7 @@ class PluginInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Flex Plugin resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Plugin resource and owns this resource. @@ -236,7 +238,6 @@ def __repr__(self) -> str: class PluginContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the PluginContext @@ -553,7 +554,6 @@ def __repr__(self) -> str: class PluginPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> PluginInstance: """ Build an instance of PluginInstance @@ -572,7 +572,6 @@ def __repr__(self) -> str: class PluginList(ListResource): - def __init__(self, version: Version): """ Initialize the PluginList @@ -1145,10 +1144,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = PluginPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/flex_api/v1/plugin/plugin_versions.py b/twilio/rest/flex_api/v1/plugin/plugin_versions.py index bf065ff62..765327446 100644 --- a/twilio/rest/flex_api/v1/plugin/plugin_versions.py +++ b/twilio/rest/flex_api/v1/plugin/plugin_versions.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class PluginVersionsInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Flex Plugin Version resource. :ivar plugin_sid: The SID of the Flex Plugin resource this Flex Plugin Version belongs to. @@ -150,7 +152,6 @@ def __repr__(self) -> str: class PluginVersionsContext(InstanceContext): - def __init__(self, version: Version, plugin_sid: str, sid: str): """ Initialize the PluginVersionsContext @@ -303,7 +304,6 @@ def __repr__(self) -> str: class PluginVersionsPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> PluginVersionsInstance: """ Build an instance of PluginVersionsInstance @@ -324,7 +324,6 @@ def __repr__(self) -> str: class PluginVersionsList(ListResource): - def __init__(self, version: Version, plugin_sid: str): """ Initialize the PluginVersionsList @@ -960,10 +959,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = PluginVersionsPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/flex_api/v1/plugin_archive.py b/twilio/rest/flex_api/v1/plugin_archive.py index 5382aa307..d29422ef5 100644 --- a/twilio/rest/flex_api/v1/plugin_archive.py +++ b/twilio/rest/flex_api/v1/plugin_archive.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, values @@ -23,6 +24,7 @@ class PluginArchiveInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Flex Plugin resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Plugin resource and owns this resource. @@ -141,7 +143,6 @@ def __repr__(self) -> str: class PluginArchiveContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the PluginArchiveContext @@ -276,7 +277,6 @@ def __repr__(self) -> str: class PluginArchiveList(ListResource): - def __init__(self, version: Version): """ Initialize the PluginArchiveList diff --git a/twilio/rest/flex_api/v1/plugin_configuration/__init__.py b/twilio/rest/flex_api/v1/plugin_configuration/__init__.py index c6642eab0..1507c3846 100644 --- a/twilio/rest/flex_api/v1/plugin_configuration/__init__.py +++ b/twilio/rest/flex_api/v1/plugin_configuration/__init__.py @@ -12,6 +12,7 @@ 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 @@ -27,6 +28,7 @@ class PluginConfigurationInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Flex Plugin Configuration resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Plugin Configuration resource and owns this resource. @@ -148,7 +150,6 @@ def __repr__(self) -> str: class PluginConfigurationContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the PluginConfigurationContext @@ -307,7 +308,6 @@ def __repr__(self) -> str: class PluginConfigurationPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> PluginConfigurationInstance: """ Build an instance of PluginConfigurationInstance @@ -326,7 +326,6 @@ def __repr__(self) -> str: class PluginConfigurationList(ListResource): - def __init__(self, version: Version): """ Initialize the PluginConfigurationList @@ -899,10 +898,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = PluginConfigurationPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/flex_api/v1/plugin_configuration/configured_plugin.py b/twilio/rest/flex_api/v1/plugin_configuration/configured_plugin.py index b1a52a0ca..10f8f35c3 100644 --- a/twilio/rest/flex_api/v1/plugin_configuration/configured_plugin.py +++ b/twilio/rest/flex_api/v1/plugin_configuration/configured_plugin.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class ConfiguredPluginInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Flex Plugin resource is installed for. :ivar configuration_sid: The SID of the Flex Plugin Configuration that this Flex Plugin belongs to. @@ -162,7 +164,6 @@ def __repr__(self) -> str: class ConfiguredPluginContext(InstanceContext): - def __init__(self, version: Version, configuration_sid: str, plugin_sid: str): """ Initialize the ConfiguredPluginContext @@ -315,7 +316,6 @@ def __repr__(self) -> str: class ConfiguredPluginPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ConfiguredPluginInstance: """ Build an instance of ConfiguredPluginInstance @@ -338,7 +338,6 @@ def __repr__(self) -> str: class ConfiguredPluginList(ListResource): - def __init__(self, version: Version, configuration_sid: str): """ Initialize the ConfiguredPluginList @@ -744,10 +743,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ConfiguredPluginPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/flex_api/v1/plugin_configuration_archive.py b/twilio/rest/flex_api/v1/plugin_configuration_archive.py index ed730456c..b9d470163 100644 --- a/twilio/rest/flex_api/v1/plugin_configuration_archive.py +++ b/twilio/rest/flex_api/v1/plugin_configuration_archive.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, values @@ -23,6 +24,7 @@ class PluginConfigurationArchiveInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Flex Plugin Configuration resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Plugin Configuration resource and owns this resource. @@ -137,7 +139,6 @@ def __repr__(self) -> str: class PluginConfigurationArchiveContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the PluginConfigurationArchiveContext @@ -280,7 +281,6 @@ def __repr__(self) -> str: class PluginConfigurationArchiveList(ListResource): - def __init__(self, version: Version): """ Initialize the PluginConfigurationArchiveList diff --git a/twilio/rest/flex_api/v1/plugin_release.py b/twilio/rest/flex_api/v1/plugin_release.py index 33d11f5d3..fe353a0b5 100644 --- a/twilio/rest/flex_api/v1/plugin_release.py +++ b/twilio/rest/flex_api/v1/plugin_release.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class PluginReleaseInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Plugin Release resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Plugin Release resource and owns this resource. @@ -132,7 +134,6 @@ def __repr__(self) -> str: class PluginReleaseContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the PluginReleaseContext @@ -277,7 +278,6 @@ def __repr__(self) -> str: class PluginReleasePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> PluginReleaseInstance: """ Build an instance of PluginReleaseInstance @@ -296,7 +296,6 @@ def __repr__(self) -> str: class PluginReleaseList(ListResource): - def __init__(self, version: Version): """ Initialize the PluginReleaseList @@ -821,10 +820,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = PluginReleasePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/flex_api/v1/plugin_version_archive.py b/twilio/rest/flex_api/v1/plugin_version_archive.py index 2bdeed9c0..baa27612c 100644 --- a/twilio/rest/flex_api/v1/plugin_version_archive.py +++ b/twilio/rest/flex_api/v1/plugin_version_archive.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, values @@ -23,6 +24,7 @@ class PluginVersionArchiveInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Flex Plugin Version resource. :ivar plugin_sid: The SID of the Flex Plugin resource this Flex Plugin Version belongs to. @@ -147,7 +149,6 @@ def __repr__(self) -> str: class PluginVersionArchiveContext(InstanceContext): - def __init__(self, version: Version, plugin_sid: str, sid: str): """ Initialize the PluginVersionArchiveContext @@ -302,7 +303,6 @@ def __repr__(self) -> str: class PluginVersionArchiveList(ListResource): - def __init__(self, version: Version): """ Initialize the PluginVersionArchiveList diff --git a/twilio/rest/flex_api/v1/provisioning_status.py b/twilio/rest/flex_api/v1/provisioning_status.py index a13a1baab..a96774212 100644 --- a/twilio/rest/flex_api/v1/provisioning_status.py +++ b/twilio/rest/flex_api/v1/provisioning_status.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,7 +23,6 @@ class ProvisioningStatusInstance(InstanceResource): - class Status(object): ACTIVE = "active" IN_PROGRESS = "in-progress" @@ -105,7 +105,6 @@ def __repr__(self) -> str: class ProvisioningStatusContext(InstanceContext): - def __init__(self, version: Version): """ Initialize the ProvisioningStatusContext @@ -213,7 +212,6 @@ def __repr__(self) -> str: class ProvisioningStatusList(ListResource): - def __init__(self, version: Version): """ Initialize the ProvisioningStatusList diff --git a/twilio/rest/flex_api/v1/web_channel.py b/twilio/rest/flex_api/v1/web_channel.py index 0fc159abe..3e0b6b8ac 100644 --- a/twilio/rest/flex_api/v1/web_channel.py +++ b/twilio/rest/flex_api/v1/web_channel.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class WebChannelInstance(InstanceResource): - class ChatStatus(object): INACTIVE = "inactive" @@ -228,7 +228,6 @@ def __repr__(self) -> str: class WebChannelContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the WebChannelContext @@ -543,7 +542,6 @@ def __repr__(self) -> str: class WebChannelPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> WebChannelInstance: """ Build an instance of WebChannelInstance @@ -562,7 +560,6 @@ def __repr__(self) -> str: class WebChannelList(ListResource): - def __init__(self, version: Version): """ Initialize the WebChannelList @@ -1103,10 +1100,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = WebChannelPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/flex_api/v2/__init__.py b/twilio/rest/flex_api/v2/__init__.py index e05ffcdfb..3fd0ec619 100644 --- a/twilio/rest/flex_api/v2/__init__.py +++ b/twilio/rest/flex_api/v2/__init__.py @@ -15,12 +15,12 @@ from typing import Optional from twilio.base.version import Version from twilio.base.domain import Domain +from twilio.rest.flex_api.v2.flex_team import FlexTeamList from twilio.rest.flex_api.v2.flex_user import FlexUserList from twilio.rest.flex_api.v2.web_channels import WebChannelsList class V2(Version): - def __init__(self, domain: Domain): """ Initialize the V2 version of FlexApi @@ -28,9 +28,16 @@ def __init__(self, domain: Domain): :param domain: The Twilio.flex_api domain """ super().__init__(domain, "v2") + self._flex_team: Optional[FlexTeamList] = None self._flex_user: Optional[FlexUserList] = None self._web_channels: Optional[WebChannelsList] = None + @property + def flex_team(self) -> FlexTeamList: + if self._flex_team is None: + self._flex_team = FlexTeamList(self) + return self._flex_team + @property def flex_user(self) -> FlexUserList: if self._flex_user is None: diff --git a/twilio/rest/flex_api/v2/flex_team.py b/twilio/rest/flex_api/v2/flex_team.py new file mode 100644 index 000000000..6dd21ccf6 --- /dev/null +++ b/twilio/rest/flex_api/v2/flex_team.py @@ -0,0 +1,506 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Flex + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.api_response import ApiResponse + +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 FlexTeamInstance(InstanceResource): + + """ + :ivar team_sid: + :ivar friendly_name: + :ivar member_count: + :ivar description: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + instance_sid: Optional[str] = None, + ): + super().__init__(version) + + self.team_sid: Optional[str] = payload.get("team_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.member_count: Optional[int] = deserialize.integer( + payload.get("member_count") + ) + self.description: Optional[str] = payload.get("description") + + self._solution = { + "instance_sid": instance_sid or self.instance_sid, + } + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class FlexTeamPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> FlexTeamInstance: + """ + Build an instance of FlexTeamInstance + + :param payload: Payload response from the API + """ + return FlexTeamInstance( + self._version, payload, instance_sid=self._solution["instance_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class FlexTeamList(ListResource): + def __init__(self, version: Version, instance_sid: str): + """ + Initialize the FlexTeamList + + :param version: Version that contains the resource + :param instance_sid: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "instance_sid": instance_sid, + } + self._uri = "/Instances/{instance_sid}/Teams".format(**self._solution) + + def stream( + self, + owner: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[FlexTeamInstance]: + """ + Streams FlexTeamInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str owner: + :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(owner=owner, page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + owner: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[FlexTeamInstance]: + """ + Asynchronously streams FlexTeamInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str owner: + :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(owner=owner, page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def stream_with_http_info( + self, + owner: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams FlexTeamInstance and returns headers from first page + + + :param str owner: + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info( + owner=owner, page_size=limits["page_size"] + ) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + owner: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams FlexTeamInstance and returns headers from first page + + + :param str owner: + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + owner=owner, page_size=limits["page_size"] + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + owner: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[FlexTeamInstance]: + """ + Lists FlexTeamInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str owner: + :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( + owner=owner, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + owner: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[FlexTeamInstance]: + """ + Asynchronously lists FlexTeamInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str owner: + :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( + owner=owner, + limit=limit, + page_size=page_size, + ) + ] + + def list_with_http_info( + self, + owner: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists FlexTeamInstance and returns headers from first page + + + :param str owner: + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + owner=owner, + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + owner: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists FlexTeamInstance and returns headers from first page + + + :param str owner: + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + owner=owner, + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + owner: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> FlexTeamPage: + """ + Retrieve a single page of FlexTeamInstance records from the API. + Request is executed immediately + + :param owner: + :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 FlexTeamInstance + """ + data = values.of( + { + "Owner": owner, + "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 FlexTeamPage(self._version, response, self._solution) + + async def page_async( + self, + owner: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> FlexTeamPage: + """ + Asynchronously retrieve a single page of FlexTeamInstance records from the API. + Request is executed immediately + + :param owner: + :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 FlexTeamInstance + """ + data = values.of( + { + "Owner": owner, + "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 FlexTeamPage(self._version, response, self._solution) + + def page_with_http_info( + self, + owner: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :param owner: + :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: ApiResponse with FlexTeamPage, status code, and headers + """ + data = values.of( + { + "Owner": owner, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = FlexTeamPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + owner: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :param owner: + :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: ApiResponse with FlexTeamPage, status code, and headers + """ + data = values.of( + { + "Owner": owner, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = FlexTeamPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> FlexTeamPage: + """ + Retrieve a specific page of FlexTeamInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of FlexTeamInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return FlexTeamPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> FlexTeamPage: + """ + Asynchronously retrieve a specific page of FlexTeamInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of FlexTeamInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return FlexTeamPage(self._version, response, self._solution) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/flex_api/v2/flex_user.py b/twilio/rest/flex_api/v2/flex_user.py index 5860a1429..5a3870122 100644 --- a/twilio/rest/flex_api/v2/flex_user.py +++ b/twilio/rest/flex_api/v2/flex_user.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, List, Optional, Union from twilio.base import deserialize, values @@ -23,6 +24,7 @@ class FlexUserInstance(InstanceResource): + """ :ivar account_sid: The unique SID of the account that created the resource. :ivar instance_sid: The unique ID created by Twilio to identify a Flex instance. @@ -223,7 +225,6 @@ def __repr__(self) -> str: class FlexUserContext(InstanceContext): - def __init__(self, version: Version, instance_sid: str, flex_user_sid: str): """ Initialize the FlexUserContext @@ -508,7 +509,6 @@ def __repr__(self) -> str: class FlexUserList(ListResource): - def __init__(self, version: Version): """ Initialize the FlexUserList diff --git a/twilio/rest/flex_api/v2/web_channels.py b/twilio/rest/flex_api/v2/web_channels.py index f25f90734..0206b24aa 100644 --- a/twilio/rest/flex_api/v2/web_channels.py +++ b/twilio/rest/flex_api/v2/web_channels.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class WebChannelsInstance(InstanceResource): + """ :ivar conversation_sid: The unique string representing the [Conversation resource](https://www.twilio.com/docs/conversations/api/conversation-resource) created. :ivar identity: The unique string representing the User created and should be authorized to participate in the Conversation. For more details, see [User Identity & Access Tokens](https://www.twilio.com/docs/conversations/identity). @@ -44,7 +46,6 @@ def __repr__(self) -> str: class WebChannelsList(ListResource): - def __init__(self, version: Version): """ Initialize the WebChannelsList diff --git a/twilio/rest/frontline_api/FrontlineApiBase.py b/twilio/rest/frontline_api/FrontlineApiBase.py index d9dadc16e..302854dc0 100644 --- a/twilio/rest/frontline_api/FrontlineApiBase.py +++ b/twilio/rest/frontline_api/FrontlineApiBase.py @@ -17,7 +17,6 @@ class FrontlineApiBase(Domain): - def __init__(self, twilio: Client): """ Initialize the FrontlineApi Domain diff --git a/twilio/rest/frontline_api/v1/__init__.py b/twilio/rest/frontline_api/v1/__init__.py index 610ed3719..d2629dd5a 100644 --- a/twilio/rest/frontline_api/v1/__init__.py +++ b/twilio/rest/frontline_api/v1/__init__.py @@ -19,7 +19,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of FrontlineApi diff --git a/twilio/rest/frontline_api/v1/user.py b/twilio/rest/frontline_api/v1/user.py index bea272bf1..30a703fbb 100644 --- a/twilio/rest/frontline_api/v1/user.py +++ b/twilio/rest/frontline_api/v1/user.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -22,7 +23,6 @@ class UserInstance(InstanceResource): - class StateType(object): ACTIVE = "active" DEACTIVATED = "deactivated" @@ -213,7 +213,6 @@ def __repr__(self) -> str: class UserContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the UserContext @@ -496,7 +495,6 @@ def __repr__(self) -> str: class UserList(ListResource): - def __init__(self, version: Version): """ Initialize the UserList diff --git a/twilio/rest/iam/IamBase.py b/twilio/rest/iam/IamBase.py index fc056efe4..53cade41a 100644 --- a/twilio/rest/iam/IamBase.py +++ b/twilio/rest/iam/IamBase.py @@ -14,7 +14,6 @@ class IamBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Iam Domain diff --git a/twilio/rest/iam/v1/__init__.py b/twilio/rest/iam/v1/__init__.py index fc5edb694..75e311284 100644 --- a/twilio/rest/iam/v1/__init__.py +++ b/twilio/rest/iam/v1/__init__.py @@ -15,15 +15,10 @@ from typing import Optional from twilio.base.version import Version from twilio.base.domain import Domain -from twilio.rest.iam.v1.api_key import ApiKeyList -from twilio.rest.iam.v1.get_api_keys import GetApiKeysList -from twilio.rest.iam.v1.new_api_key import NewApiKeyList -from twilio.rest.iam.v1.o_auth_app import OAuthAppList -from twilio.rest.iam.v1.token import TokenList +from twilio.rest.iam.v1.self import SelfList class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Iam @@ -31,41 +26,13 @@ def __init__(self, domain: Domain): :param domain: The Twilio.iam domain """ super().__init__(domain, "v1") - self._api_key: Optional[ApiKeyList] = None - self._get_api_keys: Optional[GetApiKeysList] = None - self._new_api_key: Optional[NewApiKeyList] = None - self._o_auth_apps: Optional[OAuthAppList] = None - self._token: Optional[TokenList] = None - - @property - def api_key(self) -> ApiKeyList: - if self._api_key is None: - self._api_key = ApiKeyList(self) - return self._api_key - - @property - def get_api_keys(self) -> GetApiKeysList: - if self._get_api_keys is None: - self._get_api_keys = GetApiKeysList(self) - return self._get_api_keys - - @property - def new_api_key(self) -> NewApiKeyList: - if self._new_api_key is None: - self._new_api_key = NewApiKeyList(self) - return self._new_api_key - - @property - def o_auth_apps(self) -> OAuthAppList: - if self._o_auth_apps is None: - self._o_auth_apps = OAuthAppList(self) - return self._o_auth_apps + self._self: Optional[SelfList] = None @property - def token(self) -> TokenList: - if self._token is None: - self._token = TokenList(self) - return self._token + def self(self) -> SelfList: + if self._self is None: + self._self = SelfList(self) + return self._self def __repr__(self) -> str: """ diff --git a/twilio/rest/iam/v1/api_key.py b/twilio/rest/iam/v1/api_key.py index 65166ec76..736be7abc 100644 --- a/twilio/rest/iam/v1/api_key.py +++ b/twilio/rest/iam/v1/api_key.py @@ -221,7 +221,6 @@ def __repr__(self) -> str: class ApiKeyContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the ApiKeyContext @@ -534,7 +533,6 @@ def __repr__(self) -> str: class ApiKeyList(ListResource): - def __init__(self, version: Version): """ Initialize the ApiKeyList diff --git a/twilio/rest/iam/v1/get_api_keys.py b/twilio/rest/iam/v1/get_api_keys.py index deab6f522..950d29f0a 100644 --- a/twilio/rest/iam/v1/get_api_keys.py +++ b/twilio/rest/iam/v1/get_api_keys.py @@ -56,7 +56,6 @@ def __repr__(self) -> str: class GetApiKeysPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> GetApiKeysInstance: """ Build an instance of GetApiKeysInstance @@ -75,7 +74,6 @@ def __repr__(self) -> str: class GetApiKeysList(ListResource): - def __init__(self, version: Version): """ Initialize the GetApiKeysList @@ -454,10 +452,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = GetApiKeysPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/iam/v1/new_api_key.py b/twilio/rest/iam/v1/new_api_key.py index a89d5cc60..f7531e588 100644 --- a/twilio/rest/iam/v1/new_api_key.py +++ b/twilio/rest/iam/v1/new_api_key.py @@ -23,7 +23,6 @@ class NewApiKeyInstance(InstanceResource): - class Keytype(object): RESTRICTED = "restricted" @@ -61,7 +60,6 @@ def __repr__(self) -> str: class NewApiKeyList(ListResource): - def __init__(self, version: Version): """ Initialize the NewApiKeyList diff --git a/twilio/rest/iam/v1/o_auth_app.py b/twilio/rest/iam/v1/o_auth_app.py index 154771d31..113770659 100644 --- a/twilio/rest/iam/v1/o_auth_app.py +++ b/twilio/rest/iam/v1/o_auth_app.py @@ -23,7 +23,6 @@ class OAuthAppInstance(InstanceResource): - class IamV1AccountVendorOauthAppCreateRequest(object): """ :ivar type: @@ -36,7 +35,6 @@ class IamV1AccountVendorOauthAppCreateRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.type: Optional[str] = payload.get("type") self.friendly_name: Optional[str] = payload.get("friendly_name") self.owner_sid: Optional[str] = payload.get("owner_sid") @@ -68,7 +66,6 @@ class IamV1AccountVendorOauthAppUpdateRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.type: Optional[str] = payload.get("type") self.friendly_name: Optional[str] = payload.get("friendly_name") self.description: Optional[str] = payload.get("description") @@ -93,7 +90,6 @@ class IamV1OrganizationVendorOauthAppUpdateRequestPolicy(object): """ def __init__(self, payload: Dict[str, Any]): - self.allow: Optional[List[str]] = payload.get("allow") self.deny: Optional[List[str]] = payload.get("deny") @@ -110,7 +106,6 @@ class IamV1OrganizationVendoroauthappPolicy(object): """ def __init__(self, payload: Dict[str, Any]): - self.allow: Optional[List[str]] = payload.get("allow") self.deny: Optional[List[str]] = payload.get("deny") @@ -286,7 +281,6 @@ def __repr__(self) -> str: class OAuthAppContext(InstanceContext): - class IamV1AccountVendorOauthAppCreateRequest(object): """ :ivar type: @@ -299,7 +293,6 @@ class IamV1AccountVendorOauthAppCreateRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.type: Optional[str] = payload.get("type") self.friendly_name: Optional[str] = payload.get("friendly_name") self.owner_sid: Optional[str] = payload.get("owner_sid") @@ -331,7 +324,6 @@ class IamV1AccountVendorOauthAppUpdateRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.type: Optional[str] = payload.get("type") self.friendly_name: Optional[str] = payload.get("friendly_name") self.description: Optional[str] = payload.get("description") @@ -356,7 +348,6 @@ class IamV1OrganizationVendorOauthAppUpdateRequestPolicy(object): """ def __init__(self, payload: Dict[str, Any]): - self.allow: Optional[List[str]] = payload.get("allow") self.deny: Optional[List[str]] = payload.get("deny") @@ -373,7 +364,6 @@ class IamV1OrganizationVendoroauthappPolicy(object): """ def __init__(self, payload: Dict[str, Any]): - self.allow: Optional[List[str]] = payload.get("allow") self.deny: Optional[List[str]] = payload.get("deny") @@ -591,7 +581,6 @@ def __repr__(self) -> str: class OAuthAppList(ListResource): - class IamV1AccountVendorOauthAppCreateRequest(object): """ :ivar type: @@ -604,7 +593,6 @@ class IamV1AccountVendorOauthAppCreateRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.type: Optional[str] = payload.get("type") self.friendly_name: Optional[str] = payload.get("friendly_name") self.owner_sid: Optional[str] = payload.get("owner_sid") @@ -636,7 +624,6 @@ class IamV1AccountVendorOauthAppUpdateRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.type: Optional[str] = payload.get("type") self.friendly_name: Optional[str] = payload.get("friendly_name") self.description: Optional[str] = payload.get("description") @@ -661,7 +648,6 @@ class IamV1OrganizationVendorOauthAppUpdateRequestPolicy(object): """ def __init__(self, payload: Dict[str, Any]): - self.allow: Optional[List[str]] = payload.get("allow") self.deny: Optional[List[str]] = payload.get("deny") @@ -678,7 +664,6 @@ class IamV1OrganizationVendoroauthappPolicy(object): """ def __init__(self, payload: Dict[str, Any]): - self.allow: Optional[List[str]] = payload.get("allow") self.deny: Optional[List[str]] = payload.get("deny") diff --git a/twilio/rest/iam/v1/self.py b/twilio/rest/iam/v1/self.py new file mode 100644 index 000000000..a547303aa --- /dev/null +++ b/twilio/rest/iam/v1/self.py @@ -0,0 +1,156 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Iam + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from typing import Any, Dict, List, Optional +from twilio.base import values +from twilio.base.api_response import ApiResponse + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class SelfInstance(InstanceResource): + + """ + :ivar user_sid: Unique Twilio user sid + :ivar first_name: User first name + :ivar last_name: User last name + :ivar email: User email address + :ivar email_verified: Whether the user email is verified or not + :ivar sso: Whether the user has SSO enabled + :ivar organization_sid: Unique Twilio organization sid + :ivar organization_friendly_name: Organization friendly name + :ivar time_zone: User time zone + :ivar social_connections: List of social connections associated with the user + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.user_sid: Optional[str] = payload.get("userSid") + self.first_name: Optional[str] = payload.get("firstName") + self.last_name: Optional[str] = payload.get("lastName") + self.email: Optional[str] = payload.get("email") + self.email_verified: Optional[bool] = payload.get("emailVerified") + self.sso: Optional[bool] = payload.get("sso") + self.organization_sid: Optional[str] = payload.get("organizationSid") + self.organization_friendly_name: Optional[str] = payload.get( + "organizationFriendlyName" + ) + self.time_zone: Optional[str] = payload.get("timeZone") + self.social_connections: Optional[List[str]] = payload.get("socialConnections") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class SelfList(ListResource): + def __init__(self, version: Version): + """ + Initialize the SelfList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Users/Self" + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> SelfInstance: + """ + Fetch the SelfInstance + + + :returns: The fetched SelfInstance + """ + payload, _, _ = self._fetch() + return SelfInstance(self._version, payload) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the SelfInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = SelfInstance(self._version, payload) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> SelfInstance: + """ + Asynchronously fetch the SelfInstance + + + :returns: The fetched SelfInstance + """ + payload, _, _ = await self._fetch_async() + return SelfInstance(self._version, payload) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronously fetch the SelfInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = SelfInstance(self._version, payload) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/iam/v1/token.py b/twilio/rest/iam/v1/token.py index 72d5da3fe..70a3519ea 100644 --- a/twilio/rest/iam/v1/token.py +++ b/twilio/rest/iam/v1/token.py @@ -50,7 +50,6 @@ def __repr__(self) -> str: class TokenList(ListResource): - def __init__(self, version: Version): """ Initialize the TokenList diff --git a/twilio/rest/insights/InsightsBase.py b/twilio/rest/insights/InsightsBase.py index 458122cec..efe713ba0 100644 --- a/twilio/rest/insights/InsightsBase.py +++ b/twilio/rest/insights/InsightsBase.py @@ -17,7 +17,6 @@ class InsightsBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Insights Domain diff --git a/twilio/rest/insights/v1/__init__.py b/twilio/rest/insights/v1/__init__.py index 8f7d1946f..b5b6c4486 100644 --- a/twilio/rest/insights/v1/__init__.py +++ b/twilio/rest/insights/v1/__init__.py @@ -23,7 +23,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Insights diff --git a/twilio/rest/insights/v1/call/__init__.py b/twilio/rest/insights/v1/call/__init__.py index a95792251..37134d871 100644 --- a/twilio/rest/insights/v1/call/__init__.py +++ b/twilio/rest/insights/v1/call/__init__.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -27,6 +28,7 @@ class CallInstance(InstanceResource): + """ :ivar sid: :ivar url: @@ -137,7 +139,6 @@ def __repr__(self) -> str: class CallContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the CallContext @@ -307,7 +308,6 @@ def __repr__(self) -> str: class CallList(ListResource): - def __init__(self, version: Version): """ Initialize the CallList diff --git a/twilio/rest/insights/v1/call/annotation.py b/twilio/rest/insights/v1/call/annotation.py index a5ad932b5..dd5a50492 100644 --- a/twilio/rest/insights/v1/call/annotation.py +++ b/twilio/rest/insights/v1/call/annotation.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union from twilio.base import deserialize, serialize, values from twilio.base.api_response import ApiResponse @@ -22,7 +23,6 @@ class AnnotationInstance(InstanceResource): - class AnsweredBy(object): UNKNOWN_ANSWERED_BY = "unknown_answered_by" HUMAN = "human" @@ -57,9 +57,9 @@ def __init__(self, version: Version, payload: Dict[str, Any], call_sid: str): self.answered_by: Optional["AnnotationInstance.AnsweredBy"] = payload.get( "answered_by" ) - self.connectivity_issue: Optional["AnnotationInstance.ConnectivityIssue"] = ( - payload.get("connectivity_issue") - ) + self.connectivity_issue: Optional[ + "AnnotationInstance.ConnectivityIssue" + ] = payload.get("connectivity_issue") self.quality_issues: Optional[List[str]] = payload.get("quality_issues") self.spam: Optional[bool] = payload.get("spam") self.call_score: Optional[int] = deserialize.integer(payload.get("call_score")) @@ -274,7 +274,6 @@ def __repr__(self) -> str: class AnnotationContext(InstanceContext): - def __init__(self, version: Version, call_sid: str): """ Initialize the AnnotationContext @@ -625,7 +624,6 @@ def __repr__(self) -> str: class AnnotationList(ListResource): - def __init__(self, version: Version, call_sid: str): """ Initialize the AnnotationList diff --git a/twilio/rest/insights/v1/call/call_summary.py b/twilio/rest/insights/v1/call/call_summary.py index e45d7d7c9..b7fa4b185 100644 --- a/twilio/rest/insights/v1/call/call_summary.py +++ b/twilio/rest/insights/v1/call/call_summary.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, List, Optional, Union from twilio.base import deserialize, values @@ -23,7 +24,6 @@ class CallSummaryInstance(InstanceResource): - class AnsweredBy(object): UNKNOWN = "unknown" MACHINE_START = "machine_start" @@ -94,9 +94,9 @@ def __init__(self, version: Version, payload: Dict[str, Any], call_sid: str): self.answered_by: Optional["CallSummaryInstance.AnsweredBy"] = payload.get( "answered_by" ) - self.processing_state: Optional["CallSummaryInstance.ProcessingState"] = ( - payload.get("processing_state") - ) + self.processing_state: Optional[ + "CallSummaryInstance.ProcessingState" + ] = payload.get("processing_state") self.created_time: Optional[datetime] = deserialize.iso8601_datetime( payload.get("created_time") ) @@ -222,7 +222,6 @@ def __repr__(self) -> str: class CallSummaryContext(InstanceContext): - def __init__(self, version: Version, call_sid: str): """ Initialize the CallSummaryContext @@ -387,7 +386,6 @@ def __repr__(self) -> str: class CallSummaryList(ListResource): - def __init__(self, version: Version, call_sid: str): """ Initialize the CallSummaryList diff --git a/twilio/rest/insights/v1/call/event.py b/twilio/rest/insights/v1/call/event.py index b0a62f6b9..5cf398c61 100644 --- a/twilio/rest/insights/v1/call/event.py +++ b/twilio/rest/insights/v1/call/event.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,7 +24,6 @@ class EventInstance(InstanceResource): - class Level(object): UNKNOWN = "UNKNOWN" DEBUG = "DEBUG" @@ -82,7 +82,6 @@ def __repr__(self) -> str: class EventPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> EventInstance: """ Build an instance of EventInstance @@ -103,7 +102,6 @@ def __repr__(self) -> str: class EventList(ListResource): - def __init__(self, version: Version, call_sid: str): """ Initialize the EventList @@ -485,10 +483,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = EventPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/insights/v1/call/metric.py b/twilio/rest/insights/v1/call/metric.py index 3718638f4..2096eabbd 100644 --- a/twilio/rest/insights/v1/call/metric.py +++ b/twilio/rest/insights/v1/call/metric.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,7 +24,6 @@ class MetricInstance(InstanceResource): - class StreamDirection(object): UNKNOWN = "unknown" INBOUND = "inbound" @@ -79,7 +79,6 @@ def __repr__(self) -> str: class MetricPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> MetricInstance: """ Build an instance of MetricInstance @@ -100,7 +99,6 @@ def __repr__(self) -> str: class MetricList(ListResource): - def __init__(self, version: Version, call_sid: str): """ Initialize the MetricList @@ -516,10 +514,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = MetricPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/insights/v1/call_summaries.py b/twilio/rest/insights/v1/call_summaries.py index d27d5b1f8..b56de1f05 100644 --- a/twilio/rest/insights/v1/call_summaries.py +++ b/twilio/rest/insights/v1/call_summaries.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class CallSummariesInstance(InstanceResource): - class AnsweredBy(object): UNKNOWN = "unknown" MACHINE_START = "machine_start" @@ -105,9 +105,9 @@ def __init__(self, version: Version, payload: Dict[str, Any]): self.call_state: Optional["CallSummariesInstance.CallState"] = payload.get( "call_state" ) - self.processing_state: Optional["CallSummariesInstance.ProcessingState"] = ( - payload.get("processing_state") - ) + self.processing_state: Optional[ + "CallSummariesInstance.ProcessingState" + ] = payload.get("processing_state") self.created_time: Optional[datetime] = deserialize.iso8601_datetime( payload.get("created_time") ) @@ -145,7 +145,6 @@ def __repr__(self) -> str: class CallSummariesPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> CallSummariesInstance: """ Build an instance of CallSummariesInstance @@ -164,7 +163,6 @@ def __repr__(self) -> str: class CallSummariesList(ListResource): - def __init__(self, version: Version): """ Initialize the CallSummariesList @@ -1841,10 +1839,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CallSummariesPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/insights/v1/conference/__init__.py b/twilio/rest/insights/v1/conference/__init__.py index e1aa8feb4..c96cda02c 100644 --- a/twilio/rest/insights/v1/conference/__init__.py +++ b/twilio/rest/insights/v1/conference/__init__.py @@ -12,6 +12,7 @@ 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 @@ -27,7 +28,6 @@ class ConferenceInstance(InstanceResource): - class ConferenceEndReason(object): LAST_PARTICIPANT_LEFT = "last_participant_left" CONFERENCE_ENDED_VIA_API = "conference_ended_via_api" @@ -139,25 +139,25 @@ def __init__( self.unique_participants: Optional[int] = deserialize.integer( payload.get("unique_participants") ) - self.end_reason: Optional["ConferenceInstance.ConferenceEndReason"] = ( - payload.get("end_reason") - ) + self.end_reason: Optional[ + "ConferenceInstance.ConferenceEndReason" + ] = payload.get("end_reason") self.ended_by: Optional[str] = payload.get("ended_by") self.mixer_region: Optional["ConferenceInstance.Region"] = payload.get( "mixer_region" ) - self.mixer_region_requested: Optional["ConferenceInstance.Region"] = ( - payload.get("mixer_region_requested") - ) + self.mixer_region_requested: Optional[ + "ConferenceInstance.Region" + ] = payload.get("mixer_region_requested") self.recording_enabled: Optional[bool] = payload.get("recording_enabled") self.detected_issues: Optional[Dict[str, object]] = payload.get( "detected_issues" ) self.tags: Optional[List["ConferenceInstance.Tag"]] = payload.get("tags") self.tag_info: Optional[Dict[str, object]] = payload.get("tag_info") - self.processing_state: Optional["ConferenceInstance.ProcessingState"] = ( - payload.get("processing_state") - ) + self.processing_state: Optional[ + "ConferenceInstance.ProcessingState" + ] = payload.get("processing_state") self.url: Optional[str] = payload.get("url") self.links: Optional[Dict[str, object]] = payload.get("links") @@ -235,7 +235,6 @@ def __repr__(self) -> str: class ConferenceContext(InstanceContext): - def __init__(self, version: Version, conference_sid: str): """ Initialize the ConferenceContext @@ -366,7 +365,6 @@ def __repr__(self) -> str: class ConferencePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ConferenceInstance: """ Build an instance of ConferenceInstance @@ -385,7 +383,6 @@ def __repr__(self) -> str: class ConferenceList(ListResource): - def __init__(self, version: Version): """ Initialize the ConferenceList @@ -1094,10 +1091,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ConferencePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/insights/v1/conference/conference_participant.py b/twilio/rest/insights/v1/conference/conference_participant.py index 1a69d4f06..ae472154b 100644 --- a/twilio/rest/insights/v1/conference/conference_participant.py +++ b/twilio/rest/insights/v1/conference/conference_participant.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class ConferenceParticipantInstance(InstanceResource): - class CallDirection(object): INBOUND = "inbound" OUTBOUND = "outbound" @@ -109,14 +109,14 @@ def __init__( self.conference_sid: Optional[str] = payload.get("conference_sid") self.call_sid: Optional[str] = payload.get("call_sid") self.account_sid: Optional[str] = payload.get("account_sid") - self.call_direction: Optional["ConferenceParticipantInstance.CallDirection"] = ( - payload.get("call_direction") - ) + self.call_direction: Optional[ + "ConferenceParticipantInstance.CallDirection" + ] = payload.get("call_direction") self._from: Optional[str] = payload.get("from") self.to: Optional[str] = payload.get("to") - self.call_status: Optional["ConferenceParticipantInstance.CallStatus"] = ( - payload.get("call_status") - ) + self.call_status: Optional[ + "ConferenceParticipantInstance.CallStatus" + ] = payload.get("call_status") self.country_code: Optional[str] = payload.get("country_code") self.is_moderator: Optional[bool] = payload.get("is_moderator") self.join_time: Optional[datetime] = deserialize.iso8601_datetime( @@ -141,15 +141,15 @@ def __init__( self.coached_participants: Optional[List[str]] = payload.get( "coached_participants" ) - self.participant_region: Optional["ConferenceParticipantInstance.Region"] = ( - payload.get("participant_region") - ) - self.conference_region: Optional["ConferenceParticipantInstance.Region"] = ( - payload.get("conference_region") - ) - self.call_type: Optional["ConferenceParticipantInstance.CallType"] = ( - payload.get("call_type") - ) + self.participant_region: Optional[ + "ConferenceParticipantInstance.Region" + ] = payload.get("participant_region") + self.conference_region: Optional[ + "ConferenceParticipantInstance.Region" + ] = payload.get("conference_region") + self.call_type: Optional[ + "ConferenceParticipantInstance.CallType" + ] = payload.get("call_type") self.processing_state: Optional[ "ConferenceParticipantInstance.ProcessingState" ] = payload.get("processing_state") @@ -263,7 +263,6 @@ def __repr__(self) -> str: class ConferenceParticipantContext(InstanceContext): - def __init__(self, version: Version, conference_sid: str, participant_sid: str): """ Initialize the ConferenceParticipantContext @@ -438,7 +437,6 @@ def __repr__(self) -> str: class ConferenceParticipantPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ConferenceParticipantInstance: """ Build an instance of ConferenceParticipantInstance @@ -459,7 +457,6 @@ def __repr__(self) -> str: class ConferenceParticipantList(ListResource): - def __init__(self, version: Version, conference_sid: str): """ Initialize the ConferenceParticipantList @@ -923,10 +920,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ConferenceParticipantPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/insights/v1/room/__init__.py b/twilio/rest/insights/v1/room/__init__.py index e7cd0cb03..650757881 100644 --- a/twilio/rest/insights/v1/room/__init__.py +++ b/twilio/rest/insights/v1/room/__init__.py @@ -12,6 +12,7 @@ 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 @@ -25,7 +26,6 @@ class RoomInstance(InstanceResource): - class Codec(object): VP8 = "VP8" H264 = "H264" @@ -245,7 +245,6 @@ def __repr__(self) -> str: class RoomContext(InstanceContext): - def __init__(self, version: Version, room_sid: str): """ Initialize the RoomContext @@ -376,7 +375,6 @@ def __repr__(self) -> str: class RoomPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> RoomInstance: """ Build an instance of RoomInstance @@ -395,7 +393,6 @@ def __repr__(self) -> str: class RoomList(ListResource): - def __init__(self, version: Version): """ Initialize the RoomList @@ -924,10 +921,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = RoomPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/insights/v1/room/participant.py b/twilio/rest/insights/v1/room/participant.py index be77bd626..f33060b5f 100644 --- a/twilio/rest/insights/v1/room/participant.py +++ b/twilio/rest/insights/v1/room/participant.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class ParticipantInstance(InstanceResource): - class Codec(object): VP8 = "VP8" H264 = "H264" @@ -184,7 +184,6 @@ def __repr__(self) -> str: class ParticipantContext(InstanceContext): - def __init__(self, version: Version, room_sid: str, participant_sid: str): """ Initialize the ParticipantContext @@ -309,7 +308,6 @@ def __repr__(self) -> str: class ParticipantPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ParticipantInstance: """ Build an instance of ParticipantInstance @@ -330,7 +328,6 @@ def __repr__(self) -> str: class ParticipantList(ListResource): - def __init__(self, version: Version, room_sid: str): """ Initialize the ParticipantList @@ -678,10 +675,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ParticipantPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/insights/v1/setting.py b/twilio/rest/insights/v1/setting.py index daf49229a..480b6a14a 100644 --- a/twilio/rest/insights/v1/setting.py +++ b/twilio/rest/insights/v1/setting.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class SettingInstance(InstanceResource): + """ :ivar account_sid: The unique SID identifier of the Account. :ivar advanced_features: A boolean flag indicating whether Advanced Features for Voice Insights are enabled. @@ -204,7 +206,6 @@ def __repr__(self) -> str: class SettingContext(InstanceContext): - def __init__(self, version: Version): """ Initialize the SettingContext @@ -490,7 +491,6 @@ def __repr__(self) -> str: class SettingList(ListResource): - def __init__(self, version: Version): """ Initialize the SettingList diff --git a/twilio/rest/intelligence/IntelligenceBase.py b/twilio/rest/intelligence/IntelligenceBase.py index 0546bc15a..2cece972e 100644 --- a/twilio/rest/intelligence/IntelligenceBase.py +++ b/twilio/rest/intelligence/IntelligenceBase.py @@ -17,7 +17,6 @@ class IntelligenceBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Intelligence Domain diff --git a/twilio/rest/intelligence/v2/__init__.py b/twilio/rest/intelligence/v2/__init__.py index 4999146f9..cfbc40f1d 100644 --- a/twilio/rest/intelligence/v2/__init__.py +++ b/twilio/rest/intelligence/v2/__init__.py @@ -26,7 +26,6 @@ class V2(Version): - def __init__(self, domain: Domain): """ Initialize the V2 version of Intelligence diff --git a/twilio/rest/intelligence/v2/custom_operator.py b/twilio/rest/intelligence/v2/custom_operator.py index fe74eb61f..d5eb13caf 100644 --- a/twilio/rest/intelligence/v2/custom_operator.py +++ b/twilio/rest/intelligence/v2/custom_operator.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class CustomOperatorInstance(InstanceResource): - class Availability(object): INTERNAL = "internal" BETA = "beta" @@ -60,9 +60,9 @@ def __init__( self.author: Optional[str] = payload.get("author") self.operator_type: Optional[str] = payload.get("operator_type") self.version: Optional[int] = deserialize.integer(payload.get("version")) - self.availability: Optional["CustomOperatorInstance.Availability"] = ( - payload.get("availability") - ) + self.availability: Optional[ + "CustomOperatorInstance.Availability" + ] = payload.get("availability") self.config: Optional[Dict[str, object]] = payload.get("config") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") @@ -259,7 +259,6 @@ def __repr__(self) -> str: class CustomOperatorContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the CustomOperatorContext @@ -598,7 +597,6 @@ def __repr__(self) -> str: class CustomOperatorPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> CustomOperatorInstance: """ Build an instance of CustomOperatorInstance @@ -617,7 +615,6 @@ def __repr__(self) -> str: class CustomOperatorList(ListResource): - def __init__(self, version: Version): """ Initialize the CustomOperatorList @@ -1184,10 +1181,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CustomOperatorPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/intelligence/v2/operator.py b/twilio/rest/intelligence/v2/operator.py index 08969f80a..2da8b0a77 100644 --- a/twilio/rest/intelligence/v2/operator.py +++ b/twilio/rest/intelligence/v2/operator.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class OperatorInstance(InstanceResource): - class Availability(object): INTERNAL = "internal" BETA = "beta" @@ -139,7 +139,6 @@ def __repr__(self) -> str: class OperatorContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the OperatorContext @@ -256,7 +255,6 @@ def __repr__(self) -> str: class OperatorPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> OperatorInstance: """ Build an instance of OperatorInstance @@ -275,7 +273,6 @@ def __repr__(self) -> str: class OperatorList(ListResource): - def __init__(self, version: Version): """ Initialize the OperatorList @@ -696,10 +693,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = OperatorPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/intelligence/v2/operator_attachment.py b/twilio/rest/intelligence/v2/operator_attachment.py index 6f52ba3d1..fa8d75b76 100644 --- a/twilio/rest/intelligence/v2/operator_attachment.py +++ b/twilio/rest/intelligence/v2/operator_attachment.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class OperatorAttachmentInstance(InstanceResource): + """ :ivar service_sid: The unique SID identifier of the Service. :ivar operator_sid: The unique SID identifier of the Operator. @@ -146,7 +148,6 @@ def __repr__(self) -> str: class OperatorAttachmentContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, operator_sid: str): """ Initialize the OperatorAttachmentContext @@ -341,7 +342,6 @@ def __repr__(self) -> str: class OperatorAttachmentList(ListResource): - def __init__(self, version: Version): """ Initialize the OperatorAttachmentList diff --git a/twilio/rest/intelligence/v2/operator_attachments.py b/twilio/rest/intelligence/v2/operator_attachments.py index 1af3d960a..aa8b7223c 100644 --- a/twilio/rest/intelligence/v2/operator_attachments.py +++ b/twilio/rest/intelligence/v2/operator_attachments.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class OperatorAttachmentsInstance(InstanceResource): + """ :ivar service_sid: The unique SID identifier of the Service. :ivar operator_sids: List of Operator SIDs attached to the service. Includes both Custom and Pre-built Operators. @@ -107,7 +109,6 @@ def __repr__(self) -> str: class OperatorAttachmentsContext(InstanceContext): - def __init__(self, version: Version, service_sid: str): """ Initialize the OperatorAttachmentsContext @@ -224,7 +225,6 @@ def __repr__(self) -> str: class OperatorAttachmentsList(ListResource): - def __init__(self, version: Version): """ Initialize the OperatorAttachmentsList diff --git a/twilio/rest/intelligence/v2/operator_type.py b/twilio/rest/intelligence/v2/operator_type.py index 2b363bc9e..c91a5987f 100644 --- a/twilio/rest/intelligence/v2/operator_type.py +++ b/twilio/rest/intelligence/v2/operator_type.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class OperatorTypeInstance(InstanceResource): - class Availability(object): INTERNAL = "internal" BETA = "beta" @@ -160,7 +160,6 @@ def __repr__(self) -> str: class OperatorTypeContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the OperatorTypeContext @@ -277,7 +276,6 @@ def __repr__(self) -> str: class OperatorTypePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> OperatorTypeInstance: """ Build an instance of OperatorTypeInstance @@ -296,7 +294,6 @@ def __repr__(self) -> str: class OperatorTypeList(ListResource): - def __init__(self, version: Version): """ Initialize the OperatorTypeList @@ -310,6 +307,7 @@ def __init__(self, version: Version): def stream( self, + language_code: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> Iterator[OperatorTypeInstance]: @@ -319,6 +317,7 @@ def stream( is reached. The results are returned as a generator, so this operation is memory efficient. + :param str language_code: Returns Operator Types that support the provided language code. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -329,12 +328,13 @@ def stream( :returns: Generator that will yield up to limit results """ limits = self._version.read_limits(limit, page_size) - page = self.page(page_size=limits["page_size"]) + page = self.page(language_code=language_code, page_size=limits["page_size"]) return self._version.stream(page, limits["limit"]) async def stream_async( self, + language_code: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> AsyncIterator[OperatorTypeInstance]: @@ -344,6 +344,7 @@ async def stream_async( is reached. The results are returned as a generator, so this operation is memory efficient. + :param str language_code: Returns Operator Types that support the provided language code. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -354,12 +355,15 @@ async def stream_async( :returns: Generator that will yield up to limit results """ limits = self._version.read_limits(limit, page_size) - page = await self.page_async(page_size=limits["page_size"]) + page = await self.page_async( + language_code=language_code, page_size=limits["page_size"] + ) return self._version.stream_async(page, limits["limit"]) def stream_with_http_info( self, + language_code: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> tuple: @@ -367,6 +371,7 @@ def stream_with_http_info( Streams OperatorTypeInstance and returns headers from first page + :param str language_code: Returns Operator Types that support the provided language code. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -377,13 +382,16 @@ def stream_with_http_info( :returns: tuple of (generator, status_code, headers) where generator yields instances """ limits = self._version.read_limits(limit, page_size) - page_response = self.page_with_http_info(page_size=limits["page_size"]) + page_response = self.page_with_http_info( + language_code=language_code, page_size=limits["page_size"] + ) generator = self._version.stream(page_response.data, limits["limit"]) return (generator, page_response.status_code, page_response.headers) async def stream_with_http_info_async( self, + language_code: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> tuple: @@ -391,6 +399,7 @@ async def stream_with_http_info_async( Asynchronously streams OperatorTypeInstance and returns headers from first page + :param str language_code: Returns Operator Types that support the provided language code. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -402,7 +411,7 @@ async def stream_with_http_info_async( """ limits = self._version.read_limits(limit, page_size) page_response = await self.page_with_http_info_async( - page_size=limits["page_size"] + language_code=language_code, page_size=limits["page_size"] ) generator = self._version.stream_async(page_response.data, limits["limit"]) @@ -410,6 +419,7 @@ async def stream_with_http_info_async( def list( self, + language_code: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[OperatorTypeInstance]: @@ -418,6 +428,7 @@ def list( Unlike stream(), this operation is eager and will load `limit` records into memory before returning. + :param str language_code: Returns Operator Types that support the provided language code. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -429,6 +440,7 @@ def list( """ return list( self.stream( + language_code=language_code, limit=limit, page_size=page_size, ) @@ -436,6 +448,7 @@ def list( async def list_async( self, + language_code: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[OperatorTypeInstance]: @@ -444,6 +457,7 @@ async def list_async( Unlike stream(), this operation is eager and will load `limit` records into memory before returning. + :param str language_code: Returns Operator Types that support the provided language code. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -456,6 +470,7 @@ async def list_async( return [ record async for record in await self.stream_async( + language_code=language_code, limit=limit, page_size=page_size, ) @@ -463,6 +478,7 @@ async def list_async( def list_with_http_info( self, + language_code: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> ApiResponse: @@ -470,6 +486,7 @@ def list_with_http_info( Lists OperatorTypeInstance and returns headers from first page + :param str language_code: Returns Operator Types that support the provided language code. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -480,6 +497,7 @@ def list_with_http_info( :returns: ApiResponse with list of instances, status code, and headers """ generator, status_code, headers = self.stream_with_http_info( + language_code=language_code, limit=limit, page_size=page_size, ) @@ -488,6 +506,7 @@ def list_with_http_info( async def list_with_http_info_async( self, + language_code: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> ApiResponse: @@ -495,6 +514,7 @@ async def list_with_http_info_async( Asynchronously lists OperatorTypeInstance and returns headers from first page + :param str language_code: Returns Operator Types that support the provided language code. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -505,6 +525,7 @@ async def list_with_http_info_async( :returns: ApiResponse with list of instances, status code, and headers """ generator, status_code, headers = await self.stream_with_http_info_async( + language_code=language_code, limit=limit, page_size=page_size, ) @@ -513,6 +534,7 @@ async def list_with_http_info_async( def page( self, + language_code: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -521,6 +543,7 @@ def page( Retrieve a single page of OperatorTypeInstance records from the API. Request is executed immediately + :param language_code: Returns Operator Types that support the provided language code. :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state :param page_size: Number of records to return, defaults to 50 @@ -529,6 +552,7 @@ def page( """ data = values.of( { + "LanguageCode": language_code, "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -546,6 +570,7 @@ def page( async def page_async( self, + language_code: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -554,6 +579,7 @@ async def page_async( Asynchronously retrieve a single page of OperatorTypeInstance records from the API. Request is executed immediately + :param language_code: Returns Operator Types that support the provided language code. :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state :param page_size: Number of records to return, defaults to 50 @@ -562,6 +588,7 @@ async def page_async( """ data = values.of( { + "LanguageCode": language_code, "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -579,6 +606,7 @@ async def page_async( def page_with_http_info( self, + language_code: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -587,6 +615,7 @@ def page_with_http_info( Retrieve a single page with response metadata + :param language_code: Returns Operator Types that support the provided language code. :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state :param page_size: Number of records to return, defaults to 50 @@ -595,6 +624,7 @@ def page_with_http_info( """ data = values.of( { + "LanguageCode": language_code, "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -613,6 +643,7 @@ def page_with_http_info( async def page_with_http_info_async( self, + language_code: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -621,6 +652,7 @@ async def page_with_http_info_async( Asynchronously retrieve a single page with response metadata + :param language_code: Returns Operator Types that support the provided language code. :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state :param page_size: Number of records to return, defaults to 50 @@ -629,6 +661,7 @@ async def page_with_http_info_async( """ data = values.of( { + "LanguageCode": language_code, "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -639,10 +672,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = OperatorTypePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/intelligence/v2/prebuilt_operator.py b/twilio/rest/intelligence/v2/prebuilt_operator.py index 729abc62b..20e157b8a 100644 --- a/twilio/rest/intelligence/v2/prebuilt_operator.py +++ b/twilio/rest/intelligence/v2/prebuilt_operator.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class PrebuiltOperatorInstance(InstanceResource): - class Availability(object): INTERNAL = "internal" BETA = "beta" @@ -59,9 +59,9 @@ def __init__( self.author: Optional[str] = payload.get("author") self.operator_type: Optional[str] = payload.get("operator_type") self.version: Optional[int] = deserialize.integer(payload.get("version")) - self.availability: Optional["PrebuiltOperatorInstance.Availability"] = ( - payload.get("availability") - ) + self.availability: Optional[ + "PrebuiltOperatorInstance.Availability" + ] = payload.get("availability") self.config: Optional[Dict[str, object]] = payload.get("config") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") @@ -138,7 +138,6 @@ def __repr__(self) -> str: class PrebuiltOperatorContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the PrebuiltOperatorContext @@ -255,7 +254,6 @@ def __repr__(self) -> str: class PrebuiltOperatorPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> PrebuiltOperatorInstance: """ Build an instance of PrebuiltOperatorInstance @@ -274,7 +272,6 @@ def __repr__(self) -> str: class PrebuiltOperatorList(ListResource): - def __init__(self, version: Version): """ Initialize the PrebuiltOperatorList @@ -719,10 +716,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = PrebuiltOperatorPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/intelligence/v2/service.py b/twilio/rest/intelligence/v2/service.py index 78c303ce6..86f31c82d 100644 --- a/twilio/rest/intelligence/v2/service.py +++ b/twilio/rest/intelligence/v2/service.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class ServiceInstance(InstanceResource): - class HttpMethod(object): GET = "GET" POST = "POST" @@ -354,7 +354,6 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -809,7 +808,6 @@ def __repr__(self) -> str: class ServicePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -828,7 +826,6 @@ def __repr__(self) -> str: class ServiceList(ListResource): - def __init__(self, version: Version): """ Initialize the ServiceList @@ -1433,10 +1430,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ServicePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/intelligence/v2/transcript/__init__.py b/twilio/rest/intelligence/v2/transcript/__init__.py index 3c45a33b0..4d6c82fea 100644 --- a/twilio/rest/intelligence/v2/transcript/__init__.py +++ b/twilio/rest/intelligence/v2/transcript/__init__.py @@ -12,6 +12,7 @@ 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 @@ -33,7 +34,6 @@ class TranscriptInstance(InstanceResource): - class Status(object): QUEUED = "queued" IN_PROGRESS = "in-progress" @@ -230,7 +230,6 @@ def __repr__(self) -> str: class TranscriptContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the TranscriptContext @@ -481,7 +480,6 @@ def __repr__(self) -> str: class TranscriptPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> TranscriptInstance: """ Build an instance of TranscriptInstance @@ -500,7 +498,6 @@ def __repr__(self) -> str: class TranscriptList(ListResource): - def __init__(self, version: Version): """ Initialize the TranscriptList @@ -1303,10 +1300,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = TranscriptPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/intelligence/v2/transcript/encrypted_operator_results.py b/twilio/rest/intelligence/v2/transcript/encrypted_operator_results.py index 04b8fccb8..5ccb53085 100644 --- a/twilio/rest/intelligence/v2/transcript/encrypted_operator_results.py +++ b/twilio/rest/intelligence/v2/transcript/encrypted_operator_results.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class EncryptedOperatorResultsInstance(InstanceResource): + """ :ivar locations: The locations of the encrypted operator results. :ivar transcript_sid: @@ -124,7 +126,6 @@ def __repr__(self) -> str: class EncryptedOperatorResultsContext(InstanceContext): - def __init__(self, version: Version, transcript_sid: str): """ Initialize the EncryptedOperatorResultsContext @@ -269,7 +270,6 @@ def __repr__(self) -> str: class EncryptedOperatorResultsList(ListResource): - def __init__(self, version: Version, transcript_sid: str): """ Initialize the EncryptedOperatorResultsList diff --git a/twilio/rest/intelligence/v2/transcript/encrypted_sentences.py b/twilio/rest/intelligence/v2/transcript/encrypted_sentences.py index fe9acf463..250dc2548 100644 --- a/twilio/rest/intelligence/v2/transcript/encrypted_sentences.py +++ b/twilio/rest/intelligence/v2/transcript/encrypted_sentences.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class EncryptedSentencesInstance(InstanceResource): + """ :ivar location: The location of the encrypted sentences. :ivar transcript_sid: @@ -122,7 +124,6 @@ def __repr__(self) -> str: class EncryptedSentencesContext(InstanceContext): - def __init__(self, version: Version, transcript_sid: str): """ Initialize the EncryptedSentencesContext @@ -265,7 +266,6 @@ def __repr__(self) -> str: class EncryptedSentencesList(ListResource): - def __init__(self, version: Version, transcript_sid: str): """ Initialize the EncryptedSentencesList diff --git a/twilio/rest/intelligence/v2/transcript/media.py b/twilio/rest/intelligence/v2/transcript/media.py index 377ebb274..461a90ee2 100644 --- a/twilio/rest/intelligence/v2/transcript/media.py +++ b/twilio/rest/intelligence/v2/transcript/media.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class MediaInstance(InstanceResource): + """ :ivar account_sid: The unique SID identifier of the Account. :ivar media_url: Downloadable URL for media, if stored in Twilio AI. @@ -124,7 +126,6 @@ def __repr__(self) -> str: class MediaContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the MediaContext @@ -263,7 +264,6 @@ def __repr__(self) -> str: class MediaList(ListResource): - def __init__(self, version: Version, sid: str): """ Initialize the MediaList diff --git a/twilio/rest/intelligence/v2/transcript/operator_result.py b/twilio/rest/intelligence/v2/transcript/operator_result.py index d85abcaf4..3791d440b 100644 --- a/twilio/rest/intelligence/v2/transcript/operator_result.py +++ b/twilio/rest/intelligence/v2/transcript/operator_result.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values from twilio.base.api_response import ApiResponse @@ -23,7 +24,6 @@ class OperatorResultInstance(InstanceResource): - class OperatorType(object): CONVERSATION_CLASSIFY = "conversation-classify" UTTERANCE_CLASSIFY = "utterance-classify" @@ -61,9 +61,9 @@ def __init__( ): super().__init__(version) - self.operator_type: Optional["OperatorResultInstance.OperatorType"] = ( - payload.get("operator_type") - ) + self.operator_type: Optional[ + "OperatorResultInstance.OperatorType" + ] = payload.get("operator_type") self.name: Optional[str] = payload.get("name") self.operator_sid: Optional[str] = payload.get("operator_sid") self.extract_match: Optional[bool] = payload.get("extract_match") @@ -181,7 +181,6 @@ def __repr__(self) -> str: class OperatorResultContext(InstanceContext): - def __init__(self, version: Version, transcript_sid: str, operator_sid: str): """ Initialize the OperatorResultContext @@ -332,7 +331,6 @@ def __repr__(self) -> str: class OperatorResultPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> OperatorResultInstance: """ Build an instance of OperatorResultInstance @@ -353,7 +351,6 @@ def __repr__(self) -> str: class OperatorResultList(ListResource): - def __init__(self, version: Version, transcript_sid: str): """ Initialize the OperatorResultList @@ -737,10 +734,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = OperatorResultPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/intelligence/v2/transcript/sentence.py b/twilio/rest/intelligence/v2/transcript/sentence.py index 840f76731..d4a1e8706 100644 --- a/twilio/rest/intelligence/v2/transcript/sentence.py +++ b/twilio/rest/intelligence/v2/transcript/sentence.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class SentenceInstance(InstanceResource): + """ :ivar media_channel: The channel number. :ivar sentence_index: The index of the sentence in the transcript. @@ -65,7 +67,6 @@ def __repr__(self) -> str: class SentencePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SentenceInstance: """ Build an instance of SentenceInstance @@ -86,7 +87,6 @@ def __repr__(self) -> str: class SentenceList(ListResource): - def __init__(self, version: Version, transcript_sid: str): """ Initialize the SentenceList @@ -512,10 +512,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SentencePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/ip_messaging/IpMessagingBase.py b/twilio/rest/ip_messaging/IpMessagingBase.py index 752d41adc..d9e063c30 100644 --- a/twilio/rest/ip_messaging/IpMessagingBase.py +++ b/twilio/rest/ip_messaging/IpMessagingBase.py @@ -18,7 +18,6 @@ class IpMessagingBase(Domain): - def __init__(self, twilio: Client): """ Initialize the IpMessaging Domain diff --git a/twilio/rest/ip_messaging/v1/__init__.py b/twilio/rest/ip_messaging/v1/__init__.py index d1f40c791..1fd53b76b 100644 --- a/twilio/rest/ip_messaging/v1/__init__.py +++ b/twilio/rest/ip_messaging/v1/__init__.py @@ -20,7 +20,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of IpMessaging diff --git a/twilio/rest/ip_messaging/v1/credential.py b/twilio/rest/ip_messaging/v1/credential.py index 9e28a8725..4447894f1 100644 --- a/twilio/rest/ip_messaging/v1/credential.py +++ b/twilio/rest/ip_messaging/v1/credential.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class CredentialInstance(InstanceResource): - class PushService(object): GCM = "gcm" APN = "apn" @@ -282,7 +282,6 @@ def __repr__(self) -> str: class CredentialContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the CredentialContext @@ -665,7 +664,6 @@ def __repr__(self) -> str: class CredentialPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> CredentialInstance: """ Build an instance of CredentialInstance @@ -684,7 +682,6 @@ def __repr__(self) -> str: class CredentialList(ListResource): - def __init__(self, version: Version): """ Initialize the CredentialList @@ -1241,10 +1238,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CredentialPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/ip_messaging/v1/service/__init__.py b/twilio/rest/ip_messaging/v1/service/__init__.py index d010e806b..af1703405 100644 --- a/twilio/rest/ip_messaging/v1/service/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/__init__.py @@ -12,6 +12,7 @@ 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 @@ -27,6 +28,7 @@ class ServiceInstance(InstanceResource): + """ :ivar sid: :ivar account_sid: @@ -208,36 +210,52 @@ def update( webhook_filters: Union[List[str], object] = values.unset, webhooks_on_message_send_url: Union[str, object] = values.unset, webhooks_on_message_send_method: Union[str, object] = values.unset, + webhooks_on_message_send_format: Union[str, object] = values.unset, webhooks_on_message_update_url: Union[str, object] = values.unset, webhooks_on_message_update_method: Union[str, object] = values.unset, + webhooks_on_message_update_format: Union[str, object] = values.unset, webhooks_on_message_remove_url: Union[str, object] = values.unset, webhooks_on_message_remove_method: Union[str, object] = values.unset, + webhooks_on_message_remove_format: Union[str, object] = values.unset, webhooks_on_channel_add_url: Union[str, object] = values.unset, webhooks_on_channel_add_method: Union[str, object] = values.unset, + webhooks_on_channel_add_format: Union[str, object] = values.unset, webhooks_on_channel_destroy_url: Union[str, object] = values.unset, webhooks_on_channel_destroy_method: Union[str, object] = values.unset, + webhooks_on_channel_destroy_format: Union[str, object] = values.unset, webhooks_on_channel_update_url: Union[str, object] = values.unset, webhooks_on_channel_update_method: Union[str, object] = values.unset, + webhooks_on_channel_update_format: Union[str, object] = values.unset, webhooks_on_member_add_url: Union[str, object] = values.unset, webhooks_on_member_add_method: Union[str, object] = values.unset, + webhooks_on_member_add_format: Union[str, object] = values.unset, webhooks_on_member_remove_url: Union[str, object] = values.unset, webhooks_on_member_remove_method: Union[str, object] = values.unset, + webhooks_on_member_remove_format: Union[str, object] = values.unset, webhooks_on_message_sent_url: Union[str, object] = values.unset, webhooks_on_message_sent_method: Union[str, object] = values.unset, + webhooks_on_message_sent_format: Union[str, object] = values.unset, webhooks_on_message_updated_url: Union[str, object] = values.unset, webhooks_on_message_updated_method: Union[str, object] = values.unset, + webhooks_on_message_updated_format: Union[str, object] = values.unset, webhooks_on_message_removed_url: Union[str, object] = values.unset, webhooks_on_message_removed_method: Union[str, object] = values.unset, + webhooks_on_message_removed_format: Union[str, object] = values.unset, webhooks_on_channel_added_url: Union[str, object] = values.unset, webhooks_on_channel_added_method: Union[str, object] = values.unset, + webhooks_on_channel_added_format: Union[str, object] = values.unset, webhooks_on_channel_destroyed_url: Union[str, object] = values.unset, webhooks_on_channel_destroyed_method: Union[str, object] = values.unset, + webhooks_on_channel_destroyed_format: Union[str, object] = values.unset, webhooks_on_channel_updated_url: Union[str, object] = values.unset, webhooks_on_channel_updated_method: Union[str, object] = values.unset, + webhooks_on_channel_updated_format: Union[str, object] = values.unset, webhooks_on_member_added_url: Union[str, object] = values.unset, webhooks_on_member_added_method: Union[str, object] = values.unset, + webhooks_on_member_added_format: Union[str, object] = values.unset, webhooks_on_member_removed_url: Union[str, object] = values.unset, webhooks_on_member_removed_method: Union[str, object] = values.unset, + webhooks_on_member_removed_format: Union[str, object] = values.unset, limits_channel_members: Union[int, object] = values.unset, limits_user_channels: Union[int, object] = values.unset, ) -> "ServiceInstance": @@ -266,36 +284,52 @@ def update( :param webhook_filters: :param webhooks_on_message_send_url: :param webhooks_on_message_send_method: + :param webhooks_on_message_send_format: :param webhooks_on_message_update_url: :param webhooks_on_message_update_method: + :param webhooks_on_message_update_format: :param webhooks_on_message_remove_url: :param webhooks_on_message_remove_method: + :param webhooks_on_message_remove_format: :param webhooks_on_channel_add_url: :param webhooks_on_channel_add_method: + :param webhooks_on_channel_add_format: :param webhooks_on_channel_destroy_url: :param webhooks_on_channel_destroy_method: + :param webhooks_on_channel_destroy_format: :param webhooks_on_channel_update_url: :param webhooks_on_channel_update_method: + :param webhooks_on_channel_update_format: :param webhooks_on_member_add_url: :param webhooks_on_member_add_method: + :param webhooks_on_member_add_format: :param webhooks_on_member_remove_url: :param webhooks_on_member_remove_method: + :param webhooks_on_member_remove_format: :param webhooks_on_message_sent_url: :param webhooks_on_message_sent_method: + :param webhooks_on_message_sent_format: :param webhooks_on_message_updated_url: :param webhooks_on_message_updated_method: + :param webhooks_on_message_updated_format: :param webhooks_on_message_removed_url: :param webhooks_on_message_removed_method: + :param webhooks_on_message_removed_format: :param webhooks_on_channel_added_url: :param webhooks_on_channel_added_method: + :param webhooks_on_channel_added_format: :param webhooks_on_channel_destroyed_url: :param webhooks_on_channel_destroyed_method: + :param webhooks_on_channel_destroyed_format: :param webhooks_on_channel_updated_url: :param webhooks_on_channel_updated_method: + :param webhooks_on_channel_updated_format: :param webhooks_on_member_added_url: :param webhooks_on_member_added_method: + :param webhooks_on_member_added_format: :param webhooks_on_member_removed_url: :param webhooks_on_member_removed_method: + :param webhooks_on_member_removed_format: :param limits_channel_members: :param limits_user_channels: @@ -324,36 +358,52 @@ def update( webhook_filters=webhook_filters, webhooks_on_message_send_url=webhooks_on_message_send_url, webhooks_on_message_send_method=webhooks_on_message_send_method, + webhooks_on_message_send_format=webhooks_on_message_send_format, webhooks_on_message_update_url=webhooks_on_message_update_url, webhooks_on_message_update_method=webhooks_on_message_update_method, + webhooks_on_message_update_format=webhooks_on_message_update_format, webhooks_on_message_remove_url=webhooks_on_message_remove_url, webhooks_on_message_remove_method=webhooks_on_message_remove_method, + webhooks_on_message_remove_format=webhooks_on_message_remove_format, webhooks_on_channel_add_url=webhooks_on_channel_add_url, webhooks_on_channel_add_method=webhooks_on_channel_add_method, + webhooks_on_channel_add_format=webhooks_on_channel_add_format, webhooks_on_channel_destroy_url=webhooks_on_channel_destroy_url, webhooks_on_channel_destroy_method=webhooks_on_channel_destroy_method, + webhooks_on_channel_destroy_format=webhooks_on_channel_destroy_format, webhooks_on_channel_update_url=webhooks_on_channel_update_url, webhooks_on_channel_update_method=webhooks_on_channel_update_method, + webhooks_on_channel_update_format=webhooks_on_channel_update_format, webhooks_on_member_add_url=webhooks_on_member_add_url, webhooks_on_member_add_method=webhooks_on_member_add_method, + webhooks_on_member_add_format=webhooks_on_member_add_format, webhooks_on_member_remove_url=webhooks_on_member_remove_url, webhooks_on_member_remove_method=webhooks_on_member_remove_method, + webhooks_on_member_remove_format=webhooks_on_member_remove_format, webhooks_on_message_sent_url=webhooks_on_message_sent_url, webhooks_on_message_sent_method=webhooks_on_message_sent_method, + webhooks_on_message_sent_format=webhooks_on_message_sent_format, webhooks_on_message_updated_url=webhooks_on_message_updated_url, webhooks_on_message_updated_method=webhooks_on_message_updated_method, + webhooks_on_message_updated_format=webhooks_on_message_updated_format, webhooks_on_message_removed_url=webhooks_on_message_removed_url, webhooks_on_message_removed_method=webhooks_on_message_removed_method, + webhooks_on_message_removed_format=webhooks_on_message_removed_format, webhooks_on_channel_added_url=webhooks_on_channel_added_url, webhooks_on_channel_added_method=webhooks_on_channel_added_method, + webhooks_on_channel_added_format=webhooks_on_channel_added_format, webhooks_on_channel_destroyed_url=webhooks_on_channel_destroyed_url, webhooks_on_channel_destroyed_method=webhooks_on_channel_destroyed_method, + webhooks_on_channel_destroyed_format=webhooks_on_channel_destroyed_format, webhooks_on_channel_updated_url=webhooks_on_channel_updated_url, webhooks_on_channel_updated_method=webhooks_on_channel_updated_method, + webhooks_on_channel_updated_format=webhooks_on_channel_updated_format, webhooks_on_member_added_url=webhooks_on_member_added_url, webhooks_on_member_added_method=webhooks_on_member_added_method, + webhooks_on_member_added_format=webhooks_on_member_added_format, webhooks_on_member_removed_url=webhooks_on_member_removed_url, webhooks_on_member_removed_method=webhooks_on_member_removed_method, + webhooks_on_member_removed_format=webhooks_on_member_removed_format, limits_channel_members=limits_channel_members, limits_user_channels=limits_user_channels, ) @@ -382,36 +432,52 @@ async def update_async( webhook_filters: Union[List[str], object] = values.unset, webhooks_on_message_send_url: Union[str, object] = values.unset, webhooks_on_message_send_method: Union[str, object] = values.unset, + webhooks_on_message_send_format: Union[str, object] = values.unset, webhooks_on_message_update_url: Union[str, object] = values.unset, webhooks_on_message_update_method: Union[str, object] = values.unset, + webhooks_on_message_update_format: Union[str, object] = values.unset, webhooks_on_message_remove_url: Union[str, object] = values.unset, webhooks_on_message_remove_method: Union[str, object] = values.unset, + webhooks_on_message_remove_format: Union[str, object] = values.unset, webhooks_on_channel_add_url: Union[str, object] = values.unset, webhooks_on_channel_add_method: Union[str, object] = values.unset, + webhooks_on_channel_add_format: Union[str, object] = values.unset, webhooks_on_channel_destroy_url: Union[str, object] = values.unset, webhooks_on_channel_destroy_method: Union[str, object] = values.unset, + webhooks_on_channel_destroy_format: Union[str, object] = values.unset, webhooks_on_channel_update_url: Union[str, object] = values.unset, webhooks_on_channel_update_method: Union[str, object] = values.unset, + webhooks_on_channel_update_format: Union[str, object] = values.unset, webhooks_on_member_add_url: Union[str, object] = values.unset, webhooks_on_member_add_method: Union[str, object] = values.unset, + webhooks_on_member_add_format: Union[str, object] = values.unset, webhooks_on_member_remove_url: Union[str, object] = values.unset, webhooks_on_member_remove_method: Union[str, object] = values.unset, + webhooks_on_member_remove_format: Union[str, object] = values.unset, webhooks_on_message_sent_url: Union[str, object] = values.unset, webhooks_on_message_sent_method: Union[str, object] = values.unset, + webhooks_on_message_sent_format: Union[str, object] = values.unset, webhooks_on_message_updated_url: Union[str, object] = values.unset, webhooks_on_message_updated_method: Union[str, object] = values.unset, + webhooks_on_message_updated_format: Union[str, object] = values.unset, webhooks_on_message_removed_url: Union[str, object] = values.unset, webhooks_on_message_removed_method: Union[str, object] = values.unset, + webhooks_on_message_removed_format: Union[str, object] = values.unset, webhooks_on_channel_added_url: Union[str, object] = values.unset, webhooks_on_channel_added_method: Union[str, object] = values.unset, + webhooks_on_channel_added_format: Union[str, object] = values.unset, webhooks_on_channel_destroyed_url: Union[str, object] = values.unset, webhooks_on_channel_destroyed_method: Union[str, object] = values.unset, + webhooks_on_channel_destroyed_format: Union[str, object] = values.unset, webhooks_on_channel_updated_url: Union[str, object] = values.unset, webhooks_on_channel_updated_method: Union[str, object] = values.unset, + webhooks_on_channel_updated_format: Union[str, object] = values.unset, webhooks_on_member_added_url: Union[str, object] = values.unset, webhooks_on_member_added_method: Union[str, object] = values.unset, + webhooks_on_member_added_format: Union[str, object] = values.unset, webhooks_on_member_removed_url: Union[str, object] = values.unset, webhooks_on_member_removed_method: Union[str, object] = values.unset, + webhooks_on_member_removed_format: Union[str, object] = values.unset, limits_channel_members: Union[int, object] = values.unset, limits_user_channels: Union[int, object] = values.unset, ) -> "ServiceInstance": @@ -440,36 +506,52 @@ async def update_async( :param webhook_filters: :param webhooks_on_message_send_url: :param webhooks_on_message_send_method: + :param webhooks_on_message_send_format: :param webhooks_on_message_update_url: :param webhooks_on_message_update_method: + :param webhooks_on_message_update_format: :param webhooks_on_message_remove_url: :param webhooks_on_message_remove_method: + :param webhooks_on_message_remove_format: :param webhooks_on_channel_add_url: :param webhooks_on_channel_add_method: + :param webhooks_on_channel_add_format: :param webhooks_on_channel_destroy_url: :param webhooks_on_channel_destroy_method: + :param webhooks_on_channel_destroy_format: :param webhooks_on_channel_update_url: :param webhooks_on_channel_update_method: + :param webhooks_on_channel_update_format: :param webhooks_on_member_add_url: :param webhooks_on_member_add_method: + :param webhooks_on_member_add_format: :param webhooks_on_member_remove_url: :param webhooks_on_member_remove_method: + :param webhooks_on_member_remove_format: :param webhooks_on_message_sent_url: :param webhooks_on_message_sent_method: + :param webhooks_on_message_sent_format: :param webhooks_on_message_updated_url: :param webhooks_on_message_updated_method: + :param webhooks_on_message_updated_format: :param webhooks_on_message_removed_url: :param webhooks_on_message_removed_method: + :param webhooks_on_message_removed_format: :param webhooks_on_channel_added_url: :param webhooks_on_channel_added_method: + :param webhooks_on_channel_added_format: :param webhooks_on_channel_destroyed_url: :param webhooks_on_channel_destroyed_method: + :param webhooks_on_channel_destroyed_format: :param webhooks_on_channel_updated_url: :param webhooks_on_channel_updated_method: + :param webhooks_on_channel_updated_format: :param webhooks_on_member_added_url: :param webhooks_on_member_added_method: + :param webhooks_on_member_added_format: :param webhooks_on_member_removed_url: :param webhooks_on_member_removed_method: + :param webhooks_on_member_removed_format: :param limits_channel_members: :param limits_user_channels: @@ -498,36 +580,52 @@ async def update_async( webhook_filters=webhook_filters, webhooks_on_message_send_url=webhooks_on_message_send_url, webhooks_on_message_send_method=webhooks_on_message_send_method, + webhooks_on_message_send_format=webhooks_on_message_send_format, webhooks_on_message_update_url=webhooks_on_message_update_url, webhooks_on_message_update_method=webhooks_on_message_update_method, + webhooks_on_message_update_format=webhooks_on_message_update_format, webhooks_on_message_remove_url=webhooks_on_message_remove_url, webhooks_on_message_remove_method=webhooks_on_message_remove_method, + webhooks_on_message_remove_format=webhooks_on_message_remove_format, webhooks_on_channel_add_url=webhooks_on_channel_add_url, webhooks_on_channel_add_method=webhooks_on_channel_add_method, + webhooks_on_channel_add_format=webhooks_on_channel_add_format, webhooks_on_channel_destroy_url=webhooks_on_channel_destroy_url, webhooks_on_channel_destroy_method=webhooks_on_channel_destroy_method, + webhooks_on_channel_destroy_format=webhooks_on_channel_destroy_format, webhooks_on_channel_update_url=webhooks_on_channel_update_url, webhooks_on_channel_update_method=webhooks_on_channel_update_method, + webhooks_on_channel_update_format=webhooks_on_channel_update_format, webhooks_on_member_add_url=webhooks_on_member_add_url, webhooks_on_member_add_method=webhooks_on_member_add_method, + webhooks_on_member_add_format=webhooks_on_member_add_format, webhooks_on_member_remove_url=webhooks_on_member_remove_url, webhooks_on_member_remove_method=webhooks_on_member_remove_method, + webhooks_on_member_remove_format=webhooks_on_member_remove_format, webhooks_on_message_sent_url=webhooks_on_message_sent_url, webhooks_on_message_sent_method=webhooks_on_message_sent_method, + webhooks_on_message_sent_format=webhooks_on_message_sent_format, webhooks_on_message_updated_url=webhooks_on_message_updated_url, webhooks_on_message_updated_method=webhooks_on_message_updated_method, + webhooks_on_message_updated_format=webhooks_on_message_updated_format, webhooks_on_message_removed_url=webhooks_on_message_removed_url, webhooks_on_message_removed_method=webhooks_on_message_removed_method, + webhooks_on_message_removed_format=webhooks_on_message_removed_format, webhooks_on_channel_added_url=webhooks_on_channel_added_url, webhooks_on_channel_added_method=webhooks_on_channel_added_method, + webhooks_on_channel_added_format=webhooks_on_channel_added_format, webhooks_on_channel_destroyed_url=webhooks_on_channel_destroyed_url, webhooks_on_channel_destroyed_method=webhooks_on_channel_destroyed_method, + webhooks_on_channel_destroyed_format=webhooks_on_channel_destroyed_format, webhooks_on_channel_updated_url=webhooks_on_channel_updated_url, webhooks_on_channel_updated_method=webhooks_on_channel_updated_method, + webhooks_on_channel_updated_format=webhooks_on_channel_updated_format, webhooks_on_member_added_url=webhooks_on_member_added_url, webhooks_on_member_added_method=webhooks_on_member_added_method, + webhooks_on_member_added_format=webhooks_on_member_added_format, webhooks_on_member_removed_url=webhooks_on_member_removed_url, webhooks_on_member_removed_method=webhooks_on_member_removed_method, + webhooks_on_member_removed_format=webhooks_on_member_removed_format, limits_channel_members=limits_channel_members, limits_user_channels=limits_user_channels, ) @@ -556,36 +654,52 @@ def update_with_http_info( webhook_filters: Union[List[str], object] = values.unset, webhooks_on_message_send_url: Union[str, object] = values.unset, webhooks_on_message_send_method: Union[str, object] = values.unset, + webhooks_on_message_send_format: Union[str, object] = values.unset, webhooks_on_message_update_url: Union[str, object] = values.unset, webhooks_on_message_update_method: Union[str, object] = values.unset, + webhooks_on_message_update_format: Union[str, object] = values.unset, webhooks_on_message_remove_url: Union[str, object] = values.unset, webhooks_on_message_remove_method: Union[str, object] = values.unset, + webhooks_on_message_remove_format: Union[str, object] = values.unset, webhooks_on_channel_add_url: Union[str, object] = values.unset, webhooks_on_channel_add_method: Union[str, object] = values.unset, + webhooks_on_channel_add_format: Union[str, object] = values.unset, webhooks_on_channel_destroy_url: Union[str, object] = values.unset, webhooks_on_channel_destroy_method: Union[str, object] = values.unset, + webhooks_on_channel_destroy_format: Union[str, object] = values.unset, webhooks_on_channel_update_url: Union[str, object] = values.unset, webhooks_on_channel_update_method: Union[str, object] = values.unset, + webhooks_on_channel_update_format: Union[str, object] = values.unset, webhooks_on_member_add_url: Union[str, object] = values.unset, webhooks_on_member_add_method: Union[str, object] = values.unset, + webhooks_on_member_add_format: Union[str, object] = values.unset, webhooks_on_member_remove_url: Union[str, object] = values.unset, webhooks_on_member_remove_method: Union[str, object] = values.unset, + webhooks_on_member_remove_format: Union[str, object] = values.unset, webhooks_on_message_sent_url: Union[str, object] = values.unset, webhooks_on_message_sent_method: Union[str, object] = values.unset, + webhooks_on_message_sent_format: Union[str, object] = values.unset, webhooks_on_message_updated_url: Union[str, object] = values.unset, webhooks_on_message_updated_method: Union[str, object] = values.unset, + webhooks_on_message_updated_format: Union[str, object] = values.unset, webhooks_on_message_removed_url: Union[str, object] = values.unset, webhooks_on_message_removed_method: Union[str, object] = values.unset, + webhooks_on_message_removed_format: Union[str, object] = values.unset, webhooks_on_channel_added_url: Union[str, object] = values.unset, webhooks_on_channel_added_method: Union[str, object] = values.unset, + webhooks_on_channel_added_format: Union[str, object] = values.unset, webhooks_on_channel_destroyed_url: Union[str, object] = values.unset, webhooks_on_channel_destroyed_method: Union[str, object] = values.unset, + webhooks_on_channel_destroyed_format: Union[str, object] = values.unset, webhooks_on_channel_updated_url: Union[str, object] = values.unset, webhooks_on_channel_updated_method: Union[str, object] = values.unset, + webhooks_on_channel_updated_format: Union[str, object] = values.unset, webhooks_on_member_added_url: Union[str, object] = values.unset, webhooks_on_member_added_method: Union[str, object] = values.unset, + webhooks_on_member_added_format: Union[str, object] = values.unset, webhooks_on_member_removed_url: Union[str, object] = values.unset, webhooks_on_member_removed_method: Union[str, object] = values.unset, + webhooks_on_member_removed_format: Union[str, object] = values.unset, limits_channel_members: Union[int, object] = values.unset, limits_user_channels: Union[int, object] = values.unset, ) -> ApiResponse: @@ -614,36 +728,52 @@ def update_with_http_info( :param webhook_filters: :param webhooks_on_message_send_url: :param webhooks_on_message_send_method: + :param webhooks_on_message_send_format: :param webhooks_on_message_update_url: :param webhooks_on_message_update_method: + :param webhooks_on_message_update_format: :param webhooks_on_message_remove_url: :param webhooks_on_message_remove_method: + :param webhooks_on_message_remove_format: :param webhooks_on_channel_add_url: :param webhooks_on_channel_add_method: + :param webhooks_on_channel_add_format: :param webhooks_on_channel_destroy_url: :param webhooks_on_channel_destroy_method: + :param webhooks_on_channel_destroy_format: :param webhooks_on_channel_update_url: :param webhooks_on_channel_update_method: + :param webhooks_on_channel_update_format: :param webhooks_on_member_add_url: :param webhooks_on_member_add_method: + :param webhooks_on_member_add_format: :param webhooks_on_member_remove_url: :param webhooks_on_member_remove_method: + :param webhooks_on_member_remove_format: :param webhooks_on_message_sent_url: :param webhooks_on_message_sent_method: + :param webhooks_on_message_sent_format: :param webhooks_on_message_updated_url: :param webhooks_on_message_updated_method: + :param webhooks_on_message_updated_format: :param webhooks_on_message_removed_url: :param webhooks_on_message_removed_method: + :param webhooks_on_message_removed_format: :param webhooks_on_channel_added_url: :param webhooks_on_channel_added_method: + :param webhooks_on_channel_added_format: :param webhooks_on_channel_destroyed_url: :param webhooks_on_channel_destroyed_method: + :param webhooks_on_channel_destroyed_format: :param webhooks_on_channel_updated_url: :param webhooks_on_channel_updated_method: + :param webhooks_on_channel_updated_format: :param webhooks_on_member_added_url: :param webhooks_on_member_added_method: + :param webhooks_on_member_added_format: :param webhooks_on_member_removed_url: :param webhooks_on_member_removed_method: + :param webhooks_on_member_removed_format: :param limits_channel_members: :param limits_user_channels: @@ -672,36 +802,52 @@ def update_with_http_info( webhook_filters=webhook_filters, webhooks_on_message_send_url=webhooks_on_message_send_url, webhooks_on_message_send_method=webhooks_on_message_send_method, + webhooks_on_message_send_format=webhooks_on_message_send_format, webhooks_on_message_update_url=webhooks_on_message_update_url, webhooks_on_message_update_method=webhooks_on_message_update_method, + webhooks_on_message_update_format=webhooks_on_message_update_format, webhooks_on_message_remove_url=webhooks_on_message_remove_url, webhooks_on_message_remove_method=webhooks_on_message_remove_method, + webhooks_on_message_remove_format=webhooks_on_message_remove_format, webhooks_on_channel_add_url=webhooks_on_channel_add_url, webhooks_on_channel_add_method=webhooks_on_channel_add_method, + webhooks_on_channel_add_format=webhooks_on_channel_add_format, webhooks_on_channel_destroy_url=webhooks_on_channel_destroy_url, webhooks_on_channel_destroy_method=webhooks_on_channel_destroy_method, + webhooks_on_channel_destroy_format=webhooks_on_channel_destroy_format, webhooks_on_channel_update_url=webhooks_on_channel_update_url, webhooks_on_channel_update_method=webhooks_on_channel_update_method, + webhooks_on_channel_update_format=webhooks_on_channel_update_format, webhooks_on_member_add_url=webhooks_on_member_add_url, webhooks_on_member_add_method=webhooks_on_member_add_method, + webhooks_on_member_add_format=webhooks_on_member_add_format, webhooks_on_member_remove_url=webhooks_on_member_remove_url, webhooks_on_member_remove_method=webhooks_on_member_remove_method, + webhooks_on_member_remove_format=webhooks_on_member_remove_format, webhooks_on_message_sent_url=webhooks_on_message_sent_url, webhooks_on_message_sent_method=webhooks_on_message_sent_method, + webhooks_on_message_sent_format=webhooks_on_message_sent_format, webhooks_on_message_updated_url=webhooks_on_message_updated_url, webhooks_on_message_updated_method=webhooks_on_message_updated_method, + webhooks_on_message_updated_format=webhooks_on_message_updated_format, webhooks_on_message_removed_url=webhooks_on_message_removed_url, webhooks_on_message_removed_method=webhooks_on_message_removed_method, + webhooks_on_message_removed_format=webhooks_on_message_removed_format, webhooks_on_channel_added_url=webhooks_on_channel_added_url, webhooks_on_channel_added_method=webhooks_on_channel_added_method, + webhooks_on_channel_added_format=webhooks_on_channel_added_format, webhooks_on_channel_destroyed_url=webhooks_on_channel_destroyed_url, webhooks_on_channel_destroyed_method=webhooks_on_channel_destroyed_method, + webhooks_on_channel_destroyed_format=webhooks_on_channel_destroyed_format, webhooks_on_channel_updated_url=webhooks_on_channel_updated_url, webhooks_on_channel_updated_method=webhooks_on_channel_updated_method, + webhooks_on_channel_updated_format=webhooks_on_channel_updated_format, webhooks_on_member_added_url=webhooks_on_member_added_url, webhooks_on_member_added_method=webhooks_on_member_added_method, + webhooks_on_member_added_format=webhooks_on_member_added_format, webhooks_on_member_removed_url=webhooks_on_member_removed_url, webhooks_on_member_removed_method=webhooks_on_member_removed_method, + webhooks_on_member_removed_format=webhooks_on_member_removed_format, limits_channel_members=limits_channel_members, limits_user_channels=limits_user_channels, ) @@ -730,36 +876,52 @@ async def update_with_http_info_async( webhook_filters: Union[List[str], object] = values.unset, webhooks_on_message_send_url: Union[str, object] = values.unset, webhooks_on_message_send_method: Union[str, object] = values.unset, + webhooks_on_message_send_format: Union[str, object] = values.unset, webhooks_on_message_update_url: Union[str, object] = values.unset, webhooks_on_message_update_method: Union[str, object] = values.unset, + webhooks_on_message_update_format: Union[str, object] = values.unset, webhooks_on_message_remove_url: Union[str, object] = values.unset, webhooks_on_message_remove_method: Union[str, object] = values.unset, + webhooks_on_message_remove_format: Union[str, object] = values.unset, webhooks_on_channel_add_url: Union[str, object] = values.unset, webhooks_on_channel_add_method: Union[str, object] = values.unset, + webhooks_on_channel_add_format: Union[str, object] = values.unset, webhooks_on_channel_destroy_url: Union[str, object] = values.unset, webhooks_on_channel_destroy_method: Union[str, object] = values.unset, + webhooks_on_channel_destroy_format: Union[str, object] = values.unset, webhooks_on_channel_update_url: Union[str, object] = values.unset, webhooks_on_channel_update_method: Union[str, object] = values.unset, + webhooks_on_channel_update_format: Union[str, object] = values.unset, webhooks_on_member_add_url: Union[str, object] = values.unset, webhooks_on_member_add_method: Union[str, object] = values.unset, + webhooks_on_member_add_format: Union[str, object] = values.unset, webhooks_on_member_remove_url: Union[str, object] = values.unset, webhooks_on_member_remove_method: Union[str, object] = values.unset, + webhooks_on_member_remove_format: Union[str, object] = values.unset, webhooks_on_message_sent_url: Union[str, object] = values.unset, webhooks_on_message_sent_method: Union[str, object] = values.unset, + webhooks_on_message_sent_format: Union[str, object] = values.unset, webhooks_on_message_updated_url: Union[str, object] = values.unset, webhooks_on_message_updated_method: Union[str, object] = values.unset, + webhooks_on_message_updated_format: Union[str, object] = values.unset, webhooks_on_message_removed_url: Union[str, object] = values.unset, webhooks_on_message_removed_method: Union[str, object] = values.unset, + webhooks_on_message_removed_format: Union[str, object] = values.unset, webhooks_on_channel_added_url: Union[str, object] = values.unset, webhooks_on_channel_added_method: Union[str, object] = values.unset, + webhooks_on_channel_added_format: Union[str, object] = values.unset, webhooks_on_channel_destroyed_url: Union[str, object] = values.unset, webhooks_on_channel_destroyed_method: Union[str, object] = values.unset, + webhooks_on_channel_destroyed_format: Union[str, object] = values.unset, webhooks_on_channel_updated_url: Union[str, object] = values.unset, webhooks_on_channel_updated_method: Union[str, object] = values.unset, + webhooks_on_channel_updated_format: Union[str, object] = values.unset, webhooks_on_member_added_url: Union[str, object] = values.unset, webhooks_on_member_added_method: Union[str, object] = values.unset, + webhooks_on_member_added_format: Union[str, object] = values.unset, webhooks_on_member_removed_url: Union[str, object] = values.unset, webhooks_on_member_removed_method: Union[str, object] = values.unset, + webhooks_on_member_removed_format: Union[str, object] = values.unset, limits_channel_members: Union[int, object] = values.unset, limits_user_channels: Union[int, object] = values.unset, ) -> ApiResponse: @@ -788,36 +950,52 @@ async def update_with_http_info_async( :param webhook_filters: :param webhooks_on_message_send_url: :param webhooks_on_message_send_method: + :param webhooks_on_message_send_format: :param webhooks_on_message_update_url: :param webhooks_on_message_update_method: + :param webhooks_on_message_update_format: :param webhooks_on_message_remove_url: :param webhooks_on_message_remove_method: + :param webhooks_on_message_remove_format: :param webhooks_on_channel_add_url: :param webhooks_on_channel_add_method: + :param webhooks_on_channel_add_format: :param webhooks_on_channel_destroy_url: :param webhooks_on_channel_destroy_method: + :param webhooks_on_channel_destroy_format: :param webhooks_on_channel_update_url: :param webhooks_on_channel_update_method: + :param webhooks_on_channel_update_format: :param webhooks_on_member_add_url: :param webhooks_on_member_add_method: + :param webhooks_on_member_add_format: :param webhooks_on_member_remove_url: :param webhooks_on_member_remove_method: + :param webhooks_on_member_remove_format: :param webhooks_on_message_sent_url: :param webhooks_on_message_sent_method: + :param webhooks_on_message_sent_format: :param webhooks_on_message_updated_url: :param webhooks_on_message_updated_method: + :param webhooks_on_message_updated_format: :param webhooks_on_message_removed_url: :param webhooks_on_message_removed_method: + :param webhooks_on_message_removed_format: :param webhooks_on_channel_added_url: :param webhooks_on_channel_added_method: + :param webhooks_on_channel_added_format: :param webhooks_on_channel_destroyed_url: :param webhooks_on_channel_destroyed_method: + :param webhooks_on_channel_destroyed_format: :param webhooks_on_channel_updated_url: :param webhooks_on_channel_updated_method: + :param webhooks_on_channel_updated_format: :param webhooks_on_member_added_url: :param webhooks_on_member_added_method: + :param webhooks_on_member_added_format: :param webhooks_on_member_removed_url: :param webhooks_on_member_removed_method: + :param webhooks_on_member_removed_format: :param limits_channel_members: :param limits_user_channels: @@ -846,36 +1024,52 @@ async def update_with_http_info_async( webhook_filters=webhook_filters, webhooks_on_message_send_url=webhooks_on_message_send_url, webhooks_on_message_send_method=webhooks_on_message_send_method, + webhooks_on_message_send_format=webhooks_on_message_send_format, webhooks_on_message_update_url=webhooks_on_message_update_url, webhooks_on_message_update_method=webhooks_on_message_update_method, + webhooks_on_message_update_format=webhooks_on_message_update_format, webhooks_on_message_remove_url=webhooks_on_message_remove_url, webhooks_on_message_remove_method=webhooks_on_message_remove_method, + webhooks_on_message_remove_format=webhooks_on_message_remove_format, webhooks_on_channel_add_url=webhooks_on_channel_add_url, webhooks_on_channel_add_method=webhooks_on_channel_add_method, + webhooks_on_channel_add_format=webhooks_on_channel_add_format, webhooks_on_channel_destroy_url=webhooks_on_channel_destroy_url, webhooks_on_channel_destroy_method=webhooks_on_channel_destroy_method, + webhooks_on_channel_destroy_format=webhooks_on_channel_destroy_format, webhooks_on_channel_update_url=webhooks_on_channel_update_url, webhooks_on_channel_update_method=webhooks_on_channel_update_method, + webhooks_on_channel_update_format=webhooks_on_channel_update_format, webhooks_on_member_add_url=webhooks_on_member_add_url, webhooks_on_member_add_method=webhooks_on_member_add_method, + webhooks_on_member_add_format=webhooks_on_member_add_format, webhooks_on_member_remove_url=webhooks_on_member_remove_url, webhooks_on_member_remove_method=webhooks_on_member_remove_method, + webhooks_on_member_remove_format=webhooks_on_member_remove_format, webhooks_on_message_sent_url=webhooks_on_message_sent_url, webhooks_on_message_sent_method=webhooks_on_message_sent_method, + webhooks_on_message_sent_format=webhooks_on_message_sent_format, webhooks_on_message_updated_url=webhooks_on_message_updated_url, webhooks_on_message_updated_method=webhooks_on_message_updated_method, + webhooks_on_message_updated_format=webhooks_on_message_updated_format, webhooks_on_message_removed_url=webhooks_on_message_removed_url, webhooks_on_message_removed_method=webhooks_on_message_removed_method, + webhooks_on_message_removed_format=webhooks_on_message_removed_format, webhooks_on_channel_added_url=webhooks_on_channel_added_url, webhooks_on_channel_added_method=webhooks_on_channel_added_method, + webhooks_on_channel_added_format=webhooks_on_channel_added_format, webhooks_on_channel_destroyed_url=webhooks_on_channel_destroyed_url, webhooks_on_channel_destroyed_method=webhooks_on_channel_destroyed_method, + webhooks_on_channel_destroyed_format=webhooks_on_channel_destroyed_format, webhooks_on_channel_updated_url=webhooks_on_channel_updated_url, webhooks_on_channel_updated_method=webhooks_on_channel_updated_method, + webhooks_on_channel_updated_format=webhooks_on_channel_updated_format, webhooks_on_member_added_url=webhooks_on_member_added_url, webhooks_on_member_added_method=webhooks_on_member_added_method, + webhooks_on_member_added_format=webhooks_on_member_added_format, webhooks_on_member_removed_url=webhooks_on_member_removed_url, webhooks_on_member_removed_method=webhooks_on_member_removed_method, + webhooks_on_member_removed_format=webhooks_on_member_removed_format, limits_channel_members=limits_channel_members, limits_user_channels=limits_user_channels, ) @@ -912,7 +1106,6 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -1114,36 +1307,52 @@ def _update( webhook_filters: Union[List[str], object] = values.unset, webhooks_on_message_send_url: Union[str, object] = values.unset, webhooks_on_message_send_method: Union[str, object] = values.unset, + webhooks_on_message_send_format: Union[str, object] = values.unset, webhooks_on_message_update_url: Union[str, object] = values.unset, webhooks_on_message_update_method: Union[str, object] = values.unset, + webhooks_on_message_update_format: Union[str, object] = values.unset, webhooks_on_message_remove_url: Union[str, object] = values.unset, webhooks_on_message_remove_method: Union[str, object] = values.unset, + webhooks_on_message_remove_format: Union[str, object] = values.unset, webhooks_on_channel_add_url: Union[str, object] = values.unset, webhooks_on_channel_add_method: Union[str, object] = values.unset, + webhooks_on_channel_add_format: Union[str, object] = values.unset, webhooks_on_channel_destroy_url: Union[str, object] = values.unset, webhooks_on_channel_destroy_method: Union[str, object] = values.unset, + webhooks_on_channel_destroy_format: Union[str, object] = values.unset, webhooks_on_channel_update_url: Union[str, object] = values.unset, webhooks_on_channel_update_method: Union[str, object] = values.unset, + webhooks_on_channel_update_format: Union[str, object] = values.unset, webhooks_on_member_add_url: Union[str, object] = values.unset, webhooks_on_member_add_method: Union[str, object] = values.unset, + webhooks_on_member_add_format: Union[str, object] = values.unset, webhooks_on_member_remove_url: Union[str, object] = values.unset, webhooks_on_member_remove_method: Union[str, object] = values.unset, + webhooks_on_member_remove_format: Union[str, object] = values.unset, webhooks_on_message_sent_url: Union[str, object] = values.unset, webhooks_on_message_sent_method: Union[str, object] = values.unset, + webhooks_on_message_sent_format: Union[str, object] = values.unset, webhooks_on_message_updated_url: Union[str, object] = values.unset, webhooks_on_message_updated_method: Union[str, object] = values.unset, + webhooks_on_message_updated_format: Union[str, object] = values.unset, webhooks_on_message_removed_url: Union[str, object] = values.unset, webhooks_on_message_removed_method: Union[str, object] = values.unset, + webhooks_on_message_removed_format: Union[str, object] = values.unset, webhooks_on_channel_added_url: Union[str, object] = values.unset, webhooks_on_channel_added_method: Union[str, object] = values.unset, + webhooks_on_channel_added_format: Union[str, object] = values.unset, webhooks_on_channel_destroyed_url: Union[str, object] = values.unset, webhooks_on_channel_destroyed_method: Union[str, object] = values.unset, + webhooks_on_channel_destroyed_format: Union[str, object] = values.unset, webhooks_on_channel_updated_url: Union[str, object] = values.unset, webhooks_on_channel_updated_method: Union[str, object] = values.unset, + webhooks_on_channel_updated_format: Union[str, object] = values.unset, webhooks_on_member_added_url: Union[str, object] = values.unset, webhooks_on_member_added_method: Union[str, object] = values.unset, + webhooks_on_member_added_format: Union[str, object] = values.unset, webhooks_on_member_removed_url: Union[str, object] = values.unset, webhooks_on_member_removed_method: Union[str, object] = values.unset, + webhooks_on_member_removed_format: Union[str, object] = values.unset, limits_channel_members: Union[int, object] = values.unset, limits_user_channels: Union[int, object] = values.unset, ) -> tuple: @@ -1188,36 +1397,52 @@ def _update( "WebhookFilters": serialize.map(webhook_filters, lambda e: e), "Webhooks.OnMessageSend.Url": webhooks_on_message_send_url, "Webhooks.OnMessageSend.Method": webhooks_on_message_send_method, + "Webhooks.OnMessageSend.Format": webhooks_on_message_send_format, "Webhooks.OnMessageUpdate.Url": webhooks_on_message_update_url, "Webhooks.OnMessageUpdate.Method": webhooks_on_message_update_method, + "Webhooks.OnMessageUpdate.Format": webhooks_on_message_update_format, "Webhooks.OnMessageRemove.Url": webhooks_on_message_remove_url, "Webhooks.OnMessageRemove.Method": webhooks_on_message_remove_method, + "Webhooks.OnMessageRemove.Format": webhooks_on_message_remove_format, "Webhooks.OnChannelAdd.Url": webhooks_on_channel_add_url, "Webhooks.OnChannelAdd.Method": webhooks_on_channel_add_method, + "Webhooks.OnChannelAdd.Format": webhooks_on_channel_add_format, "Webhooks.OnChannelDestroy.Url": webhooks_on_channel_destroy_url, "Webhooks.OnChannelDestroy.Method": webhooks_on_channel_destroy_method, + "Webhooks.OnChannelDestroy.Format": webhooks_on_channel_destroy_format, "Webhooks.OnChannelUpdate.Url": webhooks_on_channel_update_url, "Webhooks.OnChannelUpdate.Method": webhooks_on_channel_update_method, + "Webhooks.OnChannelUpdate.Format": webhooks_on_channel_update_format, "Webhooks.OnMemberAdd.Url": webhooks_on_member_add_url, "Webhooks.OnMemberAdd.Method": webhooks_on_member_add_method, + "Webhooks.OnMemberAdd.Format": webhooks_on_member_add_format, "Webhooks.OnMemberRemove.Url": webhooks_on_member_remove_url, "Webhooks.OnMemberRemove.Method": webhooks_on_member_remove_method, + "Webhooks.OnMemberRemove.Format": webhooks_on_member_remove_format, "Webhooks.OnMessageSent.Url": webhooks_on_message_sent_url, "Webhooks.OnMessageSent.Method": webhooks_on_message_sent_method, + "Webhooks.OnMessageSent.Format": webhooks_on_message_sent_format, "Webhooks.OnMessageUpdated.Url": webhooks_on_message_updated_url, "Webhooks.OnMessageUpdated.Method": webhooks_on_message_updated_method, + "Webhooks.OnMessageUpdated.Format": webhooks_on_message_updated_format, "Webhooks.OnMessageRemoved.Url": webhooks_on_message_removed_url, "Webhooks.OnMessageRemoved.Method": webhooks_on_message_removed_method, + "Webhooks.OnMessageRemoved.Format": webhooks_on_message_removed_format, "Webhooks.OnChannelAdded.Url": webhooks_on_channel_added_url, "Webhooks.OnChannelAdded.Method": webhooks_on_channel_added_method, + "Webhooks.OnChannelAdded.Format": webhooks_on_channel_added_format, "Webhooks.OnChannelDestroyed.Url": webhooks_on_channel_destroyed_url, "Webhooks.OnChannelDestroyed.Method": webhooks_on_channel_destroyed_method, + "Webhooks.OnChannelDestroyed.Format": webhooks_on_channel_destroyed_format, "Webhooks.OnChannelUpdated.Url": webhooks_on_channel_updated_url, "Webhooks.OnChannelUpdated.Method": webhooks_on_channel_updated_method, + "Webhooks.OnChannelUpdated.Format": webhooks_on_channel_updated_format, "Webhooks.OnMemberAdded.Url": webhooks_on_member_added_url, "Webhooks.OnMemberAdded.Method": webhooks_on_member_added_method, + "Webhooks.OnMemberAdded.Format": webhooks_on_member_added_format, "Webhooks.OnMemberRemoved.Url": webhooks_on_member_removed_url, "Webhooks.OnMemberRemoved.Method": webhooks_on_member_removed_method, + "Webhooks.OnMemberRemoved.Format": webhooks_on_member_removed_format, "Limits.ChannelMembers": limits_channel_members, "Limits.UserChannels": limits_user_channels, } @@ -1256,36 +1481,52 @@ def update( webhook_filters: Union[List[str], object] = values.unset, webhooks_on_message_send_url: Union[str, object] = values.unset, webhooks_on_message_send_method: Union[str, object] = values.unset, + webhooks_on_message_send_format: Union[str, object] = values.unset, webhooks_on_message_update_url: Union[str, object] = values.unset, webhooks_on_message_update_method: Union[str, object] = values.unset, + webhooks_on_message_update_format: Union[str, object] = values.unset, webhooks_on_message_remove_url: Union[str, object] = values.unset, webhooks_on_message_remove_method: Union[str, object] = values.unset, + webhooks_on_message_remove_format: Union[str, object] = values.unset, webhooks_on_channel_add_url: Union[str, object] = values.unset, webhooks_on_channel_add_method: Union[str, object] = values.unset, + webhooks_on_channel_add_format: Union[str, object] = values.unset, webhooks_on_channel_destroy_url: Union[str, object] = values.unset, webhooks_on_channel_destroy_method: Union[str, object] = values.unset, + webhooks_on_channel_destroy_format: Union[str, object] = values.unset, webhooks_on_channel_update_url: Union[str, object] = values.unset, webhooks_on_channel_update_method: Union[str, object] = values.unset, + webhooks_on_channel_update_format: Union[str, object] = values.unset, webhooks_on_member_add_url: Union[str, object] = values.unset, webhooks_on_member_add_method: Union[str, object] = values.unset, + webhooks_on_member_add_format: Union[str, object] = values.unset, webhooks_on_member_remove_url: Union[str, object] = values.unset, webhooks_on_member_remove_method: Union[str, object] = values.unset, + webhooks_on_member_remove_format: Union[str, object] = values.unset, webhooks_on_message_sent_url: Union[str, object] = values.unset, webhooks_on_message_sent_method: Union[str, object] = values.unset, + webhooks_on_message_sent_format: Union[str, object] = values.unset, webhooks_on_message_updated_url: Union[str, object] = values.unset, webhooks_on_message_updated_method: Union[str, object] = values.unset, + webhooks_on_message_updated_format: Union[str, object] = values.unset, webhooks_on_message_removed_url: Union[str, object] = values.unset, webhooks_on_message_removed_method: Union[str, object] = values.unset, + webhooks_on_message_removed_format: Union[str, object] = values.unset, webhooks_on_channel_added_url: Union[str, object] = values.unset, webhooks_on_channel_added_method: Union[str, object] = values.unset, + webhooks_on_channel_added_format: Union[str, object] = values.unset, webhooks_on_channel_destroyed_url: Union[str, object] = values.unset, webhooks_on_channel_destroyed_method: Union[str, object] = values.unset, + webhooks_on_channel_destroyed_format: Union[str, object] = values.unset, webhooks_on_channel_updated_url: Union[str, object] = values.unset, webhooks_on_channel_updated_method: Union[str, object] = values.unset, + webhooks_on_channel_updated_format: Union[str, object] = values.unset, webhooks_on_member_added_url: Union[str, object] = values.unset, webhooks_on_member_added_method: Union[str, object] = values.unset, + webhooks_on_member_added_format: Union[str, object] = values.unset, webhooks_on_member_removed_url: Union[str, object] = values.unset, webhooks_on_member_removed_method: Union[str, object] = values.unset, + webhooks_on_member_removed_format: Union[str, object] = values.unset, limits_channel_members: Union[int, object] = values.unset, limits_user_channels: Union[int, object] = values.unset, ) -> ServiceInstance: @@ -1314,36 +1555,52 @@ def update( :param webhook_filters: :param webhooks_on_message_send_url: :param webhooks_on_message_send_method: + :param webhooks_on_message_send_format: :param webhooks_on_message_update_url: :param webhooks_on_message_update_method: + :param webhooks_on_message_update_format: :param webhooks_on_message_remove_url: :param webhooks_on_message_remove_method: + :param webhooks_on_message_remove_format: :param webhooks_on_channel_add_url: :param webhooks_on_channel_add_method: + :param webhooks_on_channel_add_format: :param webhooks_on_channel_destroy_url: :param webhooks_on_channel_destroy_method: + :param webhooks_on_channel_destroy_format: :param webhooks_on_channel_update_url: :param webhooks_on_channel_update_method: + :param webhooks_on_channel_update_format: :param webhooks_on_member_add_url: :param webhooks_on_member_add_method: + :param webhooks_on_member_add_format: :param webhooks_on_member_remove_url: :param webhooks_on_member_remove_method: + :param webhooks_on_member_remove_format: :param webhooks_on_message_sent_url: :param webhooks_on_message_sent_method: + :param webhooks_on_message_sent_format: :param webhooks_on_message_updated_url: :param webhooks_on_message_updated_method: + :param webhooks_on_message_updated_format: :param webhooks_on_message_removed_url: :param webhooks_on_message_removed_method: + :param webhooks_on_message_removed_format: :param webhooks_on_channel_added_url: :param webhooks_on_channel_added_method: + :param webhooks_on_channel_added_format: :param webhooks_on_channel_destroyed_url: :param webhooks_on_channel_destroyed_method: + :param webhooks_on_channel_destroyed_format: :param webhooks_on_channel_updated_url: :param webhooks_on_channel_updated_method: + :param webhooks_on_channel_updated_format: :param webhooks_on_member_added_url: :param webhooks_on_member_added_method: + :param webhooks_on_member_added_format: :param webhooks_on_member_removed_url: :param webhooks_on_member_removed_method: + :param webhooks_on_member_removed_format: :param limits_channel_members: :param limits_user_channels: @@ -1372,36 +1629,52 @@ def update( webhook_filters=webhook_filters, webhooks_on_message_send_url=webhooks_on_message_send_url, webhooks_on_message_send_method=webhooks_on_message_send_method, + webhooks_on_message_send_format=webhooks_on_message_send_format, webhooks_on_message_update_url=webhooks_on_message_update_url, webhooks_on_message_update_method=webhooks_on_message_update_method, + webhooks_on_message_update_format=webhooks_on_message_update_format, webhooks_on_message_remove_url=webhooks_on_message_remove_url, webhooks_on_message_remove_method=webhooks_on_message_remove_method, + webhooks_on_message_remove_format=webhooks_on_message_remove_format, webhooks_on_channel_add_url=webhooks_on_channel_add_url, webhooks_on_channel_add_method=webhooks_on_channel_add_method, + webhooks_on_channel_add_format=webhooks_on_channel_add_format, webhooks_on_channel_destroy_url=webhooks_on_channel_destroy_url, webhooks_on_channel_destroy_method=webhooks_on_channel_destroy_method, + webhooks_on_channel_destroy_format=webhooks_on_channel_destroy_format, webhooks_on_channel_update_url=webhooks_on_channel_update_url, webhooks_on_channel_update_method=webhooks_on_channel_update_method, + webhooks_on_channel_update_format=webhooks_on_channel_update_format, webhooks_on_member_add_url=webhooks_on_member_add_url, webhooks_on_member_add_method=webhooks_on_member_add_method, + webhooks_on_member_add_format=webhooks_on_member_add_format, webhooks_on_member_remove_url=webhooks_on_member_remove_url, webhooks_on_member_remove_method=webhooks_on_member_remove_method, + webhooks_on_member_remove_format=webhooks_on_member_remove_format, webhooks_on_message_sent_url=webhooks_on_message_sent_url, webhooks_on_message_sent_method=webhooks_on_message_sent_method, + webhooks_on_message_sent_format=webhooks_on_message_sent_format, webhooks_on_message_updated_url=webhooks_on_message_updated_url, webhooks_on_message_updated_method=webhooks_on_message_updated_method, + webhooks_on_message_updated_format=webhooks_on_message_updated_format, webhooks_on_message_removed_url=webhooks_on_message_removed_url, webhooks_on_message_removed_method=webhooks_on_message_removed_method, + webhooks_on_message_removed_format=webhooks_on_message_removed_format, webhooks_on_channel_added_url=webhooks_on_channel_added_url, webhooks_on_channel_added_method=webhooks_on_channel_added_method, + webhooks_on_channel_added_format=webhooks_on_channel_added_format, webhooks_on_channel_destroyed_url=webhooks_on_channel_destroyed_url, webhooks_on_channel_destroyed_method=webhooks_on_channel_destroyed_method, + webhooks_on_channel_destroyed_format=webhooks_on_channel_destroyed_format, webhooks_on_channel_updated_url=webhooks_on_channel_updated_url, webhooks_on_channel_updated_method=webhooks_on_channel_updated_method, + webhooks_on_channel_updated_format=webhooks_on_channel_updated_format, webhooks_on_member_added_url=webhooks_on_member_added_url, webhooks_on_member_added_method=webhooks_on_member_added_method, + webhooks_on_member_added_format=webhooks_on_member_added_format, webhooks_on_member_removed_url=webhooks_on_member_removed_url, webhooks_on_member_removed_method=webhooks_on_member_removed_method, + webhooks_on_member_removed_format=webhooks_on_member_removed_format, limits_channel_members=limits_channel_members, limits_user_channels=limits_user_channels, ) @@ -1431,36 +1704,52 @@ def update_with_http_info( webhook_filters: Union[List[str], object] = values.unset, webhooks_on_message_send_url: Union[str, object] = values.unset, webhooks_on_message_send_method: Union[str, object] = values.unset, + webhooks_on_message_send_format: Union[str, object] = values.unset, webhooks_on_message_update_url: Union[str, object] = values.unset, webhooks_on_message_update_method: Union[str, object] = values.unset, + webhooks_on_message_update_format: Union[str, object] = values.unset, webhooks_on_message_remove_url: Union[str, object] = values.unset, webhooks_on_message_remove_method: Union[str, object] = values.unset, + webhooks_on_message_remove_format: Union[str, object] = values.unset, webhooks_on_channel_add_url: Union[str, object] = values.unset, webhooks_on_channel_add_method: Union[str, object] = values.unset, + webhooks_on_channel_add_format: Union[str, object] = values.unset, webhooks_on_channel_destroy_url: Union[str, object] = values.unset, webhooks_on_channel_destroy_method: Union[str, object] = values.unset, + webhooks_on_channel_destroy_format: Union[str, object] = values.unset, webhooks_on_channel_update_url: Union[str, object] = values.unset, webhooks_on_channel_update_method: Union[str, object] = values.unset, + webhooks_on_channel_update_format: Union[str, object] = values.unset, webhooks_on_member_add_url: Union[str, object] = values.unset, webhooks_on_member_add_method: Union[str, object] = values.unset, + webhooks_on_member_add_format: Union[str, object] = values.unset, webhooks_on_member_remove_url: Union[str, object] = values.unset, webhooks_on_member_remove_method: Union[str, object] = values.unset, + webhooks_on_member_remove_format: Union[str, object] = values.unset, webhooks_on_message_sent_url: Union[str, object] = values.unset, webhooks_on_message_sent_method: Union[str, object] = values.unset, + webhooks_on_message_sent_format: Union[str, object] = values.unset, webhooks_on_message_updated_url: Union[str, object] = values.unset, webhooks_on_message_updated_method: Union[str, object] = values.unset, + webhooks_on_message_updated_format: Union[str, object] = values.unset, webhooks_on_message_removed_url: Union[str, object] = values.unset, webhooks_on_message_removed_method: Union[str, object] = values.unset, + webhooks_on_message_removed_format: Union[str, object] = values.unset, webhooks_on_channel_added_url: Union[str, object] = values.unset, webhooks_on_channel_added_method: Union[str, object] = values.unset, + webhooks_on_channel_added_format: Union[str, object] = values.unset, webhooks_on_channel_destroyed_url: Union[str, object] = values.unset, webhooks_on_channel_destroyed_method: Union[str, object] = values.unset, + webhooks_on_channel_destroyed_format: Union[str, object] = values.unset, webhooks_on_channel_updated_url: Union[str, object] = values.unset, webhooks_on_channel_updated_method: Union[str, object] = values.unset, + webhooks_on_channel_updated_format: Union[str, object] = values.unset, webhooks_on_member_added_url: Union[str, object] = values.unset, webhooks_on_member_added_method: Union[str, object] = values.unset, + webhooks_on_member_added_format: Union[str, object] = values.unset, webhooks_on_member_removed_url: Union[str, object] = values.unset, webhooks_on_member_removed_method: Union[str, object] = values.unset, + webhooks_on_member_removed_format: Union[str, object] = values.unset, limits_channel_members: Union[int, object] = values.unset, limits_user_channels: Union[int, object] = values.unset, ) -> ApiResponse: @@ -1489,36 +1778,52 @@ def update_with_http_info( :param webhook_filters: :param webhooks_on_message_send_url: :param webhooks_on_message_send_method: + :param webhooks_on_message_send_format: :param webhooks_on_message_update_url: :param webhooks_on_message_update_method: + :param webhooks_on_message_update_format: :param webhooks_on_message_remove_url: :param webhooks_on_message_remove_method: + :param webhooks_on_message_remove_format: :param webhooks_on_channel_add_url: :param webhooks_on_channel_add_method: + :param webhooks_on_channel_add_format: :param webhooks_on_channel_destroy_url: :param webhooks_on_channel_destroy_method: + :param webhooks_on_channel_destroy_format: :param webhooks_on_channel_update_url: :param webhooks_on_channel_update_method: + :param webhooks_on_channel_update_format: :param webhooks_on_member_add_url: :param webhooks_on_member_add_method: + :param webhooks_on_member_add_format: :param webhooks_on_member_remove_url: :param webhooks_on_member_remove_method: + :param webhooks_on_member_remove_format: :param webhooks_on_message_sent_url: :param webhooks_on_message_sent_method: + :param webhooks_on_message_sent_format: :param webhooks_on_message_updated_url: :param webhooks_on_message_updated_method: + :param webhooks_on_message_updated_format: :param webhooks_on_message_removed_url: :param webhooks_on_message_removed_method: + :param webhooks_on_message_removed_format: :param webhooks_on_channel_added_url: :param webhooks_on_channel_added_method: + :param webhooks_on_channel_added_format: :param webhooks_on_channel_destroyed_url: :param webhooks_on_channel_destroyed_method: + :param webhooks_on_channel_destroyed_format: :param webhooks_on_channel_updated_url: :param webhooks_on_channel_updated_method: + :param webhooks_on_channel_updated_format: :param webhooks_on_member_added_url: :param webhooks_on_member_added_method: + :param webhooks_on_member_added_format: :param webhooks_on_member_removed_url: :param webhooks_on_member_removed_method: + :param webhooks_on_member_removed_format: :param limits_channel_members: :param limits_user_channels: @@ -1547,36 +1852,52 @@ def update_with_http_info( webhook_filters=webhook_filters, webhooks_on_message_send_url=webhooks_on_message_send_url, webhooks_on_message_send_method=webhooks_on_message_send_method, + webhooks_on_message_send_format=webhooks_on_message_send_format, webhooks_on_message_update_url=webhooks_on_message_update_url, webhooks_on_message_update_method=webhooks_on_message_update_method, + webhooks_on_message_update_format=webhooks_on_message_update_format, webhooks_on_message_remove_url=webhooks_on_message_remove_url, webhooks_on_message_remove_method=webhooks_on_message_remove_method, + webhooks_on_message_remove_format=webhooks_on_message_remove_format, webhooks_on_channel_add_url=webhooks_on_channel_add_url, webhooks_on_channel_add_method=webhooks_on_channel_add_method, + webhooks_on_channel_add_format=webhooks_on_channel_add_format, webhooks_on_channel_destroy_url=webhooks_on_channel_destroy_url, webhooks_on_channel_destroy_method=webhooks_on_channel_destroy_method, + webhooks_on_channel_destroy_format=webhooks_on_channel_destroy_format, webhooks_on_channel_update_url=webhooks_on_channel_update_url, webhooks_on_channel_update_method=webhooks_on_channel_update_method, + webhooks_on_channel_update_format=webhooks_on_channel_update_format, webhooks_on_member_add_url=webhooks_on_member_add_url, webhooks_on_member_add_method=webhooks_on_member_add_method, + webhooks_on_member_add_format=webhooks_on_member_add_format, webhooks_on_member_remove_url=webhooks_on_member_remove_url, webhooks_on_member_remove_method=webhooks_on_member_remove_method, + webhooks_on_member_remove_format=webhooks_on_member_remove_format, webhooks_on_message_sent_url=webhooks_on_message_sent_url, webhooks_on_message_sent_method=webhooks_on_message_sent_method, + webhooks_on_message_sent_format=webhooks_on_message_sent_format, webhooks_on_message_updated_url=webhooks_on_message_updated_url, webhooks_on_message_updated_method=webhooks_on_message_updated_method, + webhooks_on_message_updated_format=webhooks_on_message_updated_format, webhooks_on_message_removed_url=webhooks_on_message_removed_url, webhooks_on_message_removed_method=webhooks_on_message_removed_method, + webhooks_on_message_removed_format=webhooks_on_message_removed_format, webhooks_on_channel_added_url=webhooks_on_channel_added_url, webhooks_on_channel_added_method=webhooks_on_channel_added_method, + webhooks_on_channel_added_format=webhooks_on_channel_added_format, webhooks_on_channel_destroyed_url=webhooks_on_channel_destroyed_url, webhooks_on_channel_destroyed_method=webhooks_on_channel_destroyed_method, + webhooks_on_channel_destroyed_format=webhooks_on_channel_destroyed_format, webhooks_on_channel_updated_url=webhooks_on_channel_updated_url, webhooks_on_channel_updated_method=webhooks_on_channel_updated_method, + webhooks_on_channel_updated_format=webhooks_on_channel_updated_format, webhooks_on_member_added_url=webhooks_on_member_added_url, webhooks_on_member_added_method=webhooks_on_member_added_method, + webhooks_on_member_added_format=webhooks_on_member_added_format, webhooks_on_member_removed_url=webhooks_on_member_removed_url, webhooks_on_member_removed_method=webhooks_on_member_removed_method, + webhooks_on_member_removed_format=webhooks_on_member_removed_format, limits_channel_members=limits_channel_members, limits_user_channels=limits_user_channels, ) @@ -1607,36 +1928,52 @@ async def _update_async( webhook_filters: Union[List[str], object] = values.unset, webhooks_on_message_send_url: Union[str, object] = values.unset, webhooks_on_message_send_method: Union[str, object] = values.unset, + webhooks_on_message_send_format: Union[str, object] = values.unset, webhooks_on_message_update_url: Union[str, object] = values.unset, webhooks_on_message_update_method: Union[str, object] = values.unset, + webhooks_on_message_update_format: Union[str, object] = values.unset, webhooks_on_message_remove_url: Union[str, object] = values.unset, webhooks_on_message_remove_method: Union[str, object] = values.unset, + webhooks_on_message_remove_format: Union[str, object] = values.unset, webhooks_on_channel_add_url: Union[str, object] = values.unset, webhooks_on_channel_add_method: Union[str, object] = values.unset, + webhooks_on_channel_add_format: Union[str, object] = values.unset, webhooks_on_channel_destroy_url: Union[str, object] = values.unset, webhooks_on_channel_destroy_method: Union[str, object] = values.unset, + webhooks_on_channel_destroy_format: Union[str, object] = values.unset, webhooks_on_channel_update_url: Union[str, object] = values.unset, webhooks_on_channel_update_method: Union[str, object] = values.unset, + webhooks_on_channel_update_format: Union[str, object] = values.unset, webhooks_on_member_add_url: Union[str, object] = values.unset, webhooks_on_member_add_method: Union[str, object] = values.unset, + webhooks_on_member_add_format: Union[str, object] = values.unset, webhooks_on_member_remove_url: Union[str, object] = values.unset, webhooks_on_member_remove_method: Union[str, object] = values.unset, + webhooks_on_member_remove_format: Union[str, object] = values.unset, webhooks_on_message_sent_url: Union[str, object] = values.unset, webhooks_on_message_sent_method: Union[str, object] = values.unset, + webhooks_on_message_sent_format: Union[str, object] = values.unset, webhooks_on_message_updated_url: Union[str, object] = values.unset, webhooks_on_message_updated_method: Union[str, object] = values.unset, + webhooks_on_message_updated_format: Union[str, object] = values.unset, webhooks_on_message_removed_url: Union[str, object] = values.unset, webhooks_on_message_removed_method: Union[str, object] = values.unset, + webhooks_on_message_removed_format: Union[str, object] = values.unset, webhooks_on_channel_added_url: Union[str, object] = values.unset, webhooks_on_channel_added_method: Union[str, object] = values.unset, + webhooks_on_channel_added_format: Union[str, object] = values.unset, webhooks_on_channel_destroyed_url: Union[str, object] = values.unset, webhooks_on_channel_destroyed_method: Union[str, object] = values.unset, + webhooks_on_channel_destroyed_format: Union[str, object] = values.unset, webhooks_on_channel_updated_url: Union[str, object] = values.unset, webhooks_on_channel_updated_method: Union[str, object] = values.unset, + webhooks_on_channel_updated_format: Union[str, object] = values.unset, webhooks_on_member_added_url: Union[str, object] = values.unset, webhooks_on_member_added_method: Union[str, object] = values.unset, + webhooks_on_member_added_format: Union[str, object] = values.unset, webhooks_on_member_removed_url: Union[str, object] = values.unset, webhooks_on_member_removed_method: Union[str, object] = values.unset, + webhooks_on_member_removed_format: Union[str, object] = values.unset, limits_channel_members: Union[int, object] = values.unset, limits_user_channels: Union[int, object] = values.unset, ) -> tuple: @@ -1681,36 +2018,52 @@ async def _update_async( "WebhookFilters": serialize.map(webhook_filters, lambda e: e), "Webhooks.OnMessageSend.Url": webhooks_on_message_send_url, "Webhooks.OnMessageSend.Method": webhooks_on_message_send_method, + "Webhooks.OnMessageSend.Format": webhooks_on_message_send_format, "Webhooks.OnMessageUpdate.Url": webhooks_on_message_update_url, "Webhooks.OnMessageUpdate.Method": webhooks_on_message_update_method, + "Webhooks.OnMessageUpdate.Format": webhooks_on_message_update_format, "Webhooks.OnMessageRemove.Url": webhooks_on_message_remove_url, "Webhooks.OnMessageRemove.Method": webhooks_on_message_remove_method, + "Webhooks.OnMessageRemove.Format": webhooks_on_message_remove_format, "Webhooks.OnChannelAdd.Url": webhooks_on_channel_add_url, "Webhooks.OnChannelAdd.Method": webhooks_on_channel_add_method, + "Webhooks.OnChannelAdd.Format": webhooks_on_channel_add_format, "Webhooks.OnChannelDestroy.Url": webhooks_on_channel_destroy_url, "Webhooks.OnChannelDestroy.Method": webhooks_on_channel_destroy_method, + "Webhooks.OnChannelDestroy.Format": webhooks_on_channel_destroy_format, "Webhooks.OnChannelUpdate.Url": webhooks_on_channel_update_url, "Webhooks.OnChannelUpdate.Method": webhooks_on_channel_update_method, + "Webhooks.OnChannelUpdate.Format": webhooks_on_channel_update_format, "Webhooks.OnMemberAdd.Url": webhooks_on_member_add_url, "Webhooks.OnMemberAdd.Method": webhooks_on_member_add_method, + "Webhooks.OnMemberAdd.Format": webhooks_on_member_add_format, "Webhooks.OnMemberRemove.Url": webhooks_on_member_remove_url, "Webhooks.OnMemberRemove.Method": webhooks_on_member_remove_method, + "Webhooks.OnMemberRemove.Format": webhooks_on_member_remove_format, "Webhooks.OnMessageSent.Url": webhooks_on_message_sent_url, "Webhooks.OnMessageSent.Method": webhooks_on_message_sent_method, + "Webhooks.OnMessageSent.Format": webhooks_on_message_sent_format, "Webhooks.OnMessageUpdated.Url": webhooks_on_message_updated_url, "Webhooks.OnMessageUpdated.Method": webhooks_on_message_updated_method, + "Webhooks.OnMessageUpdated.Format": webhooks_on_message_updated_format, "Webhooks.OnMessageRemoved.Url": webhooks_on_message_removed_url, "Webhooks.OnMessageRemoved.Method": webhooks_on_message_removed_method, + "Webhooks.OnMessageRemoved.Format": webhooks_on_message_removed_format, "Webhooks.OnChannelAdded.Url": webhooks_on_channel_added_url, "Webhooks.OnChannelAdded.Method": webhooks_on_channel_added_method, + "Webhooks.OnChannelAdded.Format": webhooks_on_channel_added_format, "Webhooks.OnChannelDestroyed.Url": webhooks_on_channel_destroyed_url, "Webhooks.OnChannelDestroyed.Method": webhooks_on_channel_destroyed_method, + "Webhooks.OnChannelDestroyed.Format": webhooks_on_channel_destroyed_format, "Webhooks.OnChannelUpdated.Url": webhooks_on_channel_updated_url, "Webhooks.OnChannelUpdated.Method": webhooks_on_channel_updated_method, + "Webhooks.OnChannelUpdated.Format": webhooks_on_channel_updated_format, "Webhooks.OnMemberAdded.Url": webhooks_on_member_added_url, "Webhooks.OnMemberAdded.Method": webhooks_on_member_added_method, + "Webhooks.OnMemberAdded.Format": webhooks_on_member_added_format, "Webhooks.OnMemberRemoved.Url": webhooks_on_member_removed_url, "Webhooks.OnMemberRemoved.Method": webhooks_on_member_removed_method, + "Webhooks.OnMemberRemoved.Format": webhooks_on_member_removed_format, "Limits.ChannelMembers": limits_channel_members, "Limits.UserChannels": limits_user_channels, } @@ -1749,36 +2102,52 @@ async def update_async( webhook_filters: Union[List[str], object] = values.unset, webhooks_on_message_send_url: Union[str, object] = values.unset, webhooks_on_message_send_method: Union[str, object] = values.unset, + webhooks_on_message_send_format: Union[str, object] = values.unset, webhooks_on_message_update_url: Union[str, object] = values.unset, webhooks_on_message_update_method: Union[str, object] = values.unset, + webhooks_on_message_update_format: Union[str, object] = values.unset, webhooks_on_message_remove_url: Union[str, object] = values.unset, webhooks_on_message_remove_method: Union[str, object] = values.unset, + webhooks_on_message_remove_format: Union[str, object] = values.unset, webhooks_on_channel_add_url: Union[str, object] = values.unset, webhooks_on_channel_add_method: Union[str, object] = values.unset, + webhooks_on_channel_add_format: Union[str, object] = values.unset, webhooks_on_channel_destroy_url: Union[str, object] = values.unset, webhooks_on_channel_destroy_method: Union[str, object] = values.unset, + webhooks_on_channel_destroy_format: Union[str, object] = values.unset, webhooks_on_channel_update_url: Union[str, object] = values.unset, webhooks_on_channel_update_method: Union[str, object] = values.unset, + webhooks_on_channel_update_format: Union[str, object] = values.unset, webhooks_on_member_add_url: Union[str, object] = values.unset, webhooks_on_member_add_method: Union[str, object] = values.unset, + webhooks_on_member_add_format: Union[str, object] = values.unset, webhooks_on_member_remove_url: Union[str, object] = values.unset, webhooks_on_member_remove_method: Union[str, object] = values.unset, + webhooks_on_member_remove_format: Union[str, object] = values.unset, webhooks_on_message_sent_url: Union[str, object] = values.unset, webhooks_on_message_sent_method: Union[str, object] = values.unset, + webhooks_on_message_sent_format: Union[str, object] = values.unset, webhooks_on_message_updated_url: Union[str, object] = values.unset, webhooks_on_message_updated_method: Union[str, object] = values.unset, + webhooks_on_message_updated_format: Union[str, object] = values.unset, webhooks_on_message_removed_url: Union[str, object] = values.unset, webhooks_on_message_removed_method: Union[str, object] = values.unset, + webhooks_on_message_removed_format: Union[str, object] = values.unset, webhooks_on_channel_added_url: Union[str, object] = values.unset, webhooks_on_channel_added_method: Union[str, object] = values.unset, + webhooks_on_channel_added_format: Union[str, object] = values.unset, webhooks_on_channel_destroyed_url: Union[str, object] = values.unset, webhooks_on_channel_destroyed_method: Union[str, object] = values.unset, + webhooks_on_channel_destroyed_format: Union[str, object] = values.unset, webhooks_on_channel_updated_url: Union[str, object] = values.unset, webhooks_on_channel_updated_method: Union[str, object] = values.unset, + webhooks_on_channel_updated_format: Union[str, object] = values.unset, webhooks_on_member_added_url: Union[str, object] = values.unset, webhooks_on_member_added_method: Union[str, object] = values.unset, + webhooks_on_member_added_format: Union[str, object] = values.unset, webhooks_on_member_removed_url: Union[str, object] = values.unset, webhooks_on_member_removed_method: Union[str, object] = values.unset, + webhooks_on_member_removed_format: Union[str, object] = values.unset, limits_channel_members: Union[int, object] = values.unset, limits_user_channels: Union[int, object] = values.unset, ) -> ServiceInstance: @@ -1807,36 +2176,52 @@ async def update_async( :param webhook_filters: :param webhooks_on_message_send_url: :param webhooks_on_message_send_method: + :param webhooks_on_message_send_format: :param webhooks_on_message_update_url: :param webhooks_on_message_update_method: + :param webhooks_on_message_update_format: :param webhooks_on_message_remove_url: :param webhooks_on_message_remove_method: + :param webhooks_on_message_remove_format: :param webhooks_on_channel_add_url: :param webhooks_on_channel_add_method: + :param webhooks_on_channel_add_format: :param webhooks_on_channel_destroy_url: :param webhooks_on_channel_destroy_method: + :param webhooks_on_channel_destroy_format: :param webhooks_on_channel_update_url: :param webhooks_on_channel_update_method: + :param webhooks_on_channel_update_format: :param webhooks_on_member_add_url: :param webhooks_on_member_add_method: + :param webhooks_on_member_add_format: :param webhooks_on_member_remove_url: :param webhooks_on_member_remove_method: + :param webhooks_on_member_remove_format: :param webhooks_on_message_sent_url: :param webhooks_on_message_sent_method: + :param webhooks_on_message_sent_format: :param webhooks_on_message_updated_url: :param webhooks_on_message_updated_method: + :param webhooks_on_message_updated_format: :param webhooks_on_message_removed_url: :param webhooks_on_message_removed_method: + :param webhooks_on_message_removed_format: :param webhooks_on_channel_added_url: :param webhooks_on_channel_added_method: + :param webhooks_on_channel_added_format: :param webhooks_on_channel_destroyed_url: :param webhooks_on_channel_destroyed_method: + :param webhooks_on_channel_destroyed_format: :param webhooks_on_channel_updated_url: :param webhooks_on_channel_updated_method: + :param webhooks_on_channel_updated_format: :param webhooks_on_member_added_url: :param webhooks_on_member_added_method: + :param webhooks_on_member_added_format: :param webhooks_on_member_removed_url: :param webhooks_on_member_removed_method: + :param webhooks_on_member_removed_format: :param limits_channel_members: :param limits_user_channels: @@ -1865,36 +2250,52 @@ async def update_async( webhook_filters=webhook_filters, webhooks_on_message_send_url=webhooks_on_message_send_url, webhooks_on_message_send_method=webhooks_on_message_send_method, + webhooks_on_message_send_format=webhooks_on_message_send_format, webhooks_on_message_update_url=webhooks_on_message_update_url, webhooks_on_message_update_method=webhooks_on_message_update_method, + webhooks_on_message_update_format=webhooks_on_message_update_format, webhooks_on_message_remove_url=webhooks_on_message_remove_url, webhooks_on_message_remove_method=webhooks_on_message_remove_method, + webhooks_on_message_remove_format=webhooks_on_message_remove_format, webhooks_on_channel_add_url=webhooks_on_channel_add_url, webhooks_on_channel_add_method=webhooks_on_channel_add_method, + webhooks_on_channel_add_format=webhooks_on_channel_add_format, webhooks_on_channel_destroy_url=webhooks_on_channel_destroy_url, webhooks_on_channel_destroy_method=webhooks_on_channel_destroy_method, + webhooks_on_channel_destroy_format=webhooks_on_channel_destroy_format, webhooks_on_channel_update_url=webhooks_on_channel_update_url, webhooks_on_channel_update_method=webhooks_on_channel_update_method, + webhooks_on_channel_update_format=webhooks_on_channel_update_format, webhooks_on_member_add_url=webhooks_on_member_add_url, webhooks_on_member_add_method=webhooks_on_member_add_method, + webhooks_on_member_add_format=webhooks_on_member_add_format, webhooks_on_member_remove_url=webhooks_on_member_remove_url, webhooks_on_member_remove_method=webhooks_on_member_remove_method, + webhooks_on_member_remove_format=webhooks_on_member_remove_format, webhooks_on_message_sent_url=webhooks_on_message_sent_url, webhooks_on_message_sent_method=webhooks_on_message_sent_method, + webhooks_on_message_sent_format=webhooks_on_message_sent_format, webhooks_on_message_updated_url=webhooks_on_message_updated_url, webhooks_on_message_updated_method=webhooks_on_message_updated_method, + webhooks_on_message_updated_format=webhooks_on_message_updated_format, webhooks_on_message_removed_url=webhooks_on_message_removed_url, webhooks_on_message_removed_method=webhooks_on_message_removed_method, + webhooks_on_message_removed_format=webhooks_on_message_removed_format, webhooks_on_channel_added_url=webhooks_on_channel_added_url, webhooks_on_channel_added_method=webhooks_on_channel_added_method, + webhooks_on_channel_added_format=webhooks_on_channel_added_format, webhooks_on_channel_destroyed_url=webhooks_on_channel_destroyed_url, webhooks_on_channel_destroyed_method=webhooks_on_channel_destroyed_method, + webhooks_on_channel_destroyed_format=webhooks_on_channel_destroyed_format, webhooks_on_channel_updated_url=webhooks_on_channel_updated_url, webhooks_on_channel_updated_method=webhooks_on_channel_updated_method, + webhooks_on_channel_updated_format=webhooks_on_channel_updated_format, webhooks_on_member_added_url=webhooks_on_member_added_url, webhooks_on_member_added_method=webhooks_on_member_added_method, + webhooks_on_member_added_format=webhooks_on_member_added_format, webhooks_on_member_removed_url=webhooks_on_member_removed_url, webhooks_on_member_removed_method=webhooks_on_member_removed_method, + webhooks_on_member_removed_format=webhooks_on_member_removed_format, limits_channel_members=limits_channel_members, limits_user_channels=limits_user_channels, ) @@ -1924,36 +2325,52 @@ async def update_with_http_info_async( webhook_filters: Union[List[str], object] = values.unset, webhooks_on_message_send_url: Union[str, object] = values.unset, webhooks_on_message_send_method: Union[str, object] = values.unset, + webhooks_on_message_send_format: Union[str, object] = values.unset, webhooks_on_message_update_url: Union[str, object] = values.unset, webhooks_on_message_update_method: Union[str, object] = values.unset, + webhooks_on_message_update_format: Union[str, object] = values.unset, webhooks_on_message_remove_url: Union[str, object] = values.unset, webhooks_on_message_remove_method: Union[str, object] = values.unset, + webhooks_on_message_remove_format: Union[str, object] = values.unset, webhooks_on_channel_add_url: Union[str, object] = values.unset, webhooks_on_channel_add_method: Union[str, object] = values.unset, + webhooks_on_channel_add_format: Union[str, object] = values.unset, webhooks_on_channel_destroy_url: Union[str, object] = values.unset, webhooks_on_channel_destroy_method: Union[str, object] = values.unset, + webhooks_on_channel_destroy_format: Union[str, object] = values.unset, webhooks_on_channel_update_url: Union[str, object] = values.unset, webhooks_on_channel_update_method: Union[str, object] = values.unset, + webhooks_on_channel_update_format: Union[str, object] = values.unset, webhooks_on_member_add_url: Union[str, object] = values.unset, webhooks_on_member_add_method: Union[str, object] = values.unset, + webhooks_on_member_add_format: Union[str, object] = values.unset, webhooks_on_member_remove_url: Union[str, object] = values.unset, webhooks_on_member_remove_method: Union[str, object] = values.unset, + webhooks_on_member_remove_format: Union[str, object] = values.unset, webhooks_on_message_sent_url: Union[str, object] = values.unset, webhooks_on_message_sent_method: Union[str, object] = values.unset, + webhooks_on_message_sent_format: Union[str, object] = values.unset, webhooks_on_message_updated_url: Union[str, object] = values.unset, webhooks_on_message_updated_method: Union[str, object] = values.unset, + webhooks_on_message_updated_format: Union[str, object] = values.unset, webhooks_on_message_removed_url: Union[str, object] = values.unset, webhooks_on_message_removed_method: Union[str, object] = values.unset, + webhooks_on_message_removed_format: Union[str, object] = values.unset, webhooks_on_channel_added_url: Union[str, object] = values.unset, webhooks_on_channel_added_method: Union[str, object] = values.unset, + webhooks_on_channel_added_format: Union[str, object] = values.unset, webhooks_on_channel_destroyed_url: Union[str, object] = values.unset, webhooks_on_channel_destroyed_method: Union[str, object] = values.unset, + webhooks_on_channel_destroyed_format: Union[str, object] = values.unset, webhooks_on_channel_updated_url: Union[str, object] = values.unset, webhooks_on_channel_updated_method: Union[str, object] = values.unset, + webhooks_on_channel_updated_format: Union[str, object] = values.unset, webhooks_on_member_added_url: Union[str, object] = values.unset, webhooks_on_member_added_method: Union[str, object] = values.unset, + webhooks_on_member_added_format: Union[str, object] = values.unset, webhooks_on_member_removed_url: Union[str, object] = values.unset, webhooks_on_member_removed_method: Union[str, object] = values.unset, + webhooks_on_member_removed_format: Union[str, object] = values.unset, limits_channel_members: Union[int, object] = values.unset, limits_user_channels: Union[int, object] = values.unset, ) -> ApiResponse: @@ -1982,36 +2399,52 @@ async def update_with_http_info_async( :param webhook_filters: :param webhooks_on_message_send_url: :param webhooks_on_message_send_method: + :param webhooks_on_message_send_format: :param webhooks_on_message_update_url: :param webhooks_on_message_update_method: + :param webhooks_on_message_update_format: :param webhooks_on_message_remove_url: :param webhooks_on_message_remove_method: + :param webhooks_on_message_remove_format: :param webhooks_on_channel_add_url: :param webhooks_on_channel_add_method: + :param webhooks_on_channel_add_format: :param webhooks_on_channel_destroy_url: :param webhooks_on_channel_destroy_method: + :param webhooks_on_channel_destroy_format: :param webhooks_on_channel_update_url: :param webhooks_on_channel_update_method: + :param webhooks_on_channel_update_format: :param webhooks_on_member_add_url: :param webhooks_on_member_add_method: + :param webhooks_on_member_add_format: :param webhooks_on_member_remove_url: :param webhooks_on_member_remove_method: + :param webhooks_on_member_remove_format: :param webhooks_on_message_sent_url: :param webhooks_on_message_sent_method: + :param webhooks_on_message_sent_format: :param webhooks_on_message_updated_url: :param webhooks_on_message_updated_method: + :param webhooks_on_message_updated_format: :param webhooks_on_message_removed_url: :param webhooks_on_message_removed_method: + :param webhooks_on_message_removed_format: :param webhooks_on_channel_added_url: :param webhooks_on_channel_added_method: + :param webhooks_on_channel_added_format: :param webhooks_on_channel_destroyed_url: :param webhooks_on_channel_destroyed_method: + :param webhooks_on_channel_destroyed_format: :param webhooks_on_channel_updated_url: :param webhooks_on_channel_updated_method: + :param webhooks_on_channel_updated_format: :param webhooks_on_member_added_url: :param webhooks_on_member_added_method: + :param webhooks_on_member_added_format: :param webhooks_on_member_removed_url: :param webhooks_on_member_removed_method: + :param webhooks_on_member_removed_format: :param limits_channel_members: :param limits_user_channels: @@ -2040,36 +2473,52 @@ async def update_with_http_info_async( webhook_filters=webhook_filters, webhooks_on_message_send_url=webhooks_on_message_send_url, webhooks_on_message_send_method=webhooks_on_message_send_method, + webhooks_on_message_send_format=webhooks_on_message_send_format, webhooks_on_message_update_url=webhooks_on_message_update_url, webhooks_on_message_update_method=webhooks_on_message_update_method, + webhooks_on_message_update_format=webhooks_on_message_update_format, webhooks_on_message_remove_url=webhooks_on_message_remove_url, webhooks_on_message_remove_method=webhooks_on_message_remove_method, + webhooks_on_message_remove_format=webhooks_on_message_remove_format, webhooks_on_channel_add_url=webhooks_on_channel_add_url, webhooks_on_channel_add_method=webhooks_on_channel_add_method, + webhooks_on_channel_add_format=webhooks_on_channel_add_format, webhooks_on_channel_destroy_url=webhooks_on_channel_destroy_url, webhooks_on_channel_destroy_method=webhooks_on_channel_destroy_method, + webhooks_on_channel_destroy_format=webhooks_on_channel_destroy_format, webhooks_on_channel_update_url=webhooks_on_channel_update_url, webhooks_on_channel_update_method=webhooks_on_channel_update_method, + webhooks_on_channel_update_format=webhooks_on_channel_update_format, webhooks_on_member_add_url=webhooks_on_member_add_url, webhooks_on_member_add_method=webhooks_on_member_add_method, + webhooks_on_member_add_format=webhooks_on_member_add_format, webhooks_on_member_remove_url=webhooks_on_member_remove_url, webhooks_on_member_remove_method=webhooks_on_member_remove_method, + webhooks_on_member_remove_format=webhooks_on_member_remove_format, webhooks_on_message_sent_url=webhooks_on_message_sent_url, webhooks_on_message_sent_method=webhooks_on_message_sent_method, + webhooks_on_message_sent_format=webhooks_on_message_sent_format, webhooks_on_message_updated_url=webhooks_on_message_updated_url, webhooks_on_message_updated_method=webhooks_on_message_updated_method, + webhooks_on_message_updated_format=webhooks_on_message_updated_format, webhooks_on_message_removed_url=webhooks_on_message_removed_url, webhooks_on_message_removed_method=webhooks_on_message_removed_method, + webhooks_on_message_removed_format=webhooks_on_message_removed_format, webhooks_on_channel_added_url=webhooks_on_channel_added_url, webhooks_on_channel_added_method=webhooks_on_channel_added_method, + webhooks_on_channel_added_format=webhooks_on_channel_added_format, webhooks_on_channel_destroyed_url=webhooks_on_channel_destroyed_url, webhooks_on_channel_destroyed_method=webhooks_on_channel_destroyed_method, + webhooks_on_channel_destroyed_format=webhooks_on_channel_destroyed_format, webhooks_on_channel_updated_url=webhooks_on_channel_updated_url, webhooks_on_channel_updated_method=webhooks_on_channel_updated_method, + webhooks_on_channel_updated_format=webhooks_on_channel_updated_format, webhooks_on_member_added_url=webhooks_on_member_added_url, webhooks_on_member_added_method=webhooks_on_member_added_method, + webhooks_on_member_added_format=webhooks_on_member_added_format, webhooks_on_member_removed_url=webhooks_on_member_removed_url, webhooks_on_member_removed_method=webhooks_on_member_removed_method, + webhooks_on_member_removed_format=webhooks_on_member_removed_format, limits_channel_members=limits_channel_members, limits_user_channels=limits_user_channels, ) @@ -2123,7 +2572,6 @@ def __repr__(self) -> str: class ServicePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -2142,7 +2590,6 @@ def __repr__(self) -> str: class ServiceList(ListResource): - def __init__(self, version: Version): """ Initialize the ServiceList @@ -2579,10 +3026,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ServicePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/ip_messaging/v1/service/channel/__init__.py b/twilio/rest/ip_messaging/v1/service/channel/__init__.py index f265e03c9..9e45e13a1 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/channel/__init__.py @@ -12,6 +12,7 @@ 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 @@ -27,7 +28,6 @@ class ChannelInstance(InstanceResource): - class ChannelType(object): PUBLIC = "public" PRIVATE = "private" @@ -291,7 +291,6 @@ def __repr__(self) -> str: class ChannelContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the ChannelContext @@ -687,7 +686,6 @@ def __repr__(self) -> str: class ChannelPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ChannelInstance: """ Build an instance of ChannelInstance @@ -708,7 +706,6 @@ def __repr__(self) -> str: class ChannelList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the ChannelList @@ -1264,10 +1261,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ChannelPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/ip_messaging/v1/service/channel/invite.py b/twilio/rest/ip_messaging/v1/service/channel/invite.py index c1bd17083..d5236c69f 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/invite.py +++ b/twilio/rest/ip_messaging/v1/service/channel/invite.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class InviteInstance(InstanceResource): + """ :ivar sid: :ivar account_sid: @@ -169,7 +171,6 @@ def __repr__(self) -> str: class InviteContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the InviteContext @@ -370,7 +371,6 @@ def __repr__(self) -> str: class InvitePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> InviteInstance: """ Build an instance of InviteInstance @@ -394,7 +394,6 @@ def __repr__(self) -> str: class InviteList(ListResource): - def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the InviteList @@ -914,10 +913,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = InvitePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/ip_messaging/v1/service/channel/member.py b/twilio/rest/ip_messaging/v1/service/channel/member.py index 8378eaf46..b4f8827de 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/member.py +++ b/twilio/rest/ip_messaging/v1/service/channel/member.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class MemberInstance(InstanceResource): + """ :ivar sid: :ivar account_sid: @@ -63,9 +65,9 @@ def __init__( self.last_consumed_message_index: Optional[int] = deserialize.integer( payload.get("last_consumed_message_index") ) - self.last_consumption_timestamp: Optional[datetime] = ( - deserialize.iso8601_datetime(payload.get("last_consumption_timestamp")) - ) + self.last_consumption_timestamp: Optional[ + datetime + ] = deserialize.iso8601_datetime(payload.get("last_consumption_timestamp")) self.url: Optional[str] = payload.get("url") self._solution = { @@ -247,7 +249,6 @@ def __repr__(self) -> str: class MemberContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the MemberContext @@ -602,7 +603,6 @@ def __repr__(self) -> str: class MemberPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> MemberInstance: """ Build an instance of MemberInstance @@ -626,7 +626,6 @@ def __repr__(self) -> str: class MemberList(ListResource): - def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the MemberList @@ -1146,10 +1145,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = MemberPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/ip_messaging/v1/service/channel/message.py b/twilio/rest/ip_messaging/v1/service/channel/message.py index ec54a4270..643525986 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/message.py +++ b/twilio/rest/ip_messaging/v1/service/channel/message.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class MessageInstance(InstanceResource): - class OrderType(object): ASC = "asc" DESC = "desc" @@ -252,7 +252,6 @@ def __repr__(self) -> str: class MessageContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the MessageContext @@ -601,7 +600,6 @@ def __repr__(self) -> str: class MessagePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> MessageInstance: """ Build an instance of MessageInstance @@ -625,7 +623,6 @@ def __repr__(self) -> str: class MessageList(ListResource): - def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the MessageList @@ -1171,10 +1168,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = MessagePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/ip_messaging/v1/service/role.py b/twilio/rest/ip_messaging/v1/service/role.py index aa0767e9f..113160c9c 100644 --- a/twilio/rest/ip_messaging/v1/service/role.py +++ b/twilio/rest/ip_messaging/v1/service/role.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class RoleInstance(InstanceResource): - class RoleType(object): CHANNEL = "channel" DEPLOYMENT = "deployment" @@ -217,7 +217,6 @@ def __repr__(self) -> str: class RoleContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the RoleContext @@ -520,7 +519,6 @@ def __repr__(self) -> str: class RolePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> RoleInstance: """ Build an instance of RoleInstance @@ -541,7 +539,6 @@ def __repr__(self) -> str: class RoleList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the RoleList @@ -1021,10 +1018,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = RolePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/ip_messaging/v1/service/user/__init__.py b/twilio/rest/ip_messaging/v1/service/user/__init__.py index e9d87b18e..368aa2e66 100644 --- a/twilio/rest/ip_messaging/v1/service/user/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/user/__init__.py @@ -12,6 +12,7 @@ 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 @@ -25,6 +26,7 @@ class UserInstance(InstanceResource): + """ :ivar sid: :ivar account_sid: @@ -268,7 +270,6 @@ def __repr__(self) -> str: class UserContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the UserContext @@ -636,7 +637,6 @@ def __repr__(self) -> str: class UserPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> UserInstance: """ Build an instance of UserInstance @@ -657,7 +657,6 @@ def __repr__(self) -> str: class UserList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the UserList @@ -1179,10 +1178,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = UserPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/ip_messaging/v1/service/user/user_channel.py b/twilio/rest/ip_messaging/v1/service/user/user_channel.py index d4d219152..a001932d5 100644 --- a/twilio/rest/ip_messaging/v1/service/user/user_channel.py +++ b/twilio/rest/ip_messaging/v1/service/user/user_channel.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, values from twilio.base.api_response import ApiResponse @@ -23,7 +24,6 @@ class UserChannelInstance(InstanceResource): - class ChannelStatus(object): JOINED = "joined" INVITED = "invited" @@ -76,7 +76,6 @@ def __repr__(self) -> str: class UserChannelPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> UserChannelInstance: """ Build an instance of UserChannelInstance @@ -100,7 +99,6 @@ def __repr__(self) -> str: class UserChannelList(ListResource): - def __init__(self, version: Version, service_sid: str, user_sid: str): """ Initialize the UserChannelList @@ -452,10 +450,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = UserChannelPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/ip_messaging/v2/__init__.py b/twilio/rest/ip_messaging/v2/__init__.py index 6003c86b1..966a35a44 100644 --- a/twilio/rest/ip_messaging/v2/__init__.py +++ b/twilio/rest/ip_messaging/v2/__init__.py @@ -20,7 +20,6 @@ class V2(Version): - def __init__(self, domain: Domain): """ Initialize the V2 version of IpMessaging diff --git a/twilio/rest/ip_messaging/v2/credential.py b/twilio/rest/ip_messaging/v2/credential.py index eace9238a..9177af288 100644 --- a/twilio/rest/ip_messaging/v2/credential.py +++ b/twilio/rest/ip_messaging/v2/credential.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class CredentialInstance(InstanceResource): - class PushService(object): GCM = "gcm" APN = "apn" @@ -282,7 +282,6 @@ def __repr__(self) -> str: class CredentialContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the CredentialContext @@ -665,7 +664,6 @@ def __repr__(self) -> str: class CredentialPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> CredentialInstance: """ Build an instance of CredentialInstance @@ -684,7 +682,6 @@ def __repr__(self) -> str: class CredentialList(ListResource): - def __init__(self, version: Version): """ Initialize the CredentialList @@ -1241,10 +1238,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CredentialPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/ip_messaging/v2/service/__init__.py b/twilio/rest/ip_messaging/v2/service/__init__.py index ec6818bc2..84b0c0d61 100644 --- a/twilio/rest/ip_messaging/v2/service/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/__init__.py @@ -12,6 +12,7 @@ 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 @@ -28,6 +29,7 @@ class ServiceInstance(InstanceResource): + """ :ivar sid: :ivar account_sid: @@ -660,7 +662,6 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -1536,7 +1537,6 @@ def __repr__(self) -> str: class ServicePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -1555,7 +1555,6 @@ def __repr__(self) -> str: class ServiceList(ListResource): - def __init__(self, version: Version): """ Initialize the ServiceList @@ -1992,10 +1991,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ServicePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/ip_messaging/v2/service/binding.py b/twilio/rest/ip_messaging/v2/service/binding.py index 60aea1d33..870de26dc 100644 --- a/twilio/rest/ip_messaging/v2/service/binding.py +++ b/twilio/rest/ip_messaging/v2/service/binding.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class BindingInstance(InstanceResource): - class BindingType(object): GCM = "gcm" APN = "apn" @@ -178,7 +178,6 @@ def __repr__(self) -> str: class BindingContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the BindingContext @@ -369,7 +368,6 @@ def __repr__(self) -> str: class BindingPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> BindingInstance: """ Build an instance of BindingInstance @@ -390,7 +388,6 @@ def __repr__(self) -> str: class BindingList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the BindingList @@ -808,10 +805,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = BindingPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/ip_messaging/v2/service/channel/__init__.py b/twilio/rest/ip_messaging/v2/service/channel/__init__.py index ee7ec8128..69ebc2ef5 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/channel/__init__.py @@ -12,6 +12,7 @@ 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 @@ -28,7 +29,6 @@ class ChannelInstance(InstanceResource): - class ChannelType(object): PUBLIC = "public" PRIVATE = "private" @@ -391,7 +391,6 @@ def __repr__(self) -> str: class ChannelContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the ChannelContext @@ -951,7 +950,6 @@ def __repr__(self) -> str: class ChannelPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ChannelInstance: """ Build an instance of ChannelInstance @@ -972,7 +970,6 @@ def __repr__(self) -> str: class ChannelList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the ChannelList @@ -1612,10 +1609,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ChannelPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/ip_messaging/v2/service/channel/invite.py b/twilio/rest/ip_messaging/v2/service/channel/invite.py index f0af17919..06cecdc05 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/invite.py +++ b/twilio/rest/ip_messaging/v2/service/channel/invite.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class InviteInstance(InstanceResource): + """ :ivar sid: :ivar account_sid: @@ -169,7 +171,6 @@ def __repr__(self) -> str: class InviteContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the InviteContext @@ -370,7 +371,6 @@ def __repr__(self) -> str: class InvitePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> InviteInstance: """ Build an instance of InviteInstance @@ -394,7 +394,6 @@ def __repr__(self) -> str: class InviteList(ListResource): - def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the InviteList @@ -914,10 +913,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = InvitePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/ip_messaging/v2/service/channel/member.py b/twilio/rest/ip_messaging/v2/service/channel/member.py index 8bd41711b..57a6e6edc 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/member.py +++ b/twilio/rest/ip_messaging/v2/service/channel/member.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class MemberInstance(InstanceResource): - class WebhookEnabledType(object): TRUE = "true" FALSE = "false" @@ -69,9 +69,9 @@ def __init__( self.last_consumed_message_index: Optional[int] = deserialize.integer( payload.get("last_consumed_message_index") ) - self.last_consumption_timestamp: Optional[datetime] = ( - deserialize.iso8601_datetime(payload.get("last_consumption_timestamp")) - ) + self.last_consumption_timestamp: Optional[ + datetime + ] = deserialize.iso8601_datetime(payload.get("last_consumption_timestamp")) self.url: Optional[str] = payload.get("url") self.attributes: Optional[str] = payload.get("attributes") @@ -354,7 +354,6 @@ def __repr__(self) -> str: class MemberContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the MemberContext @@ -875,7 +874,6 @@ def __repr__(self) -> str: class MemberPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> MemberInstance: """ Build an instance of MemberInstance @@ -899,7 +897,6 @@ def __repr__(self) -> str: class MemberList(ListResource): - def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the MemberList @@ -1559,10 +1556,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = MemberPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/ip_messaging/v2/service/channel/message.py b/twilio/rest/ip_messaging/v2/service/channel/message.py index ca543c1d5..ef4212998 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/message.py +++ b/twilio/rest/ip_messaging/v2/service/channel/message.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class MessageInstance(InstanceResource): - class OrderType(object): ASC = "asc" DESC = "desc" @@ -362,7 +362,6 @@ def __repr__(self) -> str: class MessageContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the MessageContext @@ -879,7 +878,6 @@ def __repr__(self) -> str: class MessagePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> MessageInstance: """ Build an instance of MessageInstance @@ -903,7 +901,6 @@ def __repr__(self) -> str: class MessageList(ListResource): - def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the MessageList @@ -1559,10 +1556,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = MessagePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/ip_messaging/v2/service/channel/webhook.py b/twilio/rest/ip_messaging/v2/service/channel/webhook.py index 5bf184749..18afc9636 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/webhook.py +++ b/twilio/rest/ip_messaging/v2/service/channel/webhook.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class WebhookInstance(InstanceResource): - class Method(object): GET = "GET" POST = "POST" @@ -297,7 +297,6 @@ def __repr__(self) -> str: class WebhookContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the WebhookContext @@ -728,7 +727,6 @@ def __repr__(self) -> str: class WebhookPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> WebhookInstance: """ Build an instance of WebhookInstance @@ -752,7 +750,6 @@ def __repr__(self) -> str: class WebhookList(ListResource): - def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the WebhookList @@ -1346,10 +1343,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = WebhookPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/ip_messaging/v2/service/role.py b/twilio/rest/ip_messaging/v2/service/role.py index c28ef1159..de69482cf 100644 --- a/twilio/rest/ip_messaging/v2/service/role.py +++ b/twilio/rest/ip_messaging/v2/service/role.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class RoleInstance(InstanceResource): - class RoleType(object): CHANNEL = "channel" DEPLOYMENT = "deployment" @@ -217,7 +217,6 @@ def __repr__(self) -> str: class RoleContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the RoleContext @@ -520,7 +519,6 @@ def __repr__(self) -> str: class RolePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> RoleInstance: """ Build an instance of RoleInstance @@ -541,7 +539,6 @@ def __repr__(self) -> str: class RoleList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the RoleList @@ -1021,10 +1018,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = RolePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/ip_messaging/v2/service/user/__init__.py b/twilio/rest/ip_messaging/v2/service/user/__init__.py index c0d8d274c..e5efc2db1 100644 --- a/twilio/rest/ip_messaging/v2/service/user/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/user/__init__.py @@ -12,6 +12,7 @@ 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 @@ -26,7 +27,6 @@ class UserInstance(InstanceResource): - class WebhookEnabledType(object): TRUE = "true" FALSE = "false" @@ -301,7 +301,6 @@ def __repr__(self) -> str: class UserContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the UserContext @@ -735,7 +734,6 @@ def __repr__(self) -> str: class UserPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> UserInstance: """ Build an instance of UserInstance @@ -756,7 +754,6 @@ def __repr__(self) -> str: class UserList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the UserList @@ -1314,10 +1311,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = UserPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/ip_messaging/v2/service/user/user_binding.py b/twilio/rest/ip_messaging/v2/service/user/user_binding.py index 1e36cdb2b..fdcbd08b8 100644 --- a/twilio/rest/ip_messaging/v2/service/user/user_binding.py +++ b/twilio/rest/ip_messaging/v2/service/user/user_binding.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class UserBindingInstance(InstanceResource): - class BindingType(object): GCM = "gcm" APN = "apn" @@ -181,7 +181,6 @@ def __repr__(self) -> str: class UserBindingContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, user_sid: str, sid: str): """ Initialize the UserBindingContext @@ -380,7 +379,6 @@ def __repr__(self) -> str: class UserBindingPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> UserBindingInstance: """ Build an instance of UserBindingInstance @@ -404,7 +402,6 @@ def __repr__(self) -> str: class UserBindingList(ListResource): - def __init__(self, version: Version, service_sid: str, user_sid: str): """ Initialize the UserBindingList @@ -816,10 +813,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = UserBindingPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/ip_messaging/v2/service/user/user_channel.py b/twilio/rest/ip_messaging/v2/service/user/user_channel.py index 87a8163bc..c3f746fe5 100644 --- a/twilio/rest/ip_messaging/v2/service/user/user_channel.py +++ b/twilio/rest/ip_messaging/v2/service/user/user_channel.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class UserChannelInstance(InstanceResource): - class ChannelStatus(object): JOINED = "joined" INVITED = "invited" @@ -74,9 +74,9 @@ def __init__( ) self.links: Optional[Dict[str, object]] = payload.get("links") self.url: Optional[str] = payload.get("url") - self.notification_level: Optional["UserChannelInstance.NotificationLevel"] = ( - payload.get("notification_level") - ) + self.notification_level: Optional[ + "UserChannelInstance.NotificationLevel" + ] = payload.get("notification_level") self._solution = { "service_sid": service_sid, @@ -277,7 +277,6 @@ def __repr__(self) -> str: class UserChannelContext(InstanceContext): - def __init__( self, version: Version, service_sid: str, user_sid: str, channel_sid: str ): @@ -670,7 +669,6 @@ def __repr__(self) -> str: class UserChannelPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> UserChannelInstance: """ Build an instance of UserChannelInstance @@ -694,7 +692,6 @@ def __repr__(self) -> str: class UserChannelList(ListResource): - def __init__(self, version: Version, service_sid: str, user_sid: str): """ Initialize the UserChannelList @@ -1046,10 +1043,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = UserChannelPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/knowledge/KnowledgeBase.py b/twilio/rest/knowledge/KnowledgeBase.py index 902f0e8b9..fe796991b 100644 --- a/twilio/rest/knowledge/KnowledgeBase.py +++ b/twilio/rest/knowledge/KnowledgeBase.py @@ -17,7 +17,6 @@ class KnowledgeBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Knowledge Domain diff --git a/twilio/rest/knowledge/v1/__init__.py b/twilio/rest/knowledge/v1/__init__.py index 9609bff95..629b99c31 100644 --- a/twilio/rest/knowledge/v1/__init__.py +++ b/twilio/rest/knowledge/v1/__init__.py @@ -16,10 +16,10 @@ from twilio.base.version import Version from twilio.base.domain import Domain from twilio.rest.knowledge.v1.knowledge import KnowledgeList +from twilio.rest.knowledge.v1.tag import TagList class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Knowledge @@ -28,6 +28,7 @@ def __init__(self, domain: Domain): """ super().__init__(domain, "v1") self._knowledge: Optional[KnowledgeList] = None + self._tags: Optional[TagList] = None @property def knowledge(self) -> KnowledgeList: @@ -35,6 +36,12 @@ def knowledge(self) -> KnowledgeList: self._knowledge = KnowledgeList(self) return self._knowledge + @property + def tags(self) -> TagList: + if self._tags is None: + self._tags = TagList(self) + return self._tags + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/knowledge/v1/knowledge/__init__.py b/twilio/rest/knowledge/v1/knowledge/__init__.py index 5e576c2af..17845bfe4 100644 --- a/twilio/rest/knowledge/v1/knowledge/__init__.py +++ b/twilio/rest/knowledge/v1/knowledge/__init__.py @@ -12,6 +12,7 @@ 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 @@ -26,7 +27,6 @@ class KnowledgeInstance(InstanceResource): - class KnowledgeV1ServiceCreateKnowledgeRequest(object): """ :ivar description: The description of the knowledge source. @@ -38,7 +38,6 @@ class KnowledgeV1ServiceCreateKnowledgeRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.description: Optional[str] = payload.get("description") self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( "knowledge_source_details" @@ -70,7 +69,6 @@ class KnowledgeV1ServiceCreatePolicyRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.description: Optional[str] = payload.get("description") self.id: Optional[str] = payload.get("id") self.name: Optional[str] = payload.get("name") @@ -99,7 +97,6 @@ class KnowledgeV1ServiceUpdateKnowledgeRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.description: Optional[str] = payload.get("description") self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( "knowledge_source_details" @@ -343,7 +340,6 @@ def __repr__(self) -> str: class KnowledgeContext(InstanceContext): - class KnowledgeV1ServiceCreateKnowledgeRequest(object): """ :ivar description: The description of the knowledge source. @@ -355,7 +351,6 @@ class KnowledgeV1ServiceCreateKnowledgeRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.description: Optional[str] = payload.get("description") self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( "knowledge_source_details" @@ -387,7 +382,6 @@ class KnowledgeV1ServiceCreatePolicyRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.description: Optional[str] = payload.get("description") self.id: Optional[str] = payload.get("id") self.name: Optional[str] = payload.get("name") @@ -416,7 +410,6 @@ class KnowledgeV1ServiceUpdateKnowledgeRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.description: Optional[str] = payload.get("description") self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( "knowledge_source_details" @@ -771,7 +764,6 @@ def __repr__(self) -> str: class KnowledgePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> KnowledgeInstance: """ Build an instance of KnowledgeInstance @@ -790,7 +782,6 @@ def __repr__(self) -> str: class KnowledgeList(ListResource): - class KnowledgeV1ServiceCreateKnowledgeRequest(object): """ :ivar description: The description of the knowledge source. @@ -802,7 +793,6 @@ class KnowledgeV1ServiceCreateKnowledgeRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.description: Optional[str] = payload.get("description") self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( "knowledge_source_details" @@ -834,7 +824,6 @@ class KnowledgeV1ServiceCreatePolicyRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.description: Optional[str] = payload.get("description") self.id: Optional[str] = payload.get("id") self.name: Optional[str] = payload.get("name") @@ -863,7 +852,6 @@ class KnowledgeV1ServiceUpdateKnowledgeRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.description: Optional[str] = payload.get("description") self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( "knowledge_source_details" @@ -1371,10 +1359,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = KnowledgePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/knowledge/v1/knowledge/chunk.py b/twilio/rest/knowledge/v1/knowledge/chunk.py index 227419589..4bc029212 100644 --- a/twilio/rest/knowledge/v1/knowledge/chunk.py +++ b/twilio/rest/knowledge/v1/knowledge/chunk.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class ChunkInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource. :ivar content: The chunk content. @@ -60,7 +62,6 @@ def __repr__(self) -> str: class ChunkPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ChunkInstance: """ Build an instance of ChunkInstance @@ -79,7 +80,6 @@ def __repr__(self) -> str: class ChunkList(ListResource): - def __init__(self, version: Version, id: str): """ Initialize the ChunkList @@ -427,10 +427,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ChunkPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/knowledge/v1/knowledge/knowledge_status.py b/twilio/rest/knowledge/v1/knowledge/knowledge_status.py index 6c83d6e8e..b3fa07328 100644 --- a/twilio/rest/knowledge/v1/knowledge/knowledge_status.py +++ b/twilio/rest/knowledge/v1/knowledge/knowledge_status.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional from twilio.base import deserialize, values @@ -23,6 +24,7 @@ class KnowledgeStatusInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource. :ivar status: The status of processing the knowledge source ('QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED') @@ -107,7 +109,6 @@ def __repr__(self) -> str: class KnowledgeStatusContext(InstanceContext): - def __init__(self, version: Version, id: str): """ Initialize the KnowledgeStatusContext @@ -224,7 +225,6 @@ def __repr__(self) -> str: class KnowledgeStatusList(ListResource): - def __init__(self, version: Version, id: str): """ Initialize the KnowledgeStatusList diff --git a/twilio/rest/knowledge/v1/tag.py b/twilio/rest/knowledge/v1/tag.py new file mode 100644 index 000000000..bb2a6d5d9 --- /dev/null +++ b/twilio/rest/knowledge/v1/tag.py @@ -0,0 +1,1100 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Knowledge + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.api_response import ApiResponse +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 TagInstance(InstanceResource): + class KnowledgeV1ServiceCreateTagValueRequest(object): + """ + :ivar value: The value of the tag. + :ivar enabled: Whether the tag value is enabled. + :ivar tag_id: The ID of the tag. + """ + + def __init__(self, payload: Dict[str, Any]): + self.value: Optional[str] = payload.get("value") + self.enabled: Optional[bool] = payload.get("enabled") + self.tag_id: Optional[str] = payload.get("tag_id") + + def to_dict(self): + return { + "value": self.value, + "enabled": self.enabled, + "tag_id": self.tag_id, + } + + class KnowledgeV1ServiceUpdateTagValueRequest(object): + """ + :ivar value: The value of the tag. + :ivar enabled: Whether the tag value is enabled. + """ + + def __init__(self, payload: Dict[str, Any]): + self.value: Optional[str] = payload.get("value") + self.enabled: Optional[bool] = payload.get("enabled") + + def to_dict(self): + return { + "value": self.value, + "enabled": self.enabled, + } + + """ + :ivar id: The ID of the tag value. + :ivar value: The value of the tag. + :ivar enabled: Whether the tag value is enabled. + :ivar tag_id: The ID of the tag. + :ivar date_created: The date and time in GMT when the Tag Value 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 Tag Value was updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The URL of the Tag Value resource. + :ivar resource_id: The ID of the resource. + :ivar resource_type: The type of the resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Tag Value resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + resource_id: Optional[str] = None, + id: Optional[str] = None, + ): + super().__init__(version) + + self.id: Optional[str] = payload.get("id") + self.value: Optional[str] = payload.get("value") + self.enabled: Optional[bool] = payload.get("enabled") + self.tag_id: Optional[str] = payload.get("tag_id") + 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.resource_id: Optional[str] = payload.get("resource_id") + self.resource_type: Optional[str] = payload.get("resource_type") + self.account_sid: Optional[str] = payload.get("account_sid") + + self._solution = { + "resource_id": resource_id or self.resource_id, + "id": id or self.id, + } + self._context: Optional[TagContext] = None + + @property + def _proxy(self) -> "TagContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: TagContext for this TagInstance + """ + if self._context is None: + self._context = TagContext( + self._version, + resource_id=self._solution["resource_id"], + id=self._solution["id"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the TagInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the TagInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the TagInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return self._proxy.delete_with_http_info() + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the TagInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return await self._proxy.delete_with_http_info_async() + + def update( + self, + knowledge_v1_service_update_tag_value_request: Union[ + KnowledgeV1ServiceUpdateTagValueRequest, object + ] = values.unset, + ) -> "TagInstance": + """ + Update the TagInstance + + :param knowledge_v1_service_update_tag_value_request: + + :returns: The updated TagInstance + """ + return self._proxy.update( + knowledge_v1_service_update_tag_value_request=knowledge_v1_service_update_tag_value_request, + ) + + async def update_async( + self, + knowledge_v1_service_update_tag_value_request: Union[ + KnowledgeV1ServiceUpdateTagValueRequest, object + ] = values.unset, + ) -> "TagInstance": + """ + Asynchronous coroutine to update the TagInstance + + :param knowledge_v1_service_update_tag_value_request: + + :returns: The updated TagInstance + """ + return await self._proxy.update_async( + knowledge_v1_service_update_tag_value_request=knowledge_v1_service_update_tag_value_request, + ) + + def update_with_http_info( + self, + knowledge_v1_service_update_tag_value_request: Union[ + KnowledgeV1ServiceUpdateTagValueRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Update the TagInstance with HTTP info + + :param knowledge_v1_service_update_tag_value_request: + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.update_with_http_info( + knowledge_v1_service_update_tag_value_request=knowledge_v1_service_update_tag_value_request, + ) + + async def update_with_http_info_async( + self, + knowledge_v1_service_update_tag_value_request: Union[ + KnowledgeV1ServiceUpdateTagValueRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to update the TagInstance with HTTP info + + :param knowledge_v1_service_update_tag_value_request: + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.update_with_http_info_async( + knowledge_v1_service_update_tag_value_request=knowledge_v1_service_update_tag_value_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 TagContext(InstanceContext): + class KnowledgeV1ServiceCreateTagValueRequest(object): + """ + :ivar value: The value of the tag. + :ivar enabled: Whether the tag value is enabled. + :ivar tag_id: The ID of the tag. + """ + + def __init__(self, payload: Dict[str, Any]): + self.value: Optional[str] = payload.get("value") + self.enabled: Optional[bool] = payload.get("enabled") + self.tag_id: Optional[str] = payload.get("tag_id") + + def to_dict(self): + return { + "value": self.value, + "enabled": self.enabled, + "tag_id": self.tag_id, + } + + class KnowledgeV1ServiceUpdateTagValueRequest(object): + """ + :ivar value: The value of the tag. + :ivar enabled: Whether the tag value is enabled. + """ + + def __init__(self, payload: Dict[str, Any]): + self.value: Optional[str] = payload.get("value") + self.enabled: Optional[bool] = payload.get("enabled") + + def to_dict(self): + return { + "value": self.value, + "enabled": self.enabled, + } + + def __init__(self, version: Version, resource_id: str, id: str): + """ + Initialize the TagContext + + :param version: Version that contains the resource + :param resource_id: + :param id: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "resource_id": resource_id, + "id": id, + } + self._uri = "/Knowledge/{resource_id}/Tags/{id}".format(**self._solution) + + def _delete(self) -> tuple: + """ + Internal helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + return self._version.delete_with_response_info( + method="DELETE", uri=self._uri, headers=headers + ) + + def delete(self) -> bool: + """ + Deletes the TagInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = self._delete() + return success + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the TagInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = self._delete() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + async def _delete_async(self) -> tuple: + """ + Internal async helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + return await self._version.delete_with_response_info_async( + method="DELETE", uri=self._uri, headers=headers + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the TagInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = await self._delete_async() + return success + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the TagInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = await self._delete_async() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + def _update( + self, + knowledge_v1_service_update_tag_value_request: Union[ + KnowledgeV1ServiceUpdateTagValueRequest, object + ] = values.unset, + ) -> tuple: + """ + Internal helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = knowledge_v1_service_update_tag_value_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.update_with_response_info( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + def update( + self, + knowledge_v1_service_update_tag_value_request: Union[ + KnowledgeV1ServiceUpdateTagValueRequest, object + ] = values.unset, + ) -> TagInstance: + """ + Update the TagInstance + + :param knowledge_v1_service_update_tag_value_request: + + :returns: The updated TagInstance + """ + payload, _, _ = self._update( + knowledge_v1_service_update_tag_value_request=knowledge_v1_service_update_tag_value_request + ) + return TagInstance( + self._version, + payload, + resource_id=self._solution["resource_id"], + id=self._solution["id"], + ) + + def update_with_http_info( + self, + knowledge_v1_service_update_tag_value_request: Union[ + KnowledgeV1ServiceUpdateTagValueRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Update the TagInstance and return response metadata + + :param knowledge_v1_service_update_tag_value_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._update( + knowledge_v1_service_update_tag_value_request=knowledge_v1_service_update_tag_value_request + ) + instance = TagInstance( + self._version, + payload, + resource_id=self._solution["resource_id"], + id=self._solution["id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _update_async( + self, + knowledge_v1_service_update_tag_value_request: Union[ + KnowledgeV1ServiceUpdateTagValueRequest, object + ] = values.unset, + ) -> tuple: + """ + Internal async helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = knowledge_v1_service_update_tag_value_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.update_with_response_info_async( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + async def update_async( + self, + knowledge_v1_service_update_tag_value_request: Union[ + KnowledgeV1ServiceUpdateTagValueRequest, object + ] = values.unset, + ) -> TagInstance: + """ + Asynchronous coroutine to update the TagInstance + + :param knowledge_v1_service_update_tag_value_request: + + :returns: The updated TagInstance + """ + payload, _, _ = await self._update_async( + knowledge_v1_service_update_tag_value_request=knowledge_v1_service_update_tag_value_request + ) + return TagInstance( + self._version, + payload, + resource_id=self._solution["resource_id"], + id=self._solution["id"], + ) + + async def update_with_http_info_async( + self, + knowledge_v1_service_update_tag_value_request: Union[ + KnowledgeV1ServiceUpdateTagValueRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to update the TagInstance and return response metadata + + :param knowledge_v1_service_update_tag_value_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._update_async( + knowledge_v1_service_update_tag_value_request=knowledge_v1_service_update_tag_value_request + ) + instance = TagInstance( + self._version, + payload, + resource_id=self._solution["resource_id"], + id=self._solution["id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class TagPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> TagInstance: + """ + Build an instance of TagInstance + + :param payload: Payload response from the API + """ + return TagInstance( + self._version, payload, resource_id=self._solution["resource_id"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class TagList(ListResource): + class KnowledgeV1ServiceCreateTagValueRequest(object): + """ + :ivar value: The value of the tag. + :ivar enabled: Whether the tag value is enabled. + :ivar tag_id: The ID of the tag. + """ + + def __init__(self, payload: Dict[str, Any]): + self.value: Optional[str] = payload.get("value") + self.enabled: Optional[bool] = payload.get("enabled") + self.tag_id: Optional[str] = payload.get("tag_id") + + def to_dict(self): + return { + "value": self.value, + "enabled": self.enabled, + "tag_id": self.tag_id, + } + + class KnowledgeV1ServiceUpdateTagValueRequest(object): + """ + :ivar value: The value of the tag. + :ivar enabled: Whether the tag value is enabled. + """ + + def __init__(self, payload: Dict[str, Any]): + self.value: Optional[str] = payload.get("value") + self.enabled: Optional[bool] = payload.get("enabled") + + def to_dict(self): + return { + "value": self.value, + "enabled": self.enabled, + } + + def __init__(self, version: Version, resource_id: str): + """ + Initialize the TagList + + :param version: Version that contains the resource + :param resource_id: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "resource_id": resource_id, + } + self._uri = "/Knowledge/{resource_id}/Tags".format(**self._solution) + + def _create( + self, + knowledge_v1_service_create_tag_value_request: Union[ + KnowledgeV1ServiceCreateTagValueRequest, object + ] = values.unset, + ) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = knowledge_v1_service_create_tag_value_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, + knowledge_v1_service_create_tag_value_request: Union[ + KnowledgeV1ServiceCreateTagValueRequest, object + ] = values.unset, + ) -> TagInstance: + """ + Create the TagInstance + + :param knowledge_v1_service_create_tag_value_request: + + :returns: The created TagInstance + """ + payload, _, _ = self._create( + knowledge_v1_service_create_tag_value_request=knowledge_v1_service_create_tag_value_request + ) + return TagInstance( + self._version, payload, resource_id=self._solution["resource_id"] + ) + + def create_with_http_info( + self, + knowledge_v1_service_create_tag_value_request: Union[ + KnowledgeV1ServiceCreateTagValueRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Create the TagInstance and return response metadata + + :param knowledge_v1_service_create_tag_value_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create( + knowledge_v1_service_create_tag_value_request=knowledge_v1_service_create_tag_value_request + ) + instance = TagInstance( + self._version, payload, resource_id=self._solution["resource_id"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async( + self, + knowledge_v1_service_create_tag_value_request: Union[ + KnowledgeV1ServiceCreateTagValueRequest, object + ] = values.unset, + ) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = knowledge_v1_service_create_tag_value_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, + knowledge_v1_service_create_tag_value_request: Union[ + KnowledgeV1ServiceCreateTagValueRequest, object + ] = values.unset, + ) -> TagInstance: + """ + Asynchronously create the TagInstance + + :param knowledge_v1_service_create_tag_value_request: + + :returns: The created TagInstance + """ + payload, _, _ = await self._create_async( + knowledge_v1_service_create_tag_value_request=knowledge_v1_service_create_tag_value_request + ) + return TagInstance( + self._version, payload, resource_id=self._solution["resource_id"] + ) + + async def create_with_http_info_async( + self, + knowledge_v1_service_create_tag_value_request: Union[ + KnowledgeV1ServiceCreateTagValueRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Asynchronously create the TagInstance and return response metadata + + :param knowledge_v1_service_create_tag_value_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + knowledge_v1_service_create_tag_value_request=knowledge_v1_service_create_tag_value_request + ) + instance = TagInstance( + self._version, payload, resource_id=self._solution["resource_id"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[TagInstance]: + """ + Streams TagInstance 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[TagInstance]: + """ + Asynchronously streams TagInstance 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 stream_with_http_info( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams TagInstance and returns headers from first page + + + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info(page_size=limits["page_size"]) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams TagInstance and returns headers from first page + + + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + page_size=limits["page_size"] + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[TagInstance]: + """ + Lists TagInstance 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[TagInstance]: + """ + Asynchronously lists TagInstance 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 list_with_http_info( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists TagInstance and returns headers from first page + + + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists TagInstance and returns headers from first page + + + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> TagPage: + """ + Retrieve a single page of TagInstance 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 TagInstance + """ + 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 TagPage(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, + ) -> TagPage: + """ + Asynchronously retrieve a single page of TagInstance 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 TagInstance + """ + 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 TagPage(self._version, response, self._solution) + + def page_with_http_info( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :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: ApiResponse with TagPage, status code, and headers + """ + 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, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = TagPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :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: ApiResponse with TagPage, status code, and headers + """ + 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, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = TagPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> TagPage: + """ + Retrieve a specific page of TagInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of TagInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return TagPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> TagPage: + """ + Asynchronously retrieve a specific page of TagInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of TagInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return TagPage(self._version, response, self._solution) + + def get(self, resource_id: str, id: str) -> TagContext: + """ + Constructs a TagContext + + :param resource_id: + :param id: + """ + return TagContext(self._version, resource_id=resource_id, id=id) + + def __call__(self, resource_id: str, id: str) -> TagContext: + """ + Constructs a TagContext + + :param resource_id: + :param id: + """ + return TagContext(self._version, resource_id=resource_id, id=id) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/lookups/LookupsBase.py b/twilio/rest/lookups/LookupsBase.py index e24f8dc61..fe3aa2aa6 100644 --- a/twilio/rest/lookups/LookupsBase.py +++ b/twilio/rest/lookups/LookupsBase.py @@ -18,7 +18,6 @@ class LookupsBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Lookups Domain diff --git a/twilio/rest/lookups/v1/__init__.py b/twilio/rest/lookups/v1/__init__.py index 72204da36..82f17cc04 100644 --- a/twilio/rest/lookups/v1/__init__.py +++ b/twilio/rest/lookups/v1/__init__.py @@ -19,7 +19,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Lookups diff --git a/twilio/rest/lookups/v1/phone_number.py b/twilio/rest/lookups/v1/phone_number.py index 1a31f9650..11d30265c 100644 --- a/twilio/rest/lookups/v1/phone_number.py +++ b/twilio/rest/lookups/v1/phone_number.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class PhoneNumberInstance(InstanceResource): + """ :ivar caller_name: The name of the phone number's owner. If `null`, that information was not available. :ivar country_code: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) for the phone number. @@ -175,7 +177,6 @@ def __repr__(self) -> str: class PhoneNumberContext(InstanceContext): - def __init__(self, version: Version, phone_number: str): """ Initialize the PhoneNumberContext @@ -384,7 +385,6 @@ def __repr__(self) -> str: class PhoneNumberList(ListResource): - def __init__(self, version: Version): """ Initialize the PhoneNumberList diff --git a/twilio/rest/lookups/v2/__init__.py b/twilio/rest/lookups/v2/__init__.py index 852f55254..59efd4ffa 100644 --- a/twilio/rest/lookups/v2/__init__.py +++ b/twilio/rest/lookups/v2/__init__.py @@ -23,7 +23,6 @@ class V2(Version): - def __init__(self, domain: Domain): """ Initialize the V2 version of Lookups diff --git a/twilio/rest/lookups/v2/bucket.py b/twilio/rest/lookups/v2/bucket.py index 4937da9f2..30a0e6366 100644 --- a/twilio/rest/lookups/v2/bucket.py +++ b/twilio/rest/lookups/v2/bucket.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,7 +23,6 @@ class BucketInstance(InstanceResource): - class RateLimitRequest(object): """ :ivar limit: Limit of requests for the bucket @@ -30,7 +30,6 @@ class RateLimitRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.limit: Optional[int] = payload.get("limit") self.ttl: Optional[int] = payload.get("ttl") @@ -232,7 +231,6 @@ def __repr__(self) -> str: class BucketContext(InstanceContext): - class RateLimitRequest(object): """ :ivar limit: Limit of requests for the bucket @@ -240,7 +238,6 @@ class RateLimitRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.limit: Optional[int] = payload.get("limit") self.ttl: Optional[int] = payload.get("ttl") @@ -566,7 +563,6 @@ def __repr__(self) -> str: class BucketList(ListResource): - class RateLimitRequest(object): """ :ivar limit: Limit of requests for the bucket @@ -574,7 +570,6 @@ class RateLimitRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.limit: Optional[int] = payload.get("limit") self.ttl: Optional[int] = payload.get("ttl") diff --git a/twilio/rest/lookups/v2/lookup_override.py b/twilio/rest/lookups/v2/lookup_override.py index acbb42f77..aca8c8e5e 100644 --- a/twilio/rest/lookups/v2/lookup_override.py +++ b/twilio/rest/lookups/v2/lookup_override.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, values @@ -23,7 +24,6 @@ class LookupOverrideInstance(InstanceResource): - class OverridesRequest(object): """ :ivar line_type: The new line type to override the original line type @@ -31,7 +31,6 @@ class OverridesRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.line_type: Optional["LookupOverrideInstance.str"] = payload.get( "line_type" ) @@ -307,7 +306,6 @@ def __repr__(self) -> str: class LookupOverrideContext(InstanceContext): - class OverridesRequest(object): """ :ivar line_type: The new line type to override the original line type @@ -315,7 +313,6 @@ class OverridesRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.line_type: Optional["LookupOverrideInstance.str"] = payload.get( "line_type" ) @@ -763,7 +760,6 @@ def __repr__(self) -> str: class LookupOverrideList(ListResource): - class OverridesRequest(object): """ :ivar line_type: The new line type to override the original line type @@ -771,7 +767,6 @@ class OverridesRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.line_type: Optional["LookupOverrideInstance.str"] = payload.get( "line_type" ) diff --git a/twilio/rest/lookups/v2/phone_number.py b/twilio/rest/lookups/v2/phone_number.py index 9523d62d9..85f91bf0d 100644 --- a/twilio/rest/lookups/v2/phone_number.py +++ b/twilio/rest/lookups/v2/phone_number.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,7 +23,6 @@ class PhoneNumberInstance(InstanceResource): - class ValidationError(object): TOO_SHORT = "TOO_SHORT" TOO_LONG = "TOO_LONG" @@ -340,7 +340,6 @@ def __repr__(self) -> str: class PhoneNumberContext(InstanceContext): - def __init__(self, version: Version, phone_number: str): """ Initialize the PhoneNumberContext @@ -723,7 +722,6 @@ def __repr__(self) -> str: class PhoneNumberList(ListResource): - def __init__(self, version: Version): """ Initialize the PhoneNumberList diff --git a/twilio/rest/lookups/v2/query.py b/twilio/rest/lookups/v2/query.py index 3fb44ba33..6fa50dda7 100644 --- a/twilio/rest/lookups/v2/query.py +++ b/twilio/rest/lookups/v2/query.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, List, Optional, Union from twilio.base import values @@ -23,7 +24,6 @@ class QueryInstance(InstanceResource): - class IdentityMatchParameters(object): """ :ivar first_name: @@ -39,7 +39,6 @@ class IdentityMatchParameters(object): """ 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") @@ -75,7 +74,6 @@ class LastSimSwapInfo(object): """ def __init__(self, payload: Dict[str, Any]): - self.last_sim_swap_date: Optional[datetime] = payload.get( "last_sim_swap_date" ) @@ -101,17 +99,16 @@ class LookupBatchRequest(object): """ 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.ReassignedNumberParameters] = ( - payload.get("reassigned_number") - ) + self.identity_match: Optional[ + QueryList.IdentityMatchParameters + ] = payload.get("identity_match") + self.reassigned_number: Optional[ + QueryList.ReassignedNumberParameters + ] = payload.get("reassigned_number") self.sms_pumping_risk: Optional[QueryList.RiskParameters] = payload.get( "sms_pumping_risk" ) @@ -122,21 +119,15 @@ def to_dict(self): "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 - ), + "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 LookupRequest(object): @@ -145,18 +136,17 @@ class LookupRequest(object): """ def __init__(self, payload: Dict[str, Any]): - - self.phone_numbers: Optional[List[QueryList.LookupBatchRequest]] = ( - payload.get("phone_numbers") - ) + self.phone_numbers: Optional[ + List[QueryList.LookupBatchRequest] + ] = 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 - ), + "phone_numbers": [ + phone_numbers.to_dict() for phone_numbers in self.phone_numbers + ] + if self.phone_numbers is not None + else None, } class ReassignedNumberParameters(object): @@ -165,7 +155,6 @@ class ReassignedNumberParameters(object): """ def __init__(self, payload: Dict[str, Any]): - self.last_verified_date: Optional[str] = payload.get("last_verified_date") def to_dict(self): @@ -179,7 +168,6 @@ class RiskParameters(object): """ def __init__(self, payload: Dict[str, Any]): - self.partner_sub_id: Optional[str] = payload.get("partner_sub_id") def to_dict(self): @@ -207,7 +195,6 @@ def __repr__(self) -> str: class QueryList(ListResource): - class IdentityMatchParameters(object): """ :ivar first_name: @@ -223,7 +210,6 @@ class IdentityMatchParameters(object): """ 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") @@ -259,7 +245,6 @@ class LastSimSwapInfo(object): """ def __init__(self, payload: Dict[str, Any]): - self.last_sim_swap_date: Optional[datetime] = payload.get( "last_sim_swap_date" ) @@ -285,17 +270,16 @@ class LookupBatchRequest(object): """ 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.ReassignedNumberParameters] = ( - payload.get("reassigned_number") - ) + self.identity_match: Optional[ + QueryList.IdentityMatchParameters + ] = payload.get("identity_match") + self.reassigned_number: Optional[ + QueryList.ReassignedNumberParameters + ] = payload.get("reassigned_number") self.sms_pumping_risk: Optional[QueryList.RiskParameters] = payload.get( "sms_pumping_risk" ) @@ -306,21 +290,15 @@ def to_dict(self): "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 - ), + "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 LookupRequest(object): @@ -329,18 +307,17 @@ class LookupRequest(object): """ def __init__(self, payload: Dict[str, Any]): - - self.phone_numbers: Optional[List[QueryList.LookupBatchRequest]] = ( - payload.get("phone_numbers") - ) + self.phone_numbers: Optional[ + List[QueryList.LookupBatchRequest] + ] = 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 - ), + "phone_numbers": [ + phone_numbers.to_dict() for phone_numbers in self.phone_numbers + ] + if self.phone_numbers is not None + else None, } class ReassignedNumberParameters(object): @@ -349,7 +326,6 @@ class ReassignedNumberParameters(object): """ def __init__(self, payload: Dict[str, Any]): - self.last_verified_date: Optional[str] = payload.get("last_verified_date") def to_dict(self): @@ -363,7 +339,6 @@ class RiskParameters(object): """ def __init__(self, payload: Dict[str, Any]): - self.partner_sub_id: Optional[str] = payload.get("partner_sub_id") def to_dict(self): diff --git a/twilio/rest/lookups/v2/rate_limit.py b/twilio/rest/lookups/v2/rate_limit.py index 71d6ce17e..efb90cb48 100644 --- a/twilio/rest/lookups/v2/rate_limit.py +++ b/twilio/rest/lookups/v2/rate_limit.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class RateLimitInstance(InstanceResource): + """ :ivar rate_limits: """ @@ -42,7 +44,6 @@ def __repr__(self) -> str: class RateLimitList(ListResource): - def __init__(self, version: Version): """ Initialize the RateLimitList diff --git a/twilio/rest/marketplace/MarketplaceBase.py b/twilio/rest/marketplace/MarketplaceBase.py index 9fbe193d9..3b12fe7a2 100644 --- a/twilio/rest/marketplace/MarketplaceBase.py +++ b/twilio/rest/marketplace/MarketplaceBase.py @@ -17,7 +17,6 @@ class MarketplaceBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Marketplace Domain diff --git a/twilio/rest/marketplace/v1/__init__.py b/twilio/rest/marketplace/v1/__init__.py index 6a84b31cd..ba5d2fe5e 100644 --- a/twilio/rest/marketplace/v1/__init__.py +++ b/twilio/rest/marketplace/v1/__init__.py @@ -23,7 +23,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Marketplace diff --git a/twilio/rest/marketplace/v1/available_add_on/__init__.py b/twilio/rest/marketplace/v1/available_add_on/__init__.py index 6fd7dfc4e..9555bcd0a 100644 --- a/twilio/rest/marketplace/v1/available_add_on/__init__.py +++ b/twilio/rest/marketplace/v1/available_add_on/__init__.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -26,6 +27,7 @@ class AvailableAddOnInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the AvailableAddOn resource. :ivar friendly_name: The string that you assigned to describe the resource. @@ -125,7 +127,6 @@ def __repr__(self) -> str: class AvailableAddOnContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the AvailableAddOnContext @@ -256,7 +257,6 @@ def __repr__(self) -> str: class AvailableAddOnPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> AvailableAddOnInstance: """ Build an instance of AvailableAddOnInstance @@ -275,7 +275,6 @@ def __repr__(self) -> str: class AvailableAddOnList(ListResource): - def __init__(self, version: Version): """ Initialize the AvailableAddOnList @@ -618,10 +617,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AvailableAddOnPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/marketplace/v1/available_add_on/available_add_on_extension.py b/twilio/rest/marketplace/v1/available_add_on/available_add_on_extension.py index 54bafaba8..506d28d9d 100644 --- a/twilio/rest/marketplace/v1/available_add_on/available_add_on_extension.py +++ b/twilio/rest/marketplace/v1/available_add_on/available_add_on_extension.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class AvailableAddOnExtensionInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the AvailableAddOnExtension resource. :ivar available_add_on_sid: The SID of the AvailableAddOn resource to which this extension applies. @@ -119,7 +121,6 @@ def __repr__(self) -> str: class AvailableAddOnExtensionContext(InstanceContext): - def __init__(self, version: Version, available_add_on_sid: str, sid: str): """ Initialize the AvailableAddOnExtensionContext @@ -246,7 +247,6 @@ def __repr__(self) -> str: class AvailableAddOnExtensionPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> AvailableAddOnExtensionInstance: """ Build an instance of AvailableAddOnExtensionInstance @@ -269,7 +269,6 @@ def __repr__(self) -> str: class AvailableAddOnExtensionList(ListResource): - def __init__(self, version: Version, available_add_on_sid: str): """ Initialize the AvailableAddOnExtensionList @@ -619,10 +618,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AvailableAddOnExtensionPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/marketplace/v1/installed_add_on/__init__.py b/twilio/rest/marketplace/v1/installed_add_on/__init__.py index 29ff78c52..a02bbd98f 100644 --- a/twilio/rest/marketplace/v1/installed_add_on/__init__.py +++ b/twilio/rest/marketplace/v1/installed_add_on/__init__.py @@ -12,6 +12,7 @@ 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 @@ -30,6 +31,7 @@ class InstalledAddOnInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the InstalledAddOn resource. This Sid can also be found in the Console on that specific Add-ons page as the 'Available Add-on Sid'. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the InstalledAddOn resource. @@ -252,7 +254,6 @@ def __repr__(self) -> str: class InstalledAddOnContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the InstalledAddOnContext @@ -598,7 +599,6 @@ def __repr__(self) -> str: class InstalledAddOnPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> InstalledAddOnInstance: """ Build an instance of InstalledAddOnInstance @@ -617,7 +617,6 @@ def __repr__(self) -> str: class InstalledAddOnList(ListResource): - def __init__(self, version: Version): """ Initialize the InstalledAddOnList @@ -1130,10 +1129,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = InstalledAddOnPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_extension.py b/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_extension.py index 217638e9e..ae2087665 100644 --- a/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_extension.py +++ b/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_extension.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class InstalledAddOnExtensionInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the InstalledAddOn Extension resource. :ivar installed_add_on_sid: The SID of the InstalledAddOn resource to which this extension applies. @@ -169,7 +171,6 @@ def __repr__(self) -> str: class InstalledAddOnExtensionContext(InstanceContext): - def __init__(self, version: Version, installed_add_on_sid: str, sid: str): """ Initialize the InstalledAddOnExtensionContext @@ -408,7 +409,6 @@ def __repr__(self) -> str: class InstalledAddOnExtensionPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> InstalledAddOnExtensionInstance: """ Build an instance of InstalledAddOnExtensionInstance @@ -431,7 +431,6 @@ def __repr__(self) -> str: class InstalledAddOnExtensionList(ListResource): - def __init__(self, version: Version, installed_add_on_sid: str): """ Initialize the InstalledAddOnExtensionList @@ -781,10 +780,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = InstalledAddOnExtensionPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py b/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py index 9a2a66844..a9c772a08 100644 --- a/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py +++ b/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.api_response import ApiResponse @@ -22,7 +23,6 @@ class InstalledAddOnUsageInstance(InstanceResource): - class MarketplaceV1InstalledAddOnInstalledAddOnUsage(object): """ :ivar total_submitted: Total amount in local currency that was billed in this request. Aggregates all billable_items that were successfully submitted. @@ -30,7 +30,6 @@ class MarketplaceV1InstalledAddOnInstalledAddOnUsage(object): """ def __init__(self, payload: Dict[str, Any]): - self.total_submitted: Optional[float] = deserialize.decimal( payload.get("total_submitted") ) @@ -43,11 +42,11 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { "total_submitted": self.total_submitted, - "billable_items": ( - [billable_items.to_dict() for billable_items in self.billable_items] - if self.billable_items is not None - else None - ), + "billable_items": [ + billable_items.to_dict() for billable_items in self.billable_items + ] + if self.billable_items is not None + else None, } class MarketplaceV1InstalledAddOnInstalledAddOnUsageBillableItems(object): @@ -58,7 +57,6 @@ class MarketplaceV1InstalledAddOnInstalledAddOnUsageBillableItems(object): """ def __init__(self, payload: Dict[str, Any]): - self.quantity: Optional[float] = payload.get("quantity") self.sid: Optional[str] = payload.get("sid") self.submitted: Optional[bool] = payload.get("submitted") @@ -102,7 +100,6 @@ def __repr__(self) -> str: class InstalledAddOnUsageList(ListResource): - class MarketplaceV1InstalledAddOnInstalledAddOnUsage(object): """ :ivar total_submitted: Total amount in local currency that was billed in this request. Aggregates all billable_items that were successfully submitted. @@ -110,7 +107,6 @@ class MarketplaceV1InstalledAddOnInstalledAddOnUsage(object): """ def __init__(self, payload: Dict[str, Any]): - self.total_submitted: Optional[float] = deserialize.decimal( payload.get("total_submitted") ) @@ -123,11 +119,11 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { "total_submitted": self.total_submitted, - "billable_items": ( - [billable_items.to_dict() for billable_items in self.billable_items] - if self.billable_items is not None - else None - ), + "billable_items": [ + billable_items.to_dict() for billable_items in self.billable_items + ] + if self.billable_items is not None + else None, } class MarketplaceV1InstalledAddOnInstalledAddOnUsageBillableItems(object): @@ -138,7 +134,6 @@ class MarketplaceV1InstalledAddOnInstalledAddOnUsageBillableItems(object): """ def __init__(self, payload: Dict[str, Any]): - self.quantity: Optional[float] = payload.get("quantity") self.sid: Optional[str] = payload.get("sid") self.submitted: Optional[bool] = payload.get("submitted") diff --git a/twilio/rest/marketplace/v1/module_data.py b/twilio/rest/marketplace/v1/module_data.py index 90a6cbb99..afaf74dab 100644 --- a/twilio/rest/marketplace/v1/module_data.py +++ b/twilio/rest/marketplace/v1/module_data.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class ModuleDataInstance(InstanceResource): + """ :ivar url: URL to query the subresource. :ivar sid: ModuleSid that identifies this Listing. @@ -60,7 +62,6 @@ def __repr__(self) -> str: class ModuleDataList(ListResource): - def __init__(self, version: Version): """ Initialize the ModuleDataList diff --git a/twilio/rest/marketplace/v1/module_data_management.py b/twilio/rest/marketplace/v1/module_data_management.py index 89181a81e..ce6b637b4 100644 --- a/twilio/rest/marketplace/v1/module_data_management.py +++ b/twilio/rest/marketplace/v1/module_data_management.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class ModuleDataManagementInstance(InstanceResource): + """ :ivar url: URL to query the subresource. :ivar sid: ModuleSid that identifies this Listing. @@ -250,7 +252,6 @@ def __repr__(self) -> str: class ModuleDataManagementContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the ModuleDataManagementContext @@ -589,7 +590,6 @@ def __repr__(self) -> str: class ModuleDataManagementList(ListResource): - def __init__(self, version: Version): """ Initialize the ModuleDataManagementList diff --git a/twilio/rest/marketplace/v1/referral_conversion.py b/twilio/rest/marketplace/v1/referral_conversion.py index 1234b45c6..b8903ce48 100644 --- a/twilio/rest/marketplace/v1/referral_conversion.py +++ b/twilio/rest/marketplace/v1/referral_conversion.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,14 +23,12 @@ class ReferralConversionInstance(InstanceResource): - class CreateReferralConversionRequest(object): """ :ivar referral_account_sid: """ def __init__(self, payload: Dict[str, Any]): - self.referral_account_sid: Optional[str] = payload.get( "referral_account_sid" ) @@ -59,14 +58,12 @@ def __repr__(self) -> str: class ReferralConversionList(ListResource): - class CreateReferralConversionRequest(object): """ :ivar referral_account_sid: """ def __init__(self, payload: Dict[str, Any]): - self.referral_account_sid: Optional[str] = payload.get( "referral_account_sid" ) diff --git a/twilio/rest/memory/MemoryBase.py b/twilio/rest/memory/MemoryBase.py new file mode 100644 index 000000000..78f3f0804 --- /dev/null +++ b/twilio/rest/memory/MemoryBase.py @@ -0,0 +1,43 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from typing import Optional + +from twilio.base.domain import Domain +from twilio.rest import Client +from twilio.rest.memory.v1 import V1 + + +class MemoryBase(Domain): + def __init__(self, twilio: Client): + """ + Initialize the Marketplace Domain + + :returns: Domain for Marketplace + """ + super().__init__(twilio, "https://memory.twilio.com") + self._v1: Optional[V1] = None + + @property + def v1(self) -> V1: + """ + :returns: Versions v1 of Marketplace + """ + if self._v1 is None: + self._v1 = V1(self) + return self._v1 + + def __repr__(self) -> str: + """ + Provide a friendly representation + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/memory/__init__.py b/twilio/rest/memory/__init__.py new file mode 100644 index 000000000..41036f29d --- /dev/null +++ b/twilio/rest/memory/__init__.py @@ -0,0 +1,35 @@ +from twilio.rest.memory.MemoryBase import MemoryBase + + +class Memory(MemoryBase): + + def bulk(self): + return self.v1.bulk + + def conversation_summary(self): + return self.v1.conversation_summaries + + def event(self): + return self.v1.events + + def identifier(self): + return self.v1.identifiers + + def identify_resolution_setting(self): + return self.v1.identity_resolution_settings + + def import_(self): + return self.v1.import_ + + def lookup(self): + return self.v1.lookup + + def observation(self): + return self.v1.observations + + def profile(self): + return self.v1.profiles + + def recall(self): + return self.v1.recall + diff --git a/twilio/rest/memory/v1/__init__.py b/twilio/rest/memory/v1/__init__.py new file mode 100644 index 000000000..93e65cf44 --- /dev/null +++ b/twilio/rest/memory/v1/__init__.py @@ -0,0 +1,158 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio Memory API + APIs for managing memory stores, profiles, events, and conversational intelligence capabilities. + + 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.memory.v1.bulk import BulkList +from twilio.rest.memory.v1.conversation_summary import ConversationSummaryList +from twilio.rest.memory.v1.event import EventList +from twilio.rest.memory.v1.identifier import IdentifierList +from twilio.rest.memory.v1.identity_resolution_setting import ( + IdentityResolutionSettingList, +) +from twilio.rest.memory.v1.import_ import ImportList +from twilio.rest.memory.v1.lookup import LookupList +from twilio.rest.memory.v1.observation import ObservationList +from twilio.rest.memory.v1.profile import ProfileList +from twilio.rest.memory.v1.profile_import import ProfileImportList +from twilio.rest.memory.v1.recall import RecallList +from twilio.rest.memory.v1.revision import RevisionList +from twilio.rest.memory.v1.store import StoreList +from twilio.rest.memory.v1.trait import TraitList +from twilio.rest.memory.v1.trait_group import TraitGroupList + + +class V1(Version): + def __init__(self, domain: Domain): + """ + Initialize the V1 version of Memory + + :param domain: The Twilio.memory domain + """ + super().__init__(domain, "v1") + self._bulk: Optional[BulkList] = None + self._conversation_summaries: Optional[ConversationSummaryList] = None + self._events: Optional[EventList] = None + self._identifiers: Optional[IdentifierList] = None + self._identity_resolution_settings: Optional[ + IdentityResolutionSettingList + ] = None + self._import_: Optional[ImportList] = None + self._lookup: Optional[LookupList] = None + self._observations: Optional[ObservationList] = None + self._profiles: Optional[ProfileList] = None + self._imports: Optional[ProfileImportList] = None + self._recall: Optional[RecallList] = None + self._revisions: Optional[RevisionList] = None + self._stores: Optional[StoreList] = None + self._traits: Optional[TraitList] = None + self._trait_groups: Optional[TraitGroupList] = None + + @property + def bulk(self) -> BulkList: + if self._bulk is None: + self._bulk = BulkList(self) + return self._bulk + + @property + def conversation_summaries(self) -> ConversationSummaryList: + if self._conversation_summaries is None: + self._conversation_summaries = ConversationSummaryList(self) + return self._conversation_summaries + + @property + def events(self) -> EventList: + if self._events is None: + self._events = EventList(self) + return self._events + + @property + def identifiers(self) -> IdentifierList: + if self._identifiers is None: + self._identifiers = IdentifierList(self) + return self._identifiers + + @property + def identity_resolution_settings(self) -> IdentityResolutionSettingList: + if self._identity_resolution_settings is None: + self._identity_resolution_settings = IdentityResolutionSettingList(self) + return self._identity_resolution_settings + + @property + def import_(self) -> ImportList: + if self._import_ is None: + self._import_ = ImportList(self) + return self._import_ + + @property + def lookup(self) -> LookupList: + if self._lookup is None: + self._lookup = LookupList(self) + return self._lookup + + @property + def observations(self) -> ObservationList: + if self._observations is None: + self._observations = ObservationList(self) + return self._observations + + @property + def profiles(self) -> ProfileList: + if self._profiles is None: + self._profiles = ProfileList(self) + return self._profiles + + @property + def imports(self) -> ProfileImportList: + if self._imports is None: + self._imports = ProfileImportList(self) + return self._imports + + @property + def recall(self) -> RecallList: + if self._recall is None: + self._recall = RecallList(self) + return self._recall + + @property + def revisions(self) -> RevisionList: + if self._revisions is None: + self._revisions = RevisionList(self) + return self._revisions + + @property + def stores(self) -> StoreList: + if self._stores is None: + self._stores = StoreList(self) + return self._stores + + @property + def traits(self) -> TraitList: + if self._traits is None: + self._traits = TraitList(self) + return self._traits + + @property + def trait_groups(self) -> TraitGroupList: + if self._trait_groups is None: + self._trait_groups = TraitGroupList(self) + return self._trait_groups + + def __repr__(self) -> str: + """ + Provide a friendly representation + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/memory/v1/bulk.py b/twilio/rest/memory/v1/bulk.py new file mode 100644 index 000000000..4ebad7766 --- /dev/null +++ b/twilio/rest/memory/v1/bulk.py @@ -0,0 +1,377 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio Memory API + APIs for managing memory stores, profiles, events, and conversational intelligence capabilities. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from typing import Any, Dict, List, Optional +from twilio.base import values +from twilio.base.api_response import ApiResponse +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 BulkInstance(InstanceResource): + class ProfileData(object): + """ + :ivar traits: Multiple trait groups. + """ + + def __init__(self, payload: Dict[str, Any]): + self.traits: Optional[Dict[str, Dict[str, object]]] = payload.get("traits") + + def to_dict(self): + return { + "traits": self.traits, + } + + class UpdateProfilesBulkRequest(object): + """ + :ivar profiles: + """ + + def __init__(self, payload: Dict[str, Any]): + self.profiles: Optional[List[BulkList.ProfileData]] = payload.get( + "profiles" + ) + + def to_dict(self): + return { + "profiles": [profiles.to_dict() for profiles in self.profiles] + if self.profiles is not None + else None, + } + + """ + :ivar message: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], store_id: Optional[str] = None + ): + super().__init__(version) + + self.message: Optional[str] = payload.get("message") + + self._solution = { + "store_id": store_id or self.store_id, + } + self._context: Optional[BulkContext] = None + + @property + def _proxy(self) -> "BulkContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: BulkContext for this BulkInstance + """ + if self._context is None: + self._context = BulkContext( + self._version, + store_id=self._solution["store_id"], + ) + return self._context + + def update( + self, update_profiles_bulk_request: UpdateProfilesBulkRequest + ) -> "BulkInstance": + """ + Update the BulkInstance + + :param update_profiles_bulk_request: + + :returns: The updated BulkInstance + """ + return self._proxy.update( + update_profiles_bulk_request=update_profiles_bulk_request, + ) + + async def update_async( + self, update_profiles_bulk_request: UpdateProfilesBulkRequest + ) -> "BulkInstance": + """ + Asynchronous coroutine to update the BulkInstance + + :param update_profiles_bulk_request: + + :returns: The updated BulkInstance + """ + return await self._proxy.update_async( + update_profiles_bulk_request=update_profiles_bulk_request, + ) + + def update_with_http_info( + self, update_profiles_bulk_request: UpdateProfilesBulkRequest + ) -> ApiResponse: + """ + Update the BulkInstance with HTTP info + + :param update_profiles_bulk_request: + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.update_with_http_info( + update_profiles_bulk_request=update_profiles_bulk_request, + ) + + async def update_with_http_info_async( + self, update_profiles_bulk_request: UpdateProfilesBulkRequest + ) -> ApiResponse: + """ + Asynchronous coroutine to update the BulkInstance with HTTP info + + :param update_profiles_bulk_request: + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.update_with_http_info_async( + update_profiles_bulk_request=update_profiles_bulk_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 BulkContext(InstanceContext): + class ProfileData(object): + """ + :ivar traits: Multiple trait groups. + """ + + def __init__(self, payload: Dict[str, Any]): + self.traits: Optional[Dict[str, Dict[str, object]]] = payload.get("traits") + + def to_dict(self): + return { + "traits": self.traits, + } + + class UpdateProfilesBulkRequest(object): + """ + :ivar profiles: + """ + + def __init__(self, payload: Dict[str, Any]): + self.profiles: Optional[List[BulkList.ProfileData]] = payload.get( + "profiles" + ) + + def to_dict(self): + return { + "profiles": [profiles.to_dict() for profiles in self.profiles] + if self.profiles is not None + else None, + } + + def __init__(self, version: Version, store_id: str): + """ + Initialize the BulkContext + + :param version: Version that contains the resource + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + """ + super().__init__(version) + + # Path Solution + self._solution = { + "store_id": store_id, + } + self._uri = "/Stores/{store_id}/Profiles/Bulk".format(**self._solution) + + def _update(self, update_profiles_bulk_request: UpdateProfilesBulkRequest) -> tuple: + """ + Internal helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = update_profiles_bulk_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.update_with_response_info( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + def update( + self, update_profiles_bulk_request: UpdateProfilesBulkRequest + ) -> BulkInstance: + """ + Update the BulkInstance + + :param update_profiles_bulk_request: + + :returns: The updated BulkInstance + """ + payload, _, _ = self._update( + update_profiles_bulk_request=update_profiles_bulk_request + ) + return BulkInstance(self._version, payload, store_id=self._solution["store_id"]) + + def update_with_http_info( + self, update_profiles_bulk_request: UpdateProfilesBulkRequest + ) -> ApiResponse: + """ + Update the BulkInstance and return response metadata + + :param update_profiles_bulk_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._update( + update_profiles_bulk_request=update_profiles_bulk_request + ) + instance = BulkInstance( + self._version, payload, store_id=self._solution["store_id"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _update_async( + self, update_profiles_bulk_request: UpdateProfilesBulkRequest + ) -> tuple: + """ + Internal async helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = update_profiles_bulk_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.update_with_response_info_async( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + async def update_async( + self, update_profiles_bulk_request: UpdateProfilesBulkRequest + ) -> BulkInstance: + """ + Asynchronous coroutine to update the BulkInstance + + :param update_profiles_bulk_request: + + :returns: The updated BulkInstance + """ + payload, _, _ = await self._update_async( + update_profiles_bulk_request=update_profiles_bulk_request + ) + return BulkInstance(self._version, payload, store_id=self._solution["store_id"]) + + async def update_with_http_info_async( + self, update_profiles_bulk_request: UpdateProfilesBulkRequest + ) -> ApiResponse: + """ + Asynchronous coroutine to update the BulkInstance and return response metadata + + :param update_profiles_bulk_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._update_async( + update_profiles_bulk_request=update_profiles_bulk_request + ) + instance = BulkInstance( + self._version, payload, store_id=self._solution["store_id"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class BulkList(ListResource): + class ProfileData(object): + """ + :ivar traits: Multiple trait groups. + """ + + def __init__(self, payload: Dict[str, Any]): + self.traits: Optional[Dict[str, Dict[str, object]]] = payload.get("traits") + + def to_dict(self): + return { + "traits": self.traits, + } + + class UpdateProfilesBulkRequest(object): + """ + :ivar profiles: + """ + + def __init__(self, payload: Dict[str, Any]): + self.profiles: Optional[List[BulkList.ProfileData]] = payload.get( + "profiles" + ) + + def to_dict(self): + return { + "profiles": [profiles.to_dict() for profiles in self.profiles] + if self.profiles is not None + else None, + } + + def __init__(self, version: Version): + """ + Initialize the BulkList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, store_id: str) -> BulkContext: + """ + Constructs a BulkContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + """ + return BulkContext(self._version, store_id=store_id) + + def __call__(self, store_id: str) -> BulkContext: + """ + Constructs a BulkContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + """ + return BulkContext(self._version, store_id=store_id) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/memory/v1/conversation_summary.py b/twilio/rest/memory/v1/conversation_summary.py new file mode 100644 index 000000000..394122e50 --- /dev/null +++ b/twilio/rest/memory/v1/conversation_summary.py @@ -0,0 +1,749 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio Memory API + APIs for managing memory stores, profiles, events, and conversational intelligence capabilities. + + 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, Protocol +from twilio.base import values +from twilio.base.api_response import ApiResponse +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.token_pagination import TokenPagination + + +class ResponseResource(Protocol): + pass + + +""" +Nested response model for CreateSummariesRequest +""" + + +class CreateSummariesRequest: + def __init__(self, summaries: List["ConversationSummaryList.SummaryCore"]): + self.summaries = summaries + + +""" +Nested response model for SummaryCore +""" + + +class SummaryCore: + def __init__( + self, source: str, content: str, occurredAt: datetime, conversationId: str + ): + self.source = source + self.content = content + self.occurredAt = occurredAt + self.conversationId = conversationId + + +""" +Response model for DeleteProfileConversationSummary_202_response operations +""" + + +class DeleteProfileConversationSummary_202_responseResource: + def __init__(self, message: str): + """ + Initialize the DeleteProfileConversationSummary_202_responseResource + :param message: + + """ + self.message = message + + +""" +Response model for SummaryInfo operations +""" + + +class SummaryInfoResource: + def __init__( + self, + source: str, + content: str, + occurredAt: datetime, + conversationId: str, + id: str, + createdAt: datetime, + updatedAt: datetime, + ): + """ + Initialize the SummaryInfoResource + :param source: The source system that generated the summary. Allows letters, numbers, spaces, and URL-safe symbols. Excludes URL-unsafe characters like quotes, angle brackets, and control characters. + :param content: The main content of the summary. + :param occurredAt: The timestamp when the summary was originally created. + :param conversationId: A unique identifier for the conversation using Twilio Type ID (TTID) format. + :param id: A unique identifier for the summary using Twilio Type ID (TTID) format. + :param createdAt: The timestamp when the summary was created. + :param updatedAt: The timestamp when the summary was last updated. + + """ + self.source = source + self.content = content + self.occurredAt = occurredAt + self.conversationId = conversationId + self.id = id + self.createdAt = createdAt + self.updatedAt = updatedAt + + +""" +Response model for SummariesCreatedResponse operations +""" + + +class SummariesCreatedResponseResource: + def __init__(self, message: str): + """ + Initialize the SummariesCreatedResponseResource + :param message: Confirmation message for the operation. + + """ + self.message = message + + +class ConversationSummaryInstance(InstanceResource): + class CreateSummariesRequest(object): + """ + :ivar summaries: Array of summaries to create in a single batch operation. + """ + + def __init__(self, payload: Dict[str, Any]): + self.summaries: Optional[ + List[ConversationSummaryList.SummaryCore] + ] = payload.get("summaries") + + def to_dict(self): + return { + "summaries": [summaries.to_dict() for summaries in self.summaries] + if self.summaries is not None + else None, + } + + class SummaryCore(object): + """ + :ivar source: The source system that generated the summary. Allows letters, numbers, spaces, and URL-safe symbols. Excludes URL-unsafe characters like quotes, angle brackets, and control characters. + :ivar content: The main content of the summary. + :ivar occurred_at: The timestamp when the summary was originally created. + :ivar conversation_id: A unique identifier for the conversation using Twilio Type ID (TTID) format. + """ + + def __init__(self, payload: Dict[str, Any]): + self.source: Optional[str] = payload.get("source") + self.content: Optional[str] = payload.get("content") + self.occurred_at: Optional[datetime] = payload.get("occurred_at") + self.conversation_id: Optional[str] = payload.get("conversation_id") + + def to_dict(self): + return { + "source": self.source, + "content": self.content, + "occurred_at": self.occurred_at, + "conversation_id": self.conversation_id, + } + + """ + :ivar message: Confirmation message for the operation. + """ + + def __init__( + self, + version: Version, + payload: ResponseResource, + store_id: Optional[str] = None, + profile_id: Optional[str] = None, + ): + super().__init__(version) + + self.message: Optional[str] = payload.get("message") + + self._solution = { + "store_id": store_id or self.store_id, + "profile_id": profile_id or self.profile_id, + } + self._context: Optional[ConversationSummaryContext] = None + + @property + def _proxy(self) -> "ConversationSummaryContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: ConversationSummaryContext for this ConversationSummaryInstance + """ + if self._context is None: + self._context = ConversationSummaryContext( + self._version, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + return self._context + + def create( + self, + create_summaries_request: CreateSummariesRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> "ConversationSummaryInstance": + """ + Create the ConversationSummaryInstance + + :param create_summaries_request: + :param accept_encoding: Compression algorithms supported by the client (e.g., gzip, deflate, br) + :param content_encoding: Compression algorithm used for the request body (e.g., gzip, deflate, br) + + :returns: The created ConversationSummaryInstance + """ + return self._proxy.create( + create_summaries_request, + accept_encoding=accept_encoding, + content_encoding=content_encoding, + ) + + async def create_async( + self, + create_summaries_request: CreateSummariesRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> "ConversationSummaryInstance": + """ + Asynchronous coroutine to create the ConversationSummaryInstance + + :param create_summaries_request: + :param accept_encoding: Compression algorithms supported by the client (e.g., gzip, deflate, br) + :param content_encoding: Compression algorithm used for the request body (e.g., gzip, deflate, br) + + :returns: The created ConversationSummaryInstance + """ + return await self._proxy.create_async( + create_summaries_request, + accept_encoding=accept_encoding, + content_encoding=content_encoding, + ) + + def create_with_http_info( + self, + create_summaries_request: CreateSummariesRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Create the ConversationSummaryInstance with HTTP info + + :param create_summaries_request: + :param accept_encoding: Compression algorithms supported by the client (e.g., gzip, deflate, br) + :param content_encoding: Compression algorithm used for the request body (e.g., gzip, deflate, br) + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.create_with_http_info( + create_summaries_request, + accept_encoding=accept_encoding, + content_encoding=content_encoding, + ) + + async def create_with_http_info_async( + self, + create_summaries_request: CreateSummariesRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to create the ConversationSummaryInstance with HTTP info + + :param create_summaries_request: + :param accept_encoding: Compression algorithms supported by the client (e.g., gzip, deflate, br) + :param content_encoding: Compression algorithm used for the request body (e.g., gzip, deflate, br) + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.create_with_http_info_async( + create_summaries_request, + accept_encoding=accept_encoding, + content_encoding=content_encoding, + ) + + def delete(self) -> bool: + """ + Deletes the ConversationSummaryInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the ConversationSummaryInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the ConversationSummaryInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return self._proxy.delete_with_http_info() + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the ConversationSummaryInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return await self._proxy.delete_with_http_info_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 ConversationSummaryContext(InstanceContext): + class CreateSummariesRequest(object): + """ + :ivar summaries: Array of summaries to create in a single batch operation. + """ + + def __init__(self, payload: Dict[str, Any]): + self.summaries: Optional[ + List[ConversationSummaryList.SummaryCore] + ] = payload.get("summaries") + + def to_dict(self): + return { + "summaries": [summaries.to_dict() for summaries in self.summaries] + if self.summaries is not None + else None, + } + + class SummaryCore(object): + """ + :ivar source: The source system that generated the summary. Allows letters, numbers, spaces, and URL-safe symbols. Excludes URL-unsafe characters like quotes, angle brackets, and control characters. + :ivar content: The main content of the summary. + :ivar occurred_at: The timestamp when the summary was originally created. + :ivar conversation_id: A unique identifier for the conversation using Twilio Type ID (TTID) format. + """ + + def __init__(self, payload: Dict[str, Any]): + self.source: Optional[str] = payload.get("source") + self.content: Optional[str] = payload.get("content") + self.occurred_at: Optional[datetime] = payload.get("occurred_at") + self.conversation_id: Optional[str] = payload.get("conversation_id") + + def to_dict(self): + return { + "source": self.source, + "content": self.content, + "occurred_at": self.occurred_at, + "conversation_id": self.conversation_id, + } + + def __init__(self, version: Version, store_id: str, profile_id: str): + """ + Initialize the ConversationSummaryContext + + :param version: Version that contains the resource + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + :param profile_id: The unique identifier for the profile using Twilio Type ID (TTID) format. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "store_id": store_id, + "profile_id": profile_id, + } + self._uri = ( + "/Stores/{store_id}/Profiles/{profile_id}/ConversationSummaries".format( + **self._solution + ) + ) + + def _create( + self, + create_summaries_request: CreateSummariesRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = create_summaries_request.to_dict() + + headers = values.of({}) + + if not ( + accept_encoding is values.unset + or (isinstance(accept_encoding, str) and not accept_encoding) + ): + headers["Accept-Encoding"] = accept_encoding + + if not ( + content_encoding is values.unset + or (isinstance(content_encoding, str) and not content_encoding) + ): + headers["Content-Encoding"] = content_encoding + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, + create_summaries_request: CreateSummariesRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> ConversationSummaryInstance: + """ + Create the ConversationSummaryInstance + + :param create_summaries_request: + :param accept_encoding: Compression algorithms supported by the client (e.g., gzip, deflate, br) + :param content_encoding: Compression algorithm used for the request body (e.g., gzip, deflate, br) + + :returns: The created ConversationSummaryInstance + """ + payload, _, _ = self._create( + create_summaries_request=create_summaries_request, + accept_encoding=accept_encoding, + content_encoding=content_encoding, + ) + return ConversationSummaryInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + + def create_with_http_info( + self, + create_summaries_request: CreateSummariesRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Create the ConversationSummaryInstance and return response metadata + + :param create_summaries_request: + :param accept_encoding: Compression algorithms supported by the client (e.g., gzip, deflate, br) + :param content_encoding: Compression algorithm used for the request body (e.g., gzip, deflate, br) + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create( + create_summaries_request=create_summaries_request, + accept_encoding=accept_encoding, + content_encoding=content_encoding, + ) + instance = ConversationSummaryInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async( + self, + create_summaries_request: CreateSummariesRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = create_summaries_request.to_dict() + + headers = values.of({}) + + if not ( + accept_encoding is values.unset + or (isinstance(accept_encoding, str) and not accept_encoding) + ): + headers["Accept-Encoding"] = accept_encoding + + if not ( + content_encoding is values.unset + or (isinstance(content_encoding, str) and not content_encoding) + ): + headers["Content-Encoding"] = content_encoding + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, + create_summaries_request: CreateSummariesRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> ConversationSummaryInstance: + """ + Asynchronous coroutine to create the ConversationSummaryInstance + + :param create_summaries_request: + :param accept_encoding: Compression algorithms supported by the client (e.g., gzip, deflate, br) + :param content_encoding: Compression algorithm used for the request body (e.g., gzip, deflate, br) + + :returns: The created ConversationSummaryInstance + """ + payload, _, _ = await self._create_async( + create_summaries_request=create_summaries_request, + accept_encoding=accept_encoding, + content_encoding=content_encoding, + ) + return ConversationSummaryInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + + async def create_with_http_info_async( + self, + create_summaries_request: CreateSummariesRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to create the ConversationSummaryInstance and return response metadata + + :param create_summaries_request: + :param accept_encoding: Compression algorithms supported by the client (e.g., gzip, deflate, br) + :param content_encoding: Compression algorithm used for the request body (e.g., gzip, deflate, br) + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + create_summaries_request=create_summaries_request, + accept_encoding=accept_encoding, + content_encoding=content_encoding, + ) + instance = ConversationSummaryInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def _delete(self) -> tuple: + """ + Internal helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.delete_with_response_info( + method="DELETE", uri=self._uri, headers=headers + ) + + def delete(self) -> bool: + """ + Deletes the ConversationSummaryInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = self._delete() + return success + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the ConversationSummaryInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = self._delete() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + async def _delete_async(self) -> tuple: + """ + Internal async helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.delete_with_response_info_async( + method="DELETE", uri=self._uri, headers=headers + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the ConversationSummaryInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = await self._delete_async() + return success + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the ConversationSummaryInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = await self._delete_async() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class ConversationSummaryPage(TokenPagination): + def get_instance(self, payload: Dict[str, Any]) -> ConversationSummaryInstance: + """ + Build an instance of ConversationSummaryInstance + + :param payload: Payload response from the API + """ + return ConversationSummaryInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class ConversationSummaryList(ListResource): + class CreateSummariesRequest(object): + """ + :ivar summaries: Array of summaries to create in a single batch operation. + """ + + def __init__(self, payload: Dict[str, Any]): + self.summaries: Optional[ + List[ConversationSummaryList.SummaryCore] + ] = payload.get("summaries") + + def to_dict(self): + return { + "summaries": [summaries.to_dict() for summaries in self.summaries] + if self.summaries is not None + else None, + } + + class SummaryCore(object): + """ + :ivar source: The source system that generated the summary. Allows letters, numbers, spaces, and URL-safe symbols. Excludes URL-unsafe characters like quotes, angle brackets, and control characters. + :ivar content: The main content of the summary. + :ivar occurred_at: The timestamp when the summary was originally created. + :ivar conversation_id: A unique identifier for the conversation using Twilio Type ID (TTID) format. + """ + + def __init__(self, payload: Dict[str, Any]): + self.source: Optional[str] = payload.get("source") + self.content: Optional[str] = payload.get("content") + self.occurred_at: Optional[datetime] = payload.get("occurred_at") + self.conversation_id: Optional[str] = payload.get("conversation_id") + + def to_dict(self): + return { + "source": self.source, + "content": self.content, + "occurred_at": self.occurred_at, + "conversation_id": self.conversation_id, + } + + def __init__(self, version: Version): + """ + Initialize the ConversationSummaryList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, store_id: str, profile_id: str) -> ConversationSummaryContext: + """ + Constructs a ConversationSummaryContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + :param profile_id: The unique identifier for the profile using Twilio Type ID (TTID) format. + """ + return ConversationSummaryContext( + self._version, store_id=store_id, profile_id=profile_id + ) + + def __call__(self, store_id: str, profile_id: str) -> ConversationSummaryContext: + """ + Constructs a ConversationSummaryContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + :param profile_id: The unique identifier for the profile using Twilio Type ID (TTID) format. + """ + return ConversationSummaryContext( + self._version, store_id=store_id, profile_id=profile_id + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/memory/v1/event.py b/twilio/rest/memory/v1/event.py new file mode 100644 index 000000000..5127f9abd --- /dev/null +++ b/twilio/rest/memory/v1/event.py @@ -0,0 +1,625 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio Memory API + APIs for managing memory stores, profiles, events, and conversational intelligence capabilities. + + 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.api_response import ApiResponse +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 EventInstance(InstanceResource): + class CommunicationLifecycleEventRecipient(object): + """ + :ivar address: The recipient's address. Must be a valid address matching the channel type such as E.164 format for phone numbers. + :ivar participant_id: The unique identifier for the recipient participant. + """ + + def __init__(self, payload: Dict[str, Any]): + self.address: Optional[str] = payload.get("address") + self.participant_id: Optional[str] = payload.get("participant_id") + + def to_dict(self): + return { + "address": self.address, + "participant_id": self.participant_id, + } + + class CommunicationLifecycleEventSender(object): + """ + :ivar address: The sender's address. Must be a valid address matching the channel type such as E.164 format for phone numbers. + :ivar participant_id: The unique identifier for the sender participant. + """ + + def __init__(self, payload: Dict[str, Any]): + self.address: Optional[str] = payload.get("address") + self.participant_id: Optional[str] = payload.get("participant_id") + + def to_dict(self): + return { + "address": self.address, + "participant_id": self.participant_id, + } + + class ProfileEventRequest(object): + """ + :ivar type: The type of event being sent. + :ivar events: + """ + + def __init__(self, payload: Dict[str, Any]): + self.type: Optional["EventInstance.str"] = payload.get("type") + self.events: Optional[ + List[EventList.ProfileEventRequestEvents] + ] = payload.get("events") + + def to_dict(self): + return { + "type": self.type, + "events": [events.to_dict() for events in self.events] + if self.events is not None + else None, + } + + class ProfileEventRequestEvents(object): + """ + :ivar timestamp: The time the event occurred in ISO8601 format with millisecond resolution. Defaults to received time if not provided. + :ivar lifecycle: The lifecycle event type of the communication. + :ivar conversation_id: The unique identifier for the conversation. + :ivar communication_id: The unique identifier for the communication. + :ivar communication_type: The communication channel type. + :ivar communication_status: The lifecycle status of the communication. + :ivar direction: The direction of the communication. + :ivar sender: + :ivar recipient: + :ivar error_code: Error code for FAILED communication status. + :ivar error_message: Error message for FAILED communication status. + """ + + def __init__(self, payload: Dict[str, Any]): + self.timestamp: Optional[datetime] = payload.get("timestamp") + self.lifecycle: Optional[str] = payload.get("lifecycle") + self.conversation_id: Optional[str] = payload.get("conversation_id") + self.communication_id: Optional[str] = payload.get("communication_id") + self.communication_type: Optional[str] = payload.get("communication_type") + self.communication_status: Optional[str] = payload.get( + "communication_status" + ) + self.direction: Optional["EventInstance.str"] = payload.get("direction") + self.sender: Optional[ + EventList.CommunicationLifecycleEventSender + ] = payload.get("sender") + self.recipient: Optional[ + EventList.CommunicationLifecycleEventRecipient + ] = payload.get("recipient") + self.error_code: Optional[str] = payload.get("error_code") + self.error_message: Optional[str] = payload.get("error_message") + + def to_dict(self): + return { + "timestamp": self.timestamp, + "lifecycle": self.lifecycle, + "conversation_id": self.conversation_id, + "communication_id": self.communication_id, + "communication_type": self.communication_type, + "communication_status": self.communication_status, + "direction": self.direction, + "sender": self.sender.to_dict() if self.sender is not None else None, + "recipient": self.recipient.to_dict() + if self.recipient is not None + else None, + "error_code": self.error_code, + "error_message": self.error_message, + } + + """ + :ivar message: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + store_id: Optional[str] = None, + profile_id: Optional[str] = None, + ): + super().__init__(version) + + self.message: Optional[str] = payload.get("message") + + self._solution = { + "store_id": store_id or self.store_id, + "profile_id": profile_id or self.profile_id, + } + self._context: Optional[EventContext] = None + + @property + def _proxy(self) -> "EventContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: EventContext for this EventInstance + """ + if self._context is None: + self._context = EventContext( + self._version, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + return self._context + + def create( + self, profile_event_request: Union[ProfileEventRequest, object] = values.unset + ) -> "EventInstance": + """ + Create the EventInstance + + :param profile_event_request: + + :returns: The created EventInstance + """ + return self._proxy.create( + profile_event_request=profile_event_request, + ) + + async def create_async( + self, profile_event_request: Union[ProfileEventRequest, object] = values.unset + ) -> "EventInstance": + """ + Asynchronous coroutine to create the EventInstance + + :param profile_event_request: + + :returns: The created EventInstance + """ + return await self._proxy.create_async( + profile_event_request=profile_event_request, + ) + + def create_with_http_info( + self, profile_event_request: Union[ProfileEventRequest, object] = values.unset + ) -> ApiResponse: + """ + Create the EventInstance with HTTP info + + :param profile_event_request: + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.create_with_http_info( + profile_event_request=profile_event_request, + ) + + async def create_with_http_info_async( + self, profile_event_request: Union[ProfileEventRequest, object] = values.unset + ) -> ApiResponse: + """ + Asynchronous coroutine to create the EventInstance with HTTP info + + :param profile_event_request: + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.create_with_http_info_async( + profile_event_request=profile_event_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 EventContext(InstanceContext): + class CommunicationLifecycleEventRecipient(object): + """ + :ivar address: The recipient's address. Must be a valid address matching the channel type such as E.164 format for phone numbers. + :ivar participant_id: The unique identifier for the recipient participant. + """ + + def __init__(self, payload: Dict[str, Any]): + self.address: Optional[str] = payload.get("address") + self.participant_id: Optional[str] = payload.get("participant_id") + + def to_dict(self): + return { + "address": self.address, + "participant_id": self.participant_id, + } + + class CommunicationLifecycleEventSender(object): + """ + :ivar address: The sender's address. Must be a valid address matching the channel type such as E.164 format for phone numbers. + :ivar participant_id: The unique identifier for the sender participant. + """ + + def __init__(self, payload: Dict[str, Any]): + self.address: Optional[str] = payload.get("address") + self.participant_id: Optional[str] = payload.get("participant_id") + + def to_dict(self): + return { + "address": self.address, + "participant_id": self.participant_id, + } + + class ProfileEventRequest(object): + """ + :ivar type: The type of event being sent. + :ivar events: + """ + + def __init__(self, payload: Dict[str, Any]): + self.type: Optional["EventInstance.str"] = payload.get("type") + self.events: Optional[ + List[EventList.ProfileEventRequestEvents] + ] = payload.get("events") + + def to_dict(self): + return { + "type": self.type, + "events": [events.to_dict() for events in self.events] + if self.events is not None + else None, + } + + class ProfileEventRequestEvents(object): + """ + :ivar timestamp: The time the event occurred in ISO8601 format with millisecond resolution. Defaults to received time if not provided. + :ivar lifecycle: The lifecycle event type of the communication. + :ivar conversation_id: The unique identifier for the conversation. + :ivar communication_id: The unique identifier for the communication. + :ivar communication_type: The communication channel type. + :ivar communication_status: The lifecycle status of the communication. + :ivar direction: The direction of the communication. + :ivar sender: + :ivar recipient: + :ivar error_code: Error code for FAILED communication status. + :ivar error_message: Error message for FAILED communication status. + """ + + def __init__(self, payload: Dict[str, Any]): + self.timestamp: Optional[datetime] = payload.get("timestamp") + self.lifecycle: Optional[str] = payload.get("lifecycle") + self.conversation_id: Optional[str] = payload.get("conversation_id") + self.communication_id: Optional[str] = payload.get("communication_id") + self.communication_type: Optional[str] = payload.get("communication_type") + self.communication_status: Optional[str] = payload.get( + "communication_status" + ) + self.direction: Optional["EventInstance.str"] = payload.get("direction") + self.sender: Optional[ + EventList.CommunicationLifecycleEventSender + ] = payload.get("sender") + self.recipient: Optional[ + EventList.CommunicationLifecycleEventRecipient + ] = payload.get("recipient") + self.error_code: Optional[str] = payload.get("error_code") + self.error_message: Optional[str] = payload.get("error_message") + + def to_dict(self): + return { + "timestamp": self.timestamp, + "lifecycle": self.lifecycle, + "conversation_id": self.conversation_id, + "communication_id": self.communication_id, + "communication_type": self.communication_type, + "communication_status": self.communication_status, + "direction": self.direction, + "sender": self.sender.to_dict() if self.sender is not None else None, + "recipient": self.recipient.to_dict() + if self.recipient is not None + else None, + "error_code": self.error_code, + "error_message": self.error_message, + } + + def __init__(self, version: Version, store_id: str, profile_id: str): + """ + Initialize the EventContext + + :param version: Version that contains the resource + :param store_id: The storeId identifier + :param profile_id: The profileId identifier + """ + super().__init__(version) + + # Path Solution + self._solution = { + "store_id": store_id, + "profile_id": profile_id, + } + self._uri = "/Stores/{store_id}/Profiles/{profile_id}/Events".format( + **self._solution + ) + + def _create( + self, profile_event_request: Union[ProfileEventRequest, object] = values.unset + ) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = profile_event_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, profile_event_request: Union[ProfileEventRequest, object] = values.unset + ) -> EventInstance: + """ + Create the EventInstance + + :param profile_event_request: + + :returns: The created EventInstance + """ + payload, _, _ = self._create(profile_event_request=profile_event_request) + return EventInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + + def create_with_http_info( + self, profile_event_request: Union[ProfileEventRequest, object] = values.unset + ) -> ApiResponse: + """ + Create the EventInstance and return response metadata + + :param profile_event_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create( + profile_event_request=profile_event_request + ) + instance = EventInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async( + self, profile_event_request: Union[ProfileEventRequest, object] = values.unset + ) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = profile_event_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, profile_event_request: Union[ProfileEventRequest, object] = values.unset + ) -> EventInstance: + """ + Asynchronous coroutine to create the EventInstance + + :param profile_event_request: + + :returns: The created EventInstance + """ + payload, _, _ = await self._create_async( + profile_event_request=profile_event_request + ) + return EventInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + + async def create_with_http_info_async( + self, profile_event_request: Union[ProfileEventRequest, object] = values.unset + ) -> ApiResponse: + """ + Asynchronous coroutine to create the EventInstance and return response metadata + + :param profile_event_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + profile_event_request=profile_event_request + ) + instance = EventInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class EventList(ListResource): + class CommunicationLifecycleEventRecipient(object): + """ + :ivar address: The recipient's address. Must be a valid address matching the channel type such as E.164 format for phone numbers. + :ivar participant_id: The unique identifier for the recipient participant. + """ + + def __init__(self, payload: Dict[str, Any]): + self.address: Optional[str] = payload.get("address") + self.participant_id: Optional[str] = payload.get("participant_id") + + def to_dict(self): + return { + "address": self.address, + "participant_id": self.participant_id, + } + + class CommunicationLifecycleEventSender(object): + """ + :ivar address: The sender's address. Must be a valid address matching the channel type such as E.164 format for phone numbers. + :ivar participant_id: The unique identifier for the sender participant. + """ + + def __init__(self, payload: Dict[str, Any]): + self.address: Optional[str] = payload.get("address") + self.participant_id: Optional[str] = payload.get("participant_id") + + def to_dict(self): + return { + "address": self.address, + "participant_id": self.participant_id, + } + + class ProfileEventRequest(object): + """ + :ivar type: The type of event being sent. + :ivar events: + """ + + def __init__(self, payload: Dict[str, Any]): + self.type: Optional["EventInstance.str"] = payload.get("type") + self.events: Optional[ + List[EventList.ProfileEventRequestEvents] + ] = payload.get("events") + + def to_dict(self): + return { + "type": self.type, + "events": [events.to_dict() for events in self.events] + if self.events is not None + else None, + } + + class ProfileEventRequestEvents(object): + """ + :ivar timestamp: The time the event occurred in ISO8601 format with millisecond resolution. Defaults to received time if not provided. + :ivar lifecycle: The lifecycle event type of the communication. + :ivar conversation_id: The unique identifier for the conversation. + :ivar communication_id: The unique identifier for the communication. + :ivar communication_type: The communication channel type. + :ivar communication_status: The lifecycle status of the communication. + :ivar direction: The direction of the communication. + :ivar sender: + :ivar recipient: + :ivar error_code: Error code for FAILED communication status. + :ivar error_message: Error message for FAILED communication status. + """ + + def __init__(self, payload: Dict[str, Any]): + self.timestamp: Optional[datetime] = payload.get("timestamp") + self.lifecycle: Optional[str] = payload.get("lifecycle") + self.conversation_id: Optional[str] = payload.get("conversation_id") + self.communication_id: Optional[str] = payload.get("communication_id") + self.communication_type: Optional[str] = payload.get("communication_type") + self.communication_status: Optional[str] = payload.get( + "communication_status" + ) + self.direction: Optional["EventInstance.str"] = payload.get("direction") + self.sender: Optional[ + EventList.CommunicationLifecycleEventSender + ] = payload.get("sender") + self.recipient: Optional[ + EventList.CommunicationLifecycleEventRecipient + ] = payload.get("recipient") + self.error_code: Optional[str] = payload.get("error_code") + self.error_message: Optional[str] = payload.get("error_message") + + def to_dict(self): + return { + "timestamp": self.timestamp, + "lifecycle": self.lifecycle, + "conversation_id": self.conversation_id, + "communication_id": self.communication_id, + "communication_type": self.communication_type, + "communication_status": self.communication_status, + "direction": self.direction, + "sender": self.sender.to_dict() if self.sender is not None else None, + "recipient": self.recipient.to_dict() + if self.recipient is not None + else None, + "error_code": self.error_code, + "error_message": self.error_message, + } + + def __init__(self, version: Version): + """ + Initialize the EventList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, store_id: str, profile_id: str) -> EventContext: + """ + Constructs a EventContext + + :param store_id: The storeId identifier + :param profile_id: The profileId identifier + """ + return EventContext(self._version, store_id=store_id, profile_id=profile_id) + + def __call__(self, store_id: str, profile_id: str) -> EventContext: + """ + Constructs a EventContext + + :param store_id: The storeId identifier + :param profile_id: The profileId identifier + """ + return EventContext(self._version, store_id=store_id, profile_id=profile_id) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/memory/v1/identifier.py b/twilio/rest/memory/v1/identifier.py new file mode 100644 index 000000000..0e0a4c3de --- /dev/null +++ b/twilio/rest/memory/v1/identifier.py @@ -0,0 +1,973 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio Memory API + APIs for managing memory stores, profiles, events, and conversational intelligence capabilities. + + 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, Protocol +from twilio.base import serialize, values +from twilio.base.api_response import ApiResponse +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.token_pagination import TokenPagination + + +class ResponseResource(Protocol): + pass + + +""" +Nested response model for Identifier +""" + + +class Identifier: + def __init__(self, idType: str, value: str): + self.idType = idType + self.value = value + + +""" +Nested response model for IdentifierUpdate +""" + + +class IdentifierUpdate: + def __init__(self, idType: str, oldValue: str, newValue: str): + self.idType = idType + self.oldValue = oldValue + self.newValue = newValue + + +""" +Response model for CreateProfileIdentifier_202_response operations +""" + + +class CreateProfileIdentifier_202_responseResource: + def __init__(self, message: str): + """ + Initialize the CreateProfileIdentifier_202_responseResource + :param message: + + """ + self.message = message + + +""" +Response model for UpdateProfileIdentifier_202_response operations +""" + + +class UpdateProfileIdentifier_202_responseResource: + def __init__(self, message: str): + """ + Initialize the UpdateProfileIdentifier_202_responseResource + :param message: + + """ + self.message = message + + +""" +Response model for DeleteProfileIdentifier_202_response operations +""" + + +class DeleteProfileIdentifier_202_responseResource: + def __init__(self, message: str): + """ + Initialize the DeleteProfileIdentifier_202_responseResource + :param message: + + """ + self.message = message + + +""" +Response model for IdentifierSet operations +""" + + +class IdentifierSetResource: + def __init__(self, idType: str, values: List[str]): + """ + Initialize the IdentifierSetResource + :param idType: Identifier type defined in Identity Resolution Settings. + :param values: Server managed collection of stored values for the identifier type. Identifier values are normalized according to the corresponding identifier settings and ordered chronologically. + + """ + self.idType = idType + self.values = values + + +class IdentifierInstance(InstanceResource): + class Identifier(object): + """ + :ivar id_type: Identifier type as configured in the service's Identity Resolution Settings. Must match an `idType` defined in the corresponding identifier settings and must satisfy the same length constraints. + :ivar value: Raw value captured for the identifier. The service may normalize this value according to the `normalization` rule defined in the identifier settings before storage or matching (for example E.164 formatting for phone numbers). + """ + + def __init__(self, payload: Dict[str, Any]): + self.id_type: Optional[str] = payload.get("id_type") + self.value: Optional[str] = payload.get("value") + + def to_dict(self): + return { + "id_type": self.id_type, + "value": self.value, + } + + class IdentifierUpdate(object): + """ + :ivar id_type: The identifier type to update (e.g., email, phone). + :ivar old_value: Existing stored value to replace. + :ivar new_value: New value to store for the identifier. Normalization rules from the corresponding identifier settings apply. + """ + + def __init__(self, payload: Dict[str, Any]): + self.id_type: Optional[str] = payload.get("id_type") + self.old_value: Optional[str] = payload.get("old_value") + self.new_value: Optional[str] = payload.get("new_value") + + def to_dict(self): + return { + "id_type": self.id_type, + "old_value": self.old_value, + "new_value": self.new_value, + } + + """ + :ivar message: + """ + + def __init__( + self, + version: Version, + payload: ResponseResource, + store_id: Optional[str] = None, + profile_id: Optional[str] = None, + id_type: Optional[str] = None, + ): + super().__init__(version) + + self.message: Optional[str] = payload.get("message") + + self._solution = { + "store_id": store_id or self.store_id, + "profile_id": profile_id or self.profile_id, + "id_type": id_type or self.id_type, + } + self._context: Optional[IdentifierContext] = None + + @property + def _proxy(self) -> "IdentifierContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: IdentifierContext for this IdentifierInstance + """ + if self._context is None: + self._context = IdentifierContext( + self._version, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + id_type=self._solution["id_type"], + ) + return self._context + + def create(self, identifier: Identifier) -> "IdentifierInstance": + """ + Create the IdentifierInstance + + :param identifier: + + :returns: The created IdentifierInstance + """ + return self._proxy.create( + identifier, + ) + + async def create_async(self, identifier: Identifier) -> "IdentifierInstance": + """ + Asynchronous coroutine to create the IdentifierInstance + + :param identifier: + + :returns: The created IdentifierInstance + """ + return await self._proxy.create_async( + identifier, + ) + + def create_with_http_info(self, identifier: Identifier) -> ApiResponse: + """ + Create the IdentifierInstance with HTTP info + + :param identifier: + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.create_with_http_info( + identifier, + ) + + async def create_with_http_info_async(self, identifier: Identifier) -> ApiResponse: + """ + Asynchronous coroutine to create the IdentifierInstance with HTTP info + + :param identifier: + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.create_with_http_info_async( + identifier, + ) + + def delete(self, remove_all: Union[bool, object] = values.unset) -> bool: + """ + Deletes the IdentifierInstance + + :param remove_all: When true, removes every stored value for the identifier type in a single operation. Defaults to false. + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete( + remove_all=remove_all, + ) + + async def delete_async( + self, remove_all: Union[bool, object] = values.unset + ) -> bool: + """ + Asynchronous coroutine that deletes the IdentifierInstance + + :param remove_all: When true, removes every stored value for the identifier type in a single operation. Defaults to false. + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async( + remove_all=remove_all, + ) + + def delete_with_http_info( + self, remove_all: Union[bool, object] = values.unset + ) -> ApiResponse: + """ + Deletes the IdentifierInstance with HTTP info + + :param remove_all: When true, removes every stored value for the identifier type in a single operation. Defaults to false. + + :returns: ApiResponse with success boolean, status code, and headers + """ + return self._proxy.delete_with_http_info( + remove_all=remove_all, + ) + + async def delete_with_http_info_async( + self, remove_all: Union[bool, object] = values.unset + ) -> ApiResponse: + """ + Asynchronous coroutine that deletes the IdentifierInstance with HTTP info + + :param remove_all: When true, removes every stored value for the identifier type in a single operation. Defaults to false. + + :returns: ApiResponse with success boolean, status code, and headers + """ + return await self._proxy.delete_with_http_info_async( + remove_all=remove_all, + ) + + def fetch(self) -> "IdentifierInstance": + """ + Fetch the IdentifierInstance + + + :returns: The fetched IdentifierInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "IdentifierInstance": + """ + Asynchronous coroutine to fetch the IdentifierInstance + + + :returns: The fetched IdentifierInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the IdentifierInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the IdentifierInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_async() + + def update(self, identifier_update: IdentifierUpdate) -> "IdentifierInstance": + """ + Update the IdentifierInstance + + :param identifier_update: + + :returns: The updated IdentifierInstance + """ + return self._proxy.update( + identifier_update=identifier_update, + ) + + async def update_async( + self, identifier_update: IdentifierUpdate + ) -> "IdentifierInstance": + """ + Asynchronous coroutine to update the IdentifierInstance + + :param identifier_update: + + :returns: The updated IdentifierInstance + """ + return await self._proxy.update_async( + identifier_update=identifier_update, + ) + + def update_with_http_info(self, identifier_update: IdentifierUpdate) -> ApiResponse: + """ + Update the IdentifierInstance with HTTP info + + :param identifier_update: + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.update_with_http_info( + identifier_update=identifier_update, + ) + + async def update_with_http_info_async( + self, identifier_update: IdentifierUpdate + ) -> ApiResponse: + """ + Asynchronous coroutine to update the IdentifierInstance with HTTP info + + :param identifier_update: + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.update_with_http_info_async( + identifier_update=identifier_update, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class IdentifierContext(InstanceContext): + class Identifier(object): + """ + :ivar id_type: Identifier type as configured in the service's Identity Resolution Settings. Must match an `idType` defined in the corresponding identifier settings and must satisfy the same length constraints. + :ivar value: Raw value captured for the identifier. The service may normalize this value according to the `normalization` rule defined in the identifier settings before storage or matching (for example E.164 formatting for phone numbers). + """ + + def __init__(self, payload: Dict[str, Any]): + self.id_type: Optional[str] = payload.get("id_type") + self.value: Optional[str] = payload.get("value") + + def to_dict(self): + return { + "id_type": self.id_type, + "value": self.value, + } + + class IdentifierUpdate(object): + """ + :ivar id_type: The identifier type to update (e.g., email, phone). + :ivar old_value: Existing stored value to replace. + :ivar new_value: New value to store for the identifier. Normalization rules from the corresponding identifier settings apply. + """ + + def __init__(self, payload: Dict[str, Any]): + self.id_type: Optional[str] = payload.get("id_type") + self.old_value: Optional[str] = payload.get("old_value") + self.new_value: Optional[str] = payload.get("new_value") + + def to_dict(self): + return { + "id_type": self.id_type, + "old_value": self.old_value, + "new_value": self.new_value, + } + + def __init__(self, version: Version, store_id: str, profile_id: str, id_type: str): + """ + Initialize the IdentifierContext + + :param version: Version that contains the resource + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + :param profile_id: The unique identifier for the profile using Twilio Type ID (TTID) format. + :param id_type: Identifier type configured for the service (for example `email`, `phone`, or `externalId`). + """ + super().__init__(version) + + # Path Solution + self._solution = { + "store_id": store_id, + "profile_id": profile_id, + "id_type": id_type, + } + self._uri = ( + "/Stores/{store_id}/Profiles/{profile_id}/Identifiers/{id_type}".format( + **self._solution + ) + ) + + def _create(self, identifier: Identifier) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = identifier.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create(self, identifier: Identifier) -> IdentifierInstance: + """ + Create the IdentifierInstance + + :param identifier: + + :returns: The created IdentifierInstance + """ + payload, _, _ = self._create(identifier=identifier) + return IdentifierInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + id_type=self._solution["id_type"], + ) + + def create_with_http_info(self, identifier: Identifier) -> ApiResponse: + """ + Create the IdentifierInstance and return response metadata + + :param identifier: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create(identifier=identifier) + instance = IdentifierInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + id_type=self._solution["id_type"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async(self, identifier: Identifier) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = identifier.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async(self, identifier: Identifier) -> IdentifierInstance: + """ + Asynchronous coroutine to create the IdentifierInstance + + :param identifier: + + :returns: The created IdentifierInstance + """ + payload, _, _ = await self._create_async(identifier=identifier) + return IdentifierInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + id_type=self._solution["id_type"], + ) + + async def create_with_http_info_async(self, identifier: Identifier) -> ApiResponse: + """ + Asynchronous coroutine to create the IdentifierInstance and return response metadata + + :param identifier: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async(identifier=identifier) + instance = IdentifierInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + id_type=self._solution["id_type"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def _delete(self, remove_all: Union[bool, object] = values.unset) -> tuple: + """ + Internal helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + params = values.of( + { + "removeAll": serialize.boolean_to_string(remove_all), + } + ) + + return self._version.delete_with_response_info( + method="DELETE", uri=self._uri, headers=headers, params=params + ) + + def delete(self, remove_all: Union[bool, object] = values.unset) -> bool: + """ + Deletes the IdentifierInstance + + :param remove_all: When true, removes every stored value for the identifier type in a single operation. Defaults to false. + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = self._delete(remove_all=remove_all) + return success + + def delete_with_http_info( + self, remove_all: Union[bool, object] = values.unset + ) -> ApiResponse: + """ + Deletes the IdentifierInstance and return response metadata + + :param remove_all: When true, removes every stored value for the identifier type in a single operation. Defaults to false. + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = self._delete(remove_all=remove_all) + return ApiResponse(data=success, status_code=status_code, headers=headers) + + async def _delete_async( + self, remove_all: Union[bool, object] = values.unset + ) -> tuple: + """ + Internal async helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + params = values.of( + { + "removeAll": serialize.boolean_to_string(remove_all), + } + ) + + return await self._version.delete_with_response_info_async( + method="DELETE", uri=self._uri, headers=headers, params=params + ) + + async def delete_async( + self, remove_all: Union[bool, object] = values.unset + ) -> bool: + """ + Asynchronous coroutine that deletes the IdentifierInstance + + :param remove_all: When true, removes every stored value for the identifier type in a single operation. Defaults to false. + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = await self._delete_async(remove_all=remove_all) + return success + + async def delete_with_http_info_async( + self, remove_all: Union[bool, object] = values.unset + ) -> ApiResponse: + """ + Asynchronous coroutine that deletes the IdentifierInstance and return response metadata + + :param remove_all: When true, removes every stored value for the identifier type in a single operation. Defaults to false. + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = await self._delete_async(remove_all=remove_all) + return ApiResponse(data=success, status_code=status_code, headers=headers) + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> IdentifierInstance: + """ + Fetch the IdentifierInstance + + + :returns: The fetched IdentifierInstance + """ + payload, _, _ = self._fetch() + return IdentifierInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + id_type=self._solution["id_type"], + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the IdentifierInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = IdentifierInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + id_type=self._solution["id_type"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> IdentifierInstance: + """ + Asynchronous coroutine to fetch the IdentifierInstance + + + :returns: The fetched IdentifierInstance + """ + payload, _, _ = await self._fetch_async() + return IdentifierInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + id_type=self._solution["id_type"], + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the IdentifierInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = IdentifierInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + id_type=self._solution["id_type"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def _update(self, identifier_update: IdentifierUpdate) -> tuple: + """ + Internal helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = identifier_update.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.update_with_response_info( + method="PATCH", uri=self._uri, data=data, headers=headers + ) + + def update(self, identifier_update: IdentifierUpdate) -> IdentifierInstance: + """ + Update the IdentifierInstance + + :param identifier_update: + + :returns: The updated IdentifierInstance + """ + payload, _, _ = self._update(identifier_update=identifier_update) + return IdentifierInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + id_type=self._solution["id_type"], + ) + + def update_with_http_info(self, identifier_update: IdentifierUpdate) -> ApiResponse: + """ + Update the IdentifierInstance and return response metadata + + :param identifier_update: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._update( + identifier_update=identifier_update + ) + instance = IdentifierInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + id_type=self._solution["id_type"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _update_async(self, identifier_update: IdentifierUpdate) -> tuple: + """ + Internal async helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = identifier_update.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.update_with_response_info_async( + method="PATCH", uri=self._uri, data=data, headers=headers + ) + + async def update_async( + self, identifier_update: IdentifierUpdate + ) -> IdentifierInstance: + """ + Asynchronous coroutine to update the IdentifierInstance + + :param identifier_update: + + :returns: The updated IdentifierInstance + """ + payload, _, _ = await self._update_async(identifier_update=identifier_update) + return IdentifierInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + id_type=self._solution["id_type"], + ) + + async def update_with_http_info_async( + self, identifier_update: IdentifierUpdate + ) -> ApiResponse: + """ + Asynchronous coroutine to update the IdentifierInstance and return response metadata + + :param identifier_update: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._update_async( + identifier_update=identifier_update + ) + instance = IdentifierInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + id_type=self._solution["id_type"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class IdentifierPage(TokenPagination): + def get_instance(self, payload: Dict[str, Any]) -> IdentifierInstance: + """ + Build an instance of IdentifierInstance + + :param payload: Payload response from the API + """ + return IdentifierInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class IdentifierList(ListResource): + class Identifier(object): + """ + :ivar id_type: Identifier type as configured in the service's Identity Resolution Settings. Must match an `idType` defined in the corresponding identifier settings and must satisfy the same length constraints. + :ivar value: Raw value captured for the identifier. The service may normalize this value according to the `normalization` rule defined in the identifier settings before storage or matching (for example E.164 formatting for phone numbers). + """ + + def __init__(self, payload: Dict[str, Any]): + self.id_type: Optional[str] = payload.get("id_type") + self.value: Optional[str] = payload.get("value") + + def to_dict(self): + return { + "id_type": self.id_type, + "value": self.value, + } + + class IdentifierUpdate(object): + """ + :ivar id_type: The identifier type to update (e.g., email, phone). + :ivar old_value: Existing stored value to replace. + :ivar new_value: New value to store for the identifier. Normalization rules from the corresponding identifier settings apply. + """ + + def __init__(self, payload: Dict[str, Any]): + self.id_type: Optional[str] = payload.get("id_type") + self.old_value: Optional[str] = payload.get("old_value") + self.new_value: Optional[str] = payload.get("new_value") + + def to_dict(self): + return { + "id_type": self.id_type, + "old_value": self.old_value, + "new_value": self.new_value, + } + + def __init__(self, version: Version): + """ + Initialize the IdentifierList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, store_id: str, profile_id: str, id_type: str) -> IdentifierContext: + """ + Constructs a IdentifierContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + :param profile_id: The unique identifier for the profile using Twilio Type ID (TTID) format. + :param id_type: Identifier type configured for the service (for example `email`, `phone`, or `externalId`). + """ + return IdentifierContext( + self._version, store_id=store_id, profile_id=profile_id, id_type=id_type + ) + + def __call__( + self, store_id: str, profile_id: str, id_type: str + ) -> IdentifierContext: + """ + Constructs a IdentifierContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + :param profile_id: The unique identifier for the profile using Twilio Type ID (TTID) format. + :param id_type: Identifier type configured for the service (for example `email`, `phone`, or `externalId`). + """ + return IdentifierContext( + self._version, store_id=store_id, profile_id=profile_id, id_type=id_type + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/memory/v1/identity_resolution_setting.py b/twilio/rest/memory/v1/identity_resolution_setting.py new file mode 100644 index 000000000..7829063a7 --- /dev/null +++ b/twilio/rest/memory/v1/identity_resolution_setting.py @@ -0,0 +1,683 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio Memory API + APIs for managing memory stores, profiles, events, and conversational intelligence capabilities. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from typing import Any, Dict, List, Optional, Union +from twilio.base import deserialize, values +from twilio.base.api_response import ApiResponse +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 IdentityResolutionSettingInstance(InstanceResource): + class IdentifierConfig(object): + """ + :ivar id_type: Name of the identifier to use for identity resolution. Usual values are email, phone, user_id etc. + :ivar matching_algo: The algorithm to use for matching the identifier's value. Possible value are exact or fuzzy Exact will match the identifier exactly, while fuzzy (low precision) will allow for some variations. + :ivar matching_threshold: The threshold as percentage to use for fuzzy matching. A value between 50 and 99. Required for fuzzy algo. + :ivar limit: Maximum number of value to retain for this identifier for a profile. + :ivar limit_policy: Policy to apply when the number of values for the identifier exceeds the limit. The extra values will be removed using either fifo or lifo policy to make them compliant. fifo/lifo will be applied based on the event timestamp of the request that added the identifier. + :ivar enforce_unique: True means only one profile will have the identifier, forcing profiles that share it to merge. False would allow multiple profiles to share the identifier and only merge if there is a matching MatchingRule. + :ivar normalization: Normalization to apply to the identifier value before storing and matching. + """ + + def __init__(self, payload: Dict[str, Any]): + self.id_type: Optional[str] = payload.get("id_type") + self.matching_algo: Optional[ + "IdentityResolutionSettingInstance.str" + ] = payload.get("matching_algo") + self.matching_threshold: Optional[int] = payload.get("matching_threshold") + self.limit: Optional[int] = payload.get("limit") + self.limit_policy: Optional[ + "IdentityResolutionSettingInstance.str" + ] = payload.get("limit_policy") + self.enforce_unique: Optional[bool] = payload.get("enforce_unique") + self.normalization: Optional[ + "IdentityResolutionSettingInstance.str" + ] = payload.get("normalization") + + def to_dict(self): + return { + "id_type": self.id_type, + "matching_algo": self.matching_algo, + "matching_threshold": self.matching_threshold, + "limit": self.limit, + "limit_policy": self.limit_policy, + "enforce_unique": self.enforce_unique, + "normalization": self.normalization, + } + + class IdentityResolutionSettingsCore(object): + """ + :ivar identifier_configs: List of identifier, traits to use as identifiers for identity resolution. + :ivar matching_rules: List of rules to apply to match identifiers for new profile updates against existing profiles (if any). Rules are evaluated in the exact order specified in this array - the identity resolution algorithm will apply rules sequentially from first to last, and this order is preserved. If no rule matches against existing profiles, a new profile will be created. If a rule matches to a single existing profile, the profile will updated with the new data. If a rule matches to multiple existing profiles, those existing profiles will be merged into a single unique profile updated with the new data. All identifiers should match based on the matching condition (e.g. matchingAlgo) as per the identifierConfigs. + """ + + def __init__(self, payload: Dict[str, Any]): + self.identifier_configs: Optional[ + List[IdentityResolutionSettingList.IdentifierConfig] + ] = payload.get("identifier_configs") + self.matching_rules: Optional[List[str]] = payload.get("matching_rules") + + def to_dict(self): + return { + "identifier_configs": [ + identifier_configs.to_dict() + for identifier_configs in self.identifier_configs + ] + if self.identifier_configs is not None + else None, + "matching_rules": self.matching_rules, + } + + """ + :ivar identifier_configs: List of identifier, traits to use as identifiers for identity resolution. + :ivar matching_rules: List of rules to apply to match identifiers for new profile updates against existing profiles (if any). Rules are evaluated in the exact order specified in this array - the identity resolution algorithm will apply rules sequentially from first to last, and this order is preserved. If no rule matches against existing profiles, a new profile will be created. If a rule matches to a single existing profile, the profile will updated with the new data. If a rule matches to multiple existing profiles, those existing profiles will be merged into a single unique profile updated with the new data. All identifiers should match based on the matching condition (e.g. matchingAlgo) as per the identifierConfigs. + :ivar version: The current version number of the Identity Resolution Settings. Incremented on each successful update. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], store_id: Optional[str] = None + ): + super().__init__(version) + + self.identifier_configs: Optional[List[str]] = payload.get("identifierConfigs") + self.matching_rules: Optional[List[str]] = payload.get("matchingRules") + self.version: Optional[int] = deserialize.integer(payload.get("version")) + + self._solution = { + "store_id": store_id or self.store_id, + } + self._context: Optional[IdentityResolutionSettingContext] = None + + @property + def _proxy(self) -> "IdentityResolutionSettingContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: IdentityResolutionSettingContext for this IdentityResolutionSettingInstance + """ + if self._context is None: + self._context = IdentityResolutionSettingContext( + self._version, + store_id=self._solution["store_id"], + ) + return self._context + + def fetch(self) -> "IdentityResolutionSettingInstance": + """ + Fetch the IdentityResolutionSettingInstance + + + :returns: The fetched IdentityResolutionSettingInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "IdentityResolutionSettingInstance": + """ + Asynchronous coroutine to fetch the IdentityResolutionSettingInstance + + + :returns: The fetched IdentityResolutionSettingInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the IdentityResolutionSettingInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the IdentityResolutionSettingInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_async() + + def update( + self, + identity_resolution_settings_core: IdentityResolutionSettingsCore, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + ) -> "IdentityResolutionSettingInstance": + """ + Update the IdentityResolutionSettingInstance + + :param identity_resolution_settings_core: + :param if_match: Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches one provided, preventing accidental overwrites and responding with 412 Precondition Failed if they don't match. + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + + :returns: The updated IdentityResolutionSettingInstance + """ + return self._proxy.update( + identity_resolution_settings_core=identity_resolution_settings_core, + if_match=if_match, + prefer=prefer, + ) + + async def update_async( + self, + identity_resolution_settings_core: IdentityResolutionSettingsCore, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + ) -> "IdentityResolutionSettingInstance": + """ + Asynchronous coroutine to update the IdentityResolutionSettingInstance + + :param identity_resolution_settings_core: + :param if_match: Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches one provided, preventing accidental overwrites and responding with 412 Precondition Failed if they don't match. + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + + :returns: The updated IdentityResolutionSettingInstance + """ + return await self._proxy.update_async( + identity_resolution_settings_core=identity_resolution_settings_core, + if_match=if_match, + prefer=prefer, + ) + + def update_with_http_info( + self, + identity_resolution_settings_core: IdentityResolutionSettingsCore, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Update the IdentityResolutionSettingInstance with HTTP info + + :param identity_resolution_settings_core: + :param if_match: Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches one provided, preventing accidental overwrites and responding with 412 Precondition Failed if they don't match. + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.update_with_http_info( + identity_resolution_settings_core=identity_resolution_settings_core, + if_match=if_match, + prefer=prefer, + ) + + async def update_with_http_info_async( + self, + identity_resolution_settings_core: IdentityResolutionSettingsCore, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to update the IdentityResolutionSettingInstance with HTTP info + + :param identity_resolution_settings_core: + :param if_match: Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches one provided, preventing accidental overwrites and responding with 412 Precondition Failed if they don't match. + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.update_with_http_info_async( + identity_resolution_settings_core=identity_resolution_settings_core, + if_match=if_match, + prefer=prefer, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class IdentityResolutionSettingContext(InstanceContext): + class IdentifierConfig(object): + """ + :ivar id_type: Name of the identifier to use for identity resolution. Usual values are email, phone, user_id etc. + :ivar matching_algo: The algorithm to use for matching the identifier's value. Possible value are exact or fuzzy Exact will match the identifier exactly, while fuzzy (low precision) will allow for some variations. + :ivar matching_threshold: The threshold as percentage to use for fuzzy matching. A value between 50 and 99. Required for fuzzy algo. + :ivar limit: Maximum number of value to retain for this identifier for a profile. + :ivar limit_policy: Policy to apply when the number of values for the identifier exceeds the limit. The extra values will be removed using either fifo or lifo policy to make them compliant. fifo/lifo will be applied based on the event timestamp of the request that added the identifier. + :ivar enforce_unique: True means only one profile will have the identifier, forcing profiles that share it to merge. False would allow multiple profiles to share the identifier and only merge if there is a matching MatchingRule. + :ivar normalization: Normalization to apply to the identifier value before storing and matching. + """ + + def __init__(self, payload: Dict[str, Any]): + self.id_type: Optional[str] = payload.get("id_type") + self.matching_algo: Optional[ + "IdentityResolutionSettingInstance.str" + ] = payload.get("matching_algo") + self.matching_threshold: Optional[int] = payload.get("matching_threshold") + self.limit: Optional[int] = payload.get("limit") + self.limit_policy: Optional[ + "IdentityResolutionSettingInstance.str" + ] = payload.get("limit_policy") + self.enforce_unique: Optional[bool] = payload.get("enforce_unique") + self.normalization: Optional[ + "IdentityResolutionSettingInstance.str" + ] = payload.get("normalization") + + def to_dict(self): + return { + "id_type": self.id_type, + "matching_algo": self.matching_algo, + "matching_threshold": self.matching_threshold, + "limit": self.limit, + "limit_policy": self.limit_policy, + "enforce_unique": self.enforce_unique, + "normalization": self.normalization, + } + + class IdentityResolutionSettingsCore(object): + """ + :ivar identifier_configs: List of identifier, traits to use as identifiers for identity resolution. + :ivar matching_rules: List of rules to apply to match identifiers for new profile updates against existing profiles (if any). Rules are evaluated in the exact order specified in this array - the identity resolution algorithm will apply rules sequentially from first to last, and this order is preserved. If no rule matches against existing profiles, a new profile will be created. If a rule matches to a single existing profile, the profile will updated with the new data. If a rule matches to multiple existing profiles, those existing profiles will be merged into a single unique profile updated with the new data. All identifiers should match based on the matching condition (e.g. matchingAlgo) as per the identifierConfigs. + """ + + def __init__(self, payload: Dict[str, Any]): + self.identifier_configs: Optional[ + List[IdentityResolutionSettingList.IdentifierConfig] + ] = payload.get("identifier_configs") + self.matching_rules: Optional[List[str]] = payload.get("matching_rules") + + def to_dict(self): + return { + "identifier_configs": [ + identifier_configs.to_dict() + for identifier_configs in self.identifier_configs + ] + if self.identifier_configs is not None + else None, + "matching_rules": self.matching_rules, + } + + def __init__(self, version: Version, store_id: str): + """ + Initialize the IdentityResolutionSettingContext + + :param version: Version that contains the resource + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + """ + super().__init__(version) + + # Path Solution + self._solution = { + "store_id": store_id, + } + self._uri = "/ControlPlane/Stores/{store_id}/IdentityResolutionSettings".format( + **self._solution + ) + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> IdentityResolutionSettingInstance: + """ + Fetch the IdentityResolutionSettingInstance + + + :returns: The fetched IdentityResolutionSettingInstance + """ + payload, _, _ = self._fetch() + return IdentityResolutionSettingInstance( + self._version, + payload, + store_id=self._solution["store_id"], + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the IdentityResolutionSettingInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = IdentityResolutionSettingInstance( + self._version, + payload, + store_id=self._solution["store_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> IdentityResolutionSettingInstance: + """ + Asynchronous coroutine to fetch the IdentityResolutionSettingInstance + + + :returns: The fetched IdentityResolutionSettingInstance + """ + payload, _, _ = await self._fetch_async() + return IdentityResolutionSettingInstance( + self._version, + payload, + store_id=self._solution["store_id"], + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the IdentityResolutionSettingInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = IdentityResolutionSettingInstance( + self._version, + payload, + store_id=self._solution["store_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def _update( + self, + identity_resolution_settings_core: IdentityResolutionSettingsCore, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + ) -> tuple: + """ + Internal helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = identity_resolution_settings_core.to_dict() + + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + if not (prefer is values.unset or (isinstance(prefer, str) and not prefer)): + headers["Prefer"] = prefer + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.update_with_response_info( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + def update( + self, + identity_resolution_settings_core: IdentityResolutionSettingsCore, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + ) -> IdentityResolutionSettingInstance: + """ + Update the IdentityResolutionSettingInstance + + :param identity_resolution_settings_core: + :param if_match: Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches one provided, preventing accidental overwrites and responding with 412 Precondition Failed if they don't match. + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + + :returns: The updated IdentityResolutionSettingInstance + """ + payload, _, _ = self._update( + identity_resolution_settings_core=identity_resolution_settings_core, + if_match=if_match, + prefer=prefer, + ) + return IdentityResolutionSettingInstance( + self._version, payload, store_id=self._solution["store_id"] + ) + + def update_with_http_info( + self, + identity_resolution_settings_core: IdentityResolutionSettingsCore, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Update the IdentityResolutionSettingInstance and return response metadata + + :param identity_resolution_settings_core: + :param if_match: Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches one provided, preventing accidental overwrites and responding with 412 Precondition Failed if they don't match. + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._update( + identity_resolution_settings_core=identity_resolution_settings_core, + if_match=if_match, + prefer=prefer, + ) + instance = IdentityResolutionSettingInstance( + self._version, payload, store_id=self._solution["store_id"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _update_async( + self, + identity_resolution_settings_core: IdentityResolutionSettingsCore, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + ) -> tuple: + """ + Internal async helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = identity_resolution_settings_core.to_dict() + + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + if not (prefer is values.unset or (isinstance(prefer, str) and not prefer)): + headers["Prefer"] = prefer + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.update_with_response_info_async( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + async def update_async( + self, + identity_resolution_settings_core: IdentityResolutionSettingsCore, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + ) -> IdentityResolutionSettingInstance: + """ + Asynchronous coroutine to update the IdentityResolutionSettingInstance + + :param identity_resolution_settings_core: + :param if_match: Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches one provided, preventing accidental overwrites and responding with 412 Precondition Failed if they don't match. + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + + :returns: The updated IdentityResolutionSettingInstance + """ + payload, _, _ = await self._update_async( + identity_resolution_settings_core=identity_resolution_settings_core, + if_match=if_match, + prefer=prefer, + ) + return IdentityResolutionSettingInstance( + self._version, payload, store_id=self._solution["store_id"] + ) + + async def update_with_http_info_async( + self, + identity_resolution_settings_core: IdentityResolutionSettingsCore, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to update the IdentityResolutionSettingInstance and return response metadata + + :param identity_resolution_settings_core: + :param if_match: Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches one provided, preventing accidental overwrites and responding with 412 Precondition Failed if they don't match. + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._update_async( + identity_resolution_settings_core=identity_resolution_settings_core, + if_match=if_match, + prefer=prefer, + ) + instance = IdentityResolutionSettingInstance( + self._version, payload, store_id=self._solution["store_id"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class IdentityResolutionSettingList(ListResource): + class IdentifierConfig(object): + """ + :ivar id_type: Name of the identifier to use for identity resolution. Usual values are email, phone, user_id etc. + :ivar matching_algo: The algorithm to use for matching the identifier's value. Possible value are exact or fuzzy Exact will match the identifier exactly, while fuzzy (low precision) will allow for some variations. + :ivar matching_threshold: The threshold as percentage to use for fuzzy matching. A value between 50 and 99. Required for fuzzy algo. + :ivar limit: Maximum number of value to retain for this identifier for a profile. + :ivar limit_policy: Policy to apply when the number of values for the identifier exceeds the limit. The extra values will be removed using either fifo or lifo policy to make them compliant. fifo/lifo will be applied based on the event timestamp of the request that added the identifier. + :ivar enforce_unique: True means only one profile will have the identifier, forcing profiles that share it to merge. False would allow multiple profiles to share the identifier and only merge if there is a matching MatchingRule. + :ivar normalization: Normalization to apply to the identifier value before storing and matching. + """ + + def __init__(self, payload: Dict[str, Any]): + self.id_type: Optional[str] = payload.get("id_type") + self.matching_algo: Optional[ + "IdentityResolutionSettingInstance.str" + ] = payload.get("matching_algo") + self.matching_threshold: Optional[int] = payload.get("matching_threshold") + self.limit: Optional[int] = payload.get("limit") + self.limit_policy: Optional[ + "IdentityResolutionSettingInstance.str" + ] = payload.get("limit_policy") + self.enforce_unique: Optional[bool] = payload.get("enforce_unique") + self.normalization: Optional[ + "IdentityResolutionSettingInstance.str" + ] = payload.get("normalization") + + def to_dict(self): + return { + "id_type": self.id_type, + "matching_algo": self.matching_algo, + "matching_threshold": self.matching_threshold, + "limit": self.limit, + "limit_policy": self.limit_policy, + "enforce_unique": self.enforce_unique, + "normalization": self.normalization, + } + + class IdentityResolutionSettingsCore(object): + """ + :ivar identifier_configs: List of identifier, traits to use as identifiers for identity resolution. + :ivar matching_rules: List of rules to apply to match identifiers for new profile updates against existing profiles (if any). Rules are evaluated in the exact order specified in this array - the identity resolution algorithm will apply rules sequentially from first to last, and this order is preserved. If no rule matches against existing profiles, a new profile will be created. If a rule matches to a single existing profile, the profile will updated with the new data. If a rule matches to multiple existing profiles, those existing profiles will be merged into a single unique profile updated with the new data. All identifiers should match based on the matching condition (e.g. matchingAlgo) as per the identifierConfigs. + """ + + def __init__(self, payload: Dict[str, Any]): + self.identifier_configs: Optional[ + List[IdentityResolutionSettingList.IdentifierConfig] + ] = payload.get("identifier_configs") + self.matching_rules: Optional[List[str]] = payload.get("matching_rules") + + def to_dict(self): + return { + "identifier_configs": [ + identifier_configs.to_dict() + for identifier_configs in self.identifier_configs + ] + if self.identifier_configs is not None + else None, + "matching_rules": self.matching_rules, + } + + def __init__(self, version: Version): + """ + Initialize the IdentityResolutionSettingList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, store_id: str) -> IdentityResolutionSettingContext: + """ + Constructs a IdentityResolutionSettingContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + """ + return IdentityResolutionSettingContext(self._version, store_id=store_id) + + def __call__(self, store_id: str) -> IdentityResolutionSettingContext: + """ + Constructs a IdentityResolutionSettingContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + """ + return IdentityResolutionSettingContext(self._version, store_id=store_id) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/memory/v1/import_.py b/twilio/rest/memory/v1/import_.py new file mode 100644 index 000000000..05b0c465f --- /dev/null +++ b/twilio/rest/memory/v1/import_.py @@ -0,0 +1,724 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio Memory API + APIs for managing memory stores, profiles, events, and conversational intelligence capabilities. + + 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, Protocol +from twilio.base import values +from twilio.base.api_response import ApiResponse +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.token_pagination import TokenPagination + + +class ResponseResource(Protocol): + pass + + +""" +Nested response model for ColumnMappingItem +""" + + +class ColumnMappingItem: + def __init__(self, columnName: str, traitGroup: str, traitName: str): + self.columnName = columnName + self.traitGroup = traitGroup + self.traitName = traitName + + +""" +Nested response model for CreateProfilesImportRequest +""" + + +class CreateProfilesImportRequest: + def __init__( + self, + filename: str, + fileSize: int, + columnMappings: List["ImportList.ColumnMappingItem"], + ): + self.filename = filename + self.fileSize = fileSize + self.columnMappings = columnMappings + + +""" +Nested response model for FetchProfileImport200ResponseSummary +""" + + +class FetchProfileImport200ResponseSummary: + def __init__(self, errors: int, warnings: int): + self.errors = errors + self.warnings = warnings + + +""" +Response model for CreateProfilesImport_201_response operations +""" + + +class CreateProfilesImport_201_responseResource: + def __init__(self, importId: str, url: str): + """ + Initialize the CreateProfilesImport_201_responseResource + :param importId: ID of the import task. + :param url: Pre-signed URL to upload the CSV via a single PUT request. + + """ + self.importId = importId + self.url = url + + +""" +Response model for FetchProfileImport_200_response operations +""" + + +class FetchProfileImport_200_responseResource: + def __init__( + self, + status: str, + filename: str, + createdAt: datetime, + updatedAt: datetime, + fileSize: int, + columnMappings: List[ColumnMappingItem], + summary: FetchProfileImport200ResponseSummary, + ): + """ + Initialize the FetchProfileImport_200_responseResource + :param status: Current processing status of the import task + :param filename: Original filename of the uploaded CSV + :param createdAt: Timestamp when the import was created + :param updatedAt: Timestamp when the import was last updated + :param fileSize: Size of the uploaded file in bytes + :param columnMappings: Mappings of CSV header columns to traits' fields + :param summary: + + """ + self.status = status + self.filename = filename + self.createdAt = createdAt + self.updatedAt = updatedAt + self.fileSize = fileSize + self.columnMappings = columnMappings + self.summary = summary + + +class ImportInstance(InstanceResource): + class ColumnMappingItem(object): + """ + :ivar column_name: The name of the column in the CSV header + :ivar trait_group: The trait group to which this trait belongs + :ivar trait_name: The name of the trait in the trait group + """ + + def __init__(self, payload: Dict[str, Any]): + self.column_name: Optional[str] = payload.get("column_name") + self.trait_group: Optional[str] = payload.get("trait_group") + self.trait_name: Optional[str] = payload.get("trait_name") + + def to_dict(self): + return { + "column_name": self.column_name, + "trait_group": self.trait_group, + "trait_name": self.trait_name, + } + + class CreateProfilesImportRequest(object): + """ + :ivar filename: The name of the file to generate a presigned URL + :ivar file_size: The size of the file in bytes (1 byte to 100 MiB) + :ivar column_mappings: Mappings of CSV header columns to traits' fields + """ + + def __init__(self, payload: Dict[str, Any]): + self.filename: Optional[str] = payload.get("filename") + self.file_size: Optional[int] = payload.get("file_size") + self.column_mappings: Optional[ + List[ImportList.ColumnMappingItem] + ] = payload.get("column_mappings") + + def to_dict(self): + return { + "filename": self.filename, + "file_size": self.file_size, + "column_mappings": [ + column_mappings.to_dict() + for column_mappings in self.column_mappings + ] + if self.column_mappings is not None + else None, + } + + class FetchProfileImport200ResponseSummary(object): + """ + :ivar errors: Total count of errors encountered during import + :ivar warnings: Total count of warnings encountered during import + """ + + def __init__(self, payload: Dict[str, Any]): + self.errors: Optional[int] = payload.get("errors") + self.warnings: Optional[int] = payload.get("warnings") + + def to_dict(self): + return { + "": self.errors, + "": self.warnings, + } + + """ + :ivar import_id: ID of the import task. + :ivar url: Pre-signed URL to upload the CSV via a single PUT request. + """ + + def __init__( + self, + version: Version, + payload: ResponseResource, + store_id: Optional[str] = None, + ): + super().__init__(version) + + self.import_id: Optional[str] = payload.get("importId") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "store_id": store_id or self.store_id, + } + self._context: Optional[ImportContext] = None + + @property + def _proxy(self) -> "ImportContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: ImportContext for this ImportInstance + """ + if self._context is None: + self._context = ImportContext( + self._version, + store_id=self._solution["store_id"], + ) + return self._context + + def create( + self, create_profiles_import_request: CreateProfilesImportRequest + ) -> "ImportInstance": + """ + Create the ImportInstance + + :param create_profiles_import_request: + + :returns: The created ImportInstance + """ + return self._proxy.create( + create_profiles_import_request, + ) + + async def create_async( + self, create_profiles_import_request: CreateProfilesImportRequest + ) -> "ImportInstance": + """ + Asynchronous coroutine to create the ImportInstance + + :param create_profiles_import_request: + + :returns: The created ImportInstance + """ + return await self._proxy.create_async( + create_profiles_import_request, + ) + + def create_with_http_info( + self, create_profiles_import_request: CreateProfilesImportRequest + ) -> ApiResponse: + """ + Create the ImportInstance with HTTP info + + :param create_profiles_import_request: + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.create_with_http_info( + create_profiles_import_request, + ) + + async def create_with_http_info_async( + self, create_profiles_import_request: CreateProfilesImportRequest + ) -> ApiResponse: + """ + Asynchronous coroutine to create the ImportInstance with HTTP info + + :param create_profiles_import_request: + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.create_with_http_info_async( + create_profiles_import_request, + ) + + def fetch(self) -> "ImportInstance": + """ + Fetch the ImportInstance + + + :returns: The fetched ImportInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "ImportInstance": + """ + Asynchronous coroutine to fetch the ImportInstance + + + :returns: The fetched ImportInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the ImportInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the ImportInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_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 ImportContext(InstanceContext): + class ColumnMappingItem(object): + """ + :ivar column_name: The name of the column in the CSV header + :ivar trait_group: The trait group to which this trait belongs + :ivar trait_name: The name of the trait in the trait group + """ + + def __init__(self, payload: Dict[str, Any]): + self.column_name: Optional[str] = payload.get("column_name") + self.trait_group: Optional[str] = payload.get("trait_group") + self.trait_name: Optional[str] = payload.get("trait_name") + + def to_dict(self): + return { + "column_name": self.column_name, + "trait_group": self.trait_group, + "trait_name": self.trait_name, + } + + class CreateProfilesImportRequest(object): + """ + :ivar filename: The name of the file to generate a presigned URL + :ivar file_size: The size of the file in bytes (1 byte to 100 MiB) + :ivar column_mappings: Mappings of CSV header columns to traits' fields + """ + + def __init__(self, payload: Dict[str, Any]): + self.filename: Optional[str] = payload.get("filename") + self.file_size: Optional[int] = payload.get("file_size") + self.column_mappings: Optional[ + List[ImportList.ColumnMappingItem] + ] = payload.get("column_mappings") + + def to_dict(self): + return { + "filename": self.filename, + "file_size": self.file_size, + "column_mappings": [ + column_mappings.to_dict() + for column_mappings in self.column_mappings + ] + if self.column_mappings is not None + else None, + } + + class FetchProfileImport200ResponseSummary(object): + """ + :ivar errors: Total count of errors encountered during import + :ivar warnings: Total count of warnings encountered during import + """ + + def __init__(self, payload: Dict[str, Any]): + self.errors: Optional[int] = payload.get("errors") + self.warnings: Optional[int] = payload.get("warnings") + + def to_dict(self): + return { + "": self.errors, + "": self.warnings, + } + + def __init__(self, version: Version, store_id: str): + """ + Initialize the ImportContext + + :param version: Version that contains the resource + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + """ + super().__init__(version) + + # Path Solution + self._solution = { + "store_id": store_id, + } + self._uri = "/Stores/{store_id}/Profiles/Import".format(**self._solution) + + def _create( + self, create_profiles_import_request: CreateProfilesImportRequest + ) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = create_profiles_import_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, create_profiles_import_request: CreateProfilesImportRequest + ) -> ImportInstance: + """ + Create the ImportInstance + + :param create_profiles_import_request: + + :returns: The created ImportInstance + """ + payload, _, _ = self._create( + create_profiles_import_request=create_profiles_import_request + ) + return ImportInstance( + self._version, payload, store_id=self._solution["store_id"] + ) + + def create_with_http_info( + self, create_profiles_import_request: CreateProfilesImportRequest + ) -> ApiResponse: + """ + Create the ImportInstance and return response metadata + + :param create_profiles_import_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create( + create_profiles_import_request=create_profiles_import_request + ) + instance = ImportInstance( + self._version, payload, store_id=self._solution["store_id"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async( + self, create_profiles_import_request: CreateProfilesImportRequest + ) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = create_profiles_import_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, create_profiles_import_request: CreateProfilesImportRequest + ) -> ImportInstance: + """ + Asynchronous coroutine to create the ImportInstance + + :param create_profiles_import_request: + + :returns: The created ImportInstance + """ + payload, _, _ = await self._create_async( + create_profiles_import_request=create_profiles_import_request + ) + return ImportInstance( + self._version, payload, store_id=self._solution["store_id"] + ) + + async def create_with_http_info_async( + self, create_profiles_import_request: CreateProfilesImportRequest + ) -> ApiResponse: + """ + Asynchronous coroutine to create the ImportInstance and return response metadata + + :param create_profiles_import_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + create_profiles_import_request=create_profiles_import_request + ) + instance = ImportInstance( + self._version, payload, store_id=self._solution["store_id"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> ImportInstance: + """ + Fetch the ImportInstance + + + :returns: The fetched ImportInstance + """ + payload, _, _ = self._fetch() + return ImportInstance( + self._version, + payload, + store_id=self._solution["store_id"], + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the ImportInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = ImportInstance( + self._version, + payload, + store_id=self._solution["store_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> ImportInstance: + """ + Asynchronous coroutine to fetch the ImportInstance + + + :returns: The fetched ImportInstance + """ + payload, _, _ = await self._fetch_async() + return ImportInstance( + self._version, + payload, + store_id=self._solution["store_id"], + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the ImportInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = ImportInstance( + self._version, + payload, + store_id=self._solution["store_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class ImportPage(TokenPagination): + def get_instance(self, payload: Dict[str, Any]) -> ImportInstance: + """ + Build an instance of ImportInstance + + :param payload: Payload response from the API + """ + return ImportInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class ImportList(ListResource): + class ColumnMappingItem(object): + """ + :ivar column_name: The name of the column in the CSV header + :ivar trait_group: The trait group to which this trait belongs + :ivar trait_name: The name of the trait in the trait group + """ + + def __init__(self, payload: Dict[str, Any]): + self.column_name: Optional[str] = payload.get("column_name") + self.trait_group: Optional[str] = payload.get("trait_group") + self.trait_name: Optional[str] = payload.get("trait_name") + + def to_dict(self): + return { + "column_name": self.column_name, + "trait_group": self.trait_group, + "trait_name": self.trait_name, + } + + class CreateProfilesImportRequest(object): + """ + :ivar filename: The name of the file to generate a presigned URL + :ivar file_size: The size of the file in bytes (1 byte to 100 MiB) + :ivar column_mappings: Mappings of CSV header columns to traits' fields + """ + + def __init__(self, payload: Dict[str, Any]): + self.filename: Optional[str] = payload.get("filename") + self.file_size: Optional[int] = payload.get("file_size") + self.column_mappings: Optional[ + List[ImportList.ColumnMappingItem] + ] = payload.get("column_mappings") + + def to_dict(self): + return { + "filename": self.filename, + "file_size": self.file_size, + "column_mappings": [ + column_mappings.to_dict() + for column_mappings in self.column_mappings + ] + if self.column_mappings is not None + else None, + } + + class FetchProfileImport200ResponseSummary(object): + """ + :ivar errors: Total count of errors encountered during import + :ivar warnings: Total count of warnings encountered during import + """ + + def __init__(self, payload: Dict[str, Any]): + self.errors: Optional[int] = payload.get("errors") + self.warnings: Optional[int] = payload.get("warnings") + + def to_dict(self): + return { + "": self.errors, + "": self.warnings, + } + + def __init__(self, version: Version): + """ + Initialize the ImportList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, store_id: str) -> ImportContext: + """ + Constructs a ImportContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + """ + return ImportContext(self._version, store_id=store_id) + + def __call__(self, store_id: str) -> ImportContext: + """ + Constructs a ImportContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + """ + return ImportContext(self._version, store_id=store_id) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/memory/v1/lookup.py b/twilio/rest/memory/v1/lookup.py new file mode 100644 index 000000000..662fc11a9 --- /dev/null +++ b/twilio/rest/memory/v1/lookup.py @@ -0,0 +1,315 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio Memory API + APIs for managing memory stores, profiles, events, and conversational intelligence capabilities. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from typing import Any, Dict, List, Optional +from twilio.base import values +from twilio.base.api_response import ApiResponse +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 LookupInstance(InstanceResource): + class Identifier(object): + """ + :ivar id_type: Identifier type as configured in the service's Identity Resolution Settings. Must match an `idType` defined in the corresponding identifier settings and must satisfy the same length constraints. + :ivar value: Raw value captured for the identifier. The service may normalize this value according to the `normalization` rule defined in the identifier settings before storage or matching (for example E.164 formatting for phone numbers). + """ + + def __init__(self, payload: Dict[str, Any]): + self.id_type: Optional[str] = payload.get("id_type") + self.value: Optional[str] = payload.get("value") + + def to_dict(self): + return { + "id_type": self.id_type, + "value": self.value, + } + + """ + :ivar normalized_value: Identifier value after normalization that was used for the lookup. + :ivar profiles: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], store_id: Optional[str] = None + ): + super().__init__(version) + + self.normalized_value: Optional[str] = payload.get("normalizedValue") + self.profiles: Optional[List[str]] = payload.get("profiles") + + self._solution = { + "store_id": store_id or self.store_id, + } + self._context: Optional[LookupContext] = None + + @property + def _proxy(self) -> "LookupContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: LookupContext for this LookupInstance + """ + if self._context is None: + self._context = LookupContext( + self._version, + store_id=self._solution["store_id"], + ) + return self._context + + def create(self, identifier: Identifier) -> "LookupInstance": + """ + Create the LookupInstance + + :param identifier: + + :returns: The created LookupInstance + """ + return self._proxy.create( + identifier, + ) + + async def create_async(self, identifier: Identifier) -> "LookupInstance": + """ + Asynchronous coroutine to create the LookupInstance + + :param identifier: + + :returns: The created LookupInstance + """ + return await self._proxy.create_async( + identifier, + ) + + def create_with_http_info(self, identifier: Identifier) -> ApiResponse: + """ + Create the LookupInstance with HTTP info + + :param identifier: + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.create_with_http_info( + identifier, + ) + + async def create_with_http_info_async(self, identifier: Identifier) -> ApiResponse: + """ + Asynchronous coroutine to create the LookupInstance with HTTP info + + :param identifier: + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.create_with_http_info_async( + identifier, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class LookupContext(InstanceContext): + class Identifier(object): + """ + :ivar id_type: Identifier type as configured in the service's Identity Resolution Settings. Must match an `idType` defined in the corresponding identifier settings and must satisfy the same length constraints. + :ivar value: Raw value captured for the identifier. The service may normalize this value according to the `normalization` rule defined in the identifier settings before storage or matching (for example E.164 formatting for phone numbers). + """ + + def __init__(self, payload: Dict[str, Any]): + self.id_type: Optional[str] = payload.get("id_type") + self.value: Optional[str] = payload.get("value") + + def to_dict(self): + return { + "id_type": self.id_type, + "value": self.value, + } + + def __init__(self, version: Version, store_id: str): + """ + Initialize the LookupContext + + :param version: Version that contains the resource + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + """ + super().__init__(version) + + # Path Solution + self._solution = { + "store_id": store_id, + } + self._uri = "/Stores/{store_id}/Profiles/Lookup".format(**self._solution) + + def _create(self, identifier: Identifier) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = identifier.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create(self, identifier: Identifier) -> LookupInstance: + """ + Create the LookupInstance + + :param identifier: + + :returns: The created LookupInstance + """ + payload, _, _ = self._create(identifier=identifier) + return LookupInstance( + self._version, payload, store_id=self._solution["store_id"] + ) + + def create_with_http_info(self, identifier: Identifier) -> ApiResponse: + """ + Create the LookupInstance and return response metadata + + :param identifier: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create(identifier=identifier) + instance = LookupInstance( + self._version, payload, store_id=self._solution["store_id"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async(self, identifier: Identifier) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = identifier.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async(self, identifier: Identifier) -> LookupInstance: + """ + Asynchronous coroutine to create the LookupInstance + + :param identifier: + + :returns: The created LookupInstance + """ + payload, _, _ = await self._create_async(identifier=identifier) + return LookupInstance( + self._version, payload, store_id=self._solution["store_id"] + ) + + async def create_with_http_info_async(self, identifier: Identifier) -> ApiResponse: + """ + Asynchronous coroutine to create the LookupInstance and return response metadata + + :param identifier: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async(identifier=identifier) + instance = LookupInstance( + self._version, payload, store_id=self._solution["store_id"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class LookupList(ListResource): + class Identifier(object): + """ + :ivar id_type: Identifier type as configured in the service's Identity Resolution Settings. Must match an `idType` defined in the corresponding identifier settings and must satisfy the same length constraints. + :ivar value: Raw value captured for the identifier. The service may normalize this value according to the `normalization` rule defined in the identifier settings before storage or matching (for example E.164 formatting for phone numbers). + """ + + def __init__(self, payload: Dict[str, Any]): + self.id_type: Optional[str] = payload.get("id_type") + self.value: Optional[str] = payload.get("value") + + def to_dict(self): + return { + "id_type": self.id_type, + "value": self.value, + } + + def __init__(self, version: Version): + """ + Initialize the LookupList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, store_id: str) -> LookupContext: + """ + Constructs a LookupContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + """ + return LookupContext(self._version, store_id=store_id) + + def __call__(self, store_id: str) -> LookupContext: + """ + Constructs a LookupContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + """ + return LookupContext(self._version, store_id=store_id) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/memory/v1/observation.py b/twilio/rest/memory/v1/observation.py new file mode 100644 index 000000000..2dbc4c2a4 --- /dev/null +++ b/twilio/rest/memory/v1/observation.py @@ -0,0 +1,1080 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio Memory API + APIs for managing memory stores, profiles, events, and conversational intelligence capabilities. + + 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, Protocol +from twilio.base import values +from twilio.base.api_response import ApiResponse +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.token_pagination import TokenPagination + + +class ResponseResource(Protocol): + pass + + +""" +Nested response model for CreateObservationsRequest +""" + + +class CreateObservationsRequest: + def __init__(self, observations: List["ObservationList.ObservationCore"]): + self.observations = observations + + +""" +Nested response model for ObservationCore +""" + + +class ObservationCore: + def __init__( + self, + content: str, + occurredAt: datetime, + source: str, + conversationIds: List[str], + ): + self.content = content + self.occurredAt = occurredAt + self.source = source + self.conversationIds = conversationIds + + +""" +Response model for ObservationCreatedResponse operations +""" + + +class ObservationCreatedResponseResource: + def __init__(self, message: str): + """ + Initialize the ObservationCreatedResponseResource + :param message: Confirmation message for the operation. + + """ + self.message = message + + +""" +Response model for TwilioError operations +""" + + +class TwilioErrorResource: + def __init__(self, code: int, message: str, more_info: str, status: int): + """ + Initialize the TwilioErrorResource + :param code: The Twilio error code. + :param message: A human readable message describing the error. + :param more_info: A URL to a [Twilio error directory](https://www.twilio.com/docs/api/errors) page with more information about the error code. + :param status: The HTTP status code for the error. + + """ + self.code = code + self.message = message + self.more_info = more_info + self.status = status + + +""" +Response model for DeleteProfileObservation_202_response operations +""" + + +class DeleteProfileObservation_202_responseResource: + def __init__(self, message: str): + """ + Initialize the DeleteProfileObservation_202_responseResource + :param message: + + """ + self.message = message + + +""" +Response model for UpdateProfileObservation_202_response operations +""" + + +class UpdateProfileObservation_202_responseResource: + def __init__(self, message: str): + """ + Initialize the UpdateProfileObservation_202_responseResource + :param message: + + """ + self.message = message + + +class ObservationInstance(InstanceResource): + class CreateObservationsRequest(object): + """ + :ivar observations: Array of observations to create in a single batch operation. + """ + + def __init__(self, payload: Dict[str, Any]): + self.observations: Optional[ + List[ObservationList.ObservationCore] + ] = payload.get("observations") + + def to_dict(self): + return { + "observations": [ + observations.to_dict() for observations in self.observations + ] + if self.observations is not None + else None, + } + + class ObservationCore(object): + """ + :ivar content: The main content of the observation. + :ivar occurred_at: The timestamp when the observation originally occurred. + :ivar source: The source system that generated this observation. Allows letters, numbers, spaces, and URL-safe symbols. Excludes URL-unsafe characters like quotes, angle brackets, and control characters. + :ivar conversation_ids: Array of conversation IDs associated with this observation. + """ + + def __init__(self, payload: Dict[str, Any]): + self.content: Optional[str] = payload.get("content") + self.occurred_at: Optional[datetime] = payload.get("occurred_at") + self.source: Optional[str] = payload.get("source") + self.conversation_ids: Optional[List[str]] = payload.get("conversation_ids") + + def to_dict(self): + return { + "content": self.content, + "occurred_at": self.occurred_at, + "source": self.source, + "conversation_ids": self.conversation_ids, + } + + """ + :ivar message: Confirmation message for the operation. + """ + + def __init__( + self, + version: Version, + payload: ResponseResource, + store_id: Optional[str] = None, + profile_id: Optional[str] = None, + observation_id: Optional[str] = None, + ): + super().__init__(version) + + self.message: Optional[str] = payload.get("message") + + self._solution = { + "store_id": store_id or self.store_id, + "profile_id": profile_id or self.profile_id, + "observation_id": observation_id or self.observation_id, + } + self._context: Optional[ObservationContext] = None + + @property + def _proxy(self) -> "ObservationContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: ObservationContext for this ObservationInstance + """ + if self._context is None: + self._context = ObservationContext( + self._version, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + observation_id=self._solution["observation_id"], + ) + return self._context + + def create( + self, + create_observations_request: CreateObservationsRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> "ObservationInstance": + """ + Create the ObservationInstance + + :param create_observations_request: + :param accept_encoding: Compression algorithms supported by the client (e.g., gzip, deflate, br) + :param content_encoding: Compression algorithm used for the request body (e.g., gzip, deflate, br) + + :returns: The created ObservationInstance + """ + return self._proxy.create( + create_observations_request, + accept_encoding=accept_encoding, + content_encoding=content_encoding, + ) + + async def create_async( + self, + create_observations_request: CreateObservationsRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> "ObservationInstance": + """ + Asynchronous coroutine to create the ObservationInstance + + :param create_observations_request: + :param accept_encoding: Compression algorithms supported by the client (e.g., gzip, deflate, br) + :param content_encoding: Compression algorithm used for the request body (e.g., gzip, deflate, br) + + :returns: The created ObservationInstance + """ + return await self._proxy.create_async( + create_observations_request, + accept_encoding=accept_encoding, + content_encoding=content_encoding, + ) + + def create_with_http_info( + self, + create_observations_request: CreateObservationsRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Create the ObservationInstance with HTTP info + + :param create_observations_request: + :param accept_encoding: Compression algorithms supported by the client (e.g., gzip, deflate, br) + :param content_encoding: Compression algorithm used for the request body (e.g., gzip, deflate, br) + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.create_with_http_info( + create_observations_request, + accept_encoding=accept_encoding, + content_encoding=content_encoding, + ) + + async def create_with_http_info_async( + self, + create_observations_request: CreateObservationsRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to create the ObservationInstance with HTTP info + + :param create_observations_request: + :param accept_encoding: Compression algorithms supported by the client (e.g., gzip, deflate, br) + :param content_encoding: Compression algorithm used for the request body (e.g., gzip, deflate, br) + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.create_with_http_info_async( + create_observations_request, + accept_encoding=accept_encoding, + content_encoding=content_encoding, + ) + + def delete(self) -> bool: + """ + Deletes the ObservationInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the ObservationInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the ObservationInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return self._proxy.delete_with_http_info() + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the ObservationInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return await self._proxy.delete_with_http_info_async() + + def fetch(self) -> "ObservationInstance": + """ + Fetch the ObservationInstance + + + :returns: The fetched ObservationInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "ObservationInstance": + """ + Asynchronous coroutine to fetch the ObservationInstance + + + :returns: The fetched ObservationInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the ObservationInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the ObservationInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_async() + + def update(self, observation_core: ObservationCore) -> "ObservationInstance": + """ + Update the ObservationInstance + + :param observation_core: + + :returns: The updated ObservationInstance + """ + return self._proxy.update( + observation_core=observation_core, + ) + + async def update_async( + self, observation_core: ObservationCore + ) -> "ObservationInstance": + """ + Asynchronous coroutine to update the ObservationInstance + + :param observation_core: + + :returns: The updated ObservationInstance + """ + return await self._proxy.update_async( + observation_core=observation_core, + ) + + def update_with_http_info(self, observation_core: ObservationCore) -> ApiResponse: + """ + Update the ObservationInstance with HTTP info + + :param observation_core: + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.update_with_http_info( + observation_core=observation_core, + ) + + async def update_with_http_info_async( + self, observation_core: ObservationCore + ) -> ApiResponse: + """ + Asynchronous coroutine to update the ObservationInstance with HTTP info + + :param observation_core: + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.update_with_http_info_async( + observation_core=observation_core, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class ObservationContext(InstanceContext): + class CreateObservationsRequest(object): + """ + :ivar observations: Array of observations to create in a single batch operation. + """ + + def __init__(self, payload: Dict[str, Any]): + self.observations: Optional[ + List[ObservationList.ObservationCore] + ] = payload.get("observations") + + def to_dict(self): + return { + "observations": [ + observations.to_dict() for observations in self.observations + ] + if self.observations is not None + else None, + } + + class ObservationCore(object): + """ + :ivar content: The main content of the observation. + :ivar occurred_at: The timestamp when the observation originally occurred. + :ivar source: The source system that generated this observation. Allows letters, numbers, spaces, and URL-safe symbols. Excludes URL-unsafe characters like quotes, angle brackets, and control characters. + :ivar conversation_ids: Array of conversation IDs associated with this observation. + """ + + def __init__(self, payload: Dict[str, Any]): + self.content: Optional[str] = payload.get("content") + self.occurred_at: Optional[datetime] = payload.get("occurred_at") + self.source: Optional[str] = payload.get("source") + self.conversation_ids: Optional[List[str]] = payload.get("conversation_ids") + + def to_dict(self): + return { + "content": self.content, + "occurred_at": self.occurred_at, + "source": self.source, + "conversation_ids": self.conversation_ids, + } + + def __init__( + self, version: Version, store_id: str, profile_id: str, observation_id: str + ): + """ + Initialize the ObservationContext + + :param version: Version that contains the resource + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + :param profile_id: The unique identifier for the profile using Twilio Type ID (TTID) format. + :param observation_id: The observation ID. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "store_id": store_id, + "profile_id": profile_id, + "observation_id": observation_id, + } + self._uri = "/Stores/{store_id}/Profiles/{profile_id}/Observations/{observation_id}".format( + **self._solution + ) + + def _create( + self, + create_observations_request: CreateObservationsRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = create_observations_request.to_dict() + + headers = values.of({}) + + if not ( + accept_encoding is values.unset + or (isinstance(accept_encoding, str) and not accept_encoding) + ): + headers["Accept-Encoding"] = accept_encoding + + if not ( + content_encoding is values.unset + or (isinstance(content_encoding, str) and not content_encoding) + ): + headers["Content-Encoding"] = content_encoding + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, + create_observations_request: CreateObservationsRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> ObservationInstance: + """ + Create the ObservationInstance + + :param create_observations_request: + :param accept_encoding: Compression algorithms supported by the client (e.g., gzip, deflate, br) + :param content_encoding: Compression algorithm used for the request body (e.g., gzip, deflate, br) + + :returns: The created ObservationInstance + """ + payload, _, _ = self._create( + create_observations_request=create_observations_request, + accept_encoding=accept_encoding, + content_encoding=content_encoding, + ) + return ObservationInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + observation_id=self._solution["observation_id"], + ) + + def create_with_http_info( + self, + create_observations_request: CreateObservationsRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Create the ObservationInstance and return response metadata + + :param create_observations_request: + :param accept_encoding: Compression algorithms supported by the client (e.g., gzip, deflate, br) + :param content_encoding: Compression algorithm used for the request body (e.g., gzip, deflate, br) + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create( + create_observations_request=create_observations_request, + accept_encoding=accept_encoding, + content_encoding=content_encoding, + ) + instance = ObservationInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + observation_id=self._solution["observation_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async( + self, + create_observations_request: CreateObservationsRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = create_observations_request.to_dict() + + headers = values.of({}) + + if not ( + accept_encoding is values.unset + or (isinstance(accept_encoding, str) and not accept_encoding) + ): + headers["Accept-Encoding"] = accept_encoding + + if not ( + content_encoding is values.unset + or (isinstance(content_encoding, str) and not content_encoding) + ): + headers["Content-Encoding"] = content_encoding + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, + create_observations_request: CreateObservationsRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> ObservationInstance: + """ + Asynchronous coroutine to create the ObservationInstance + + :param create_observations_request: + :param accept_encoding: Compression algorithms supported by the client (e.g., gzip, deflate, br) + :param content_encoding: Compression algorithm used for the request body (e.g., gzip, deflate, br) + + :returns: The created ObservationInstance + """ + payload, _, _ = await self._create_async( + create_observations_request=create_observations_request, + accept_encoding=accept_encoding, + content_encoding=content_encoding, + ) + return ObservationInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + observation_id=self._solution["observation_id"], + ) + + async def create_with_http_info_async( + self, + create_observations_request: CreateObservationsRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to create the ObservationInstance and return response metadata + + :param create_observations_request: + :param accept_encoding: Compression algorithms supported by the client (e.g., gzip, deflate, br) + :param content_encoding: Compression algorithm used for the request body (e.g., gzip, deflate, br) + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + create_observations_request=create_observations_request, + accept_encoding=accept_encoding, + content_encoding=content_encoding, + ) + instance = ObservationInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + observation_id=self._solution["observation_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def _delete(self) -> tuple: + """ + Internal helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.delete_with_response_info( + method="DELETE", uri=self._uri, headers=headers + ) + + def delete(self) -> bool: + """ + Deletes the ObservationInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = self._delete() + return success + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the ObservationInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = self._delete() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + async def _delete_async(self) -> tuple: + """ + Internal async helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.delete_with_response_info_async( + method="DELETE", uri=self._uri, headers=headers + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the ObservationInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = await self._delete_async() + return success + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the ObservationInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = await self._delete_async() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> ObservationInstance: + """ + Fetch the ObservationInstance + + + :returns: The fetched ObservationInstance + """ + payload, _, _ = self._fetch() + return ObservationInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + observation_id=self._solution["observation_id"], + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the ObservationInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = ObservationInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + observation_id=self._solution["observation_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> ObservationInstance: + """ + Asynchronous coroutine to fetch the ObservationInstance + + + :returns: The fetched ObservationInstance + """ + payload, _, _ = await self._fetch_async() + return ObservationInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + observation_id=self._solution["observation_id"], + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the ObservationInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = ObservationInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + observation_id=self._solution["observation_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def _update(self, observation_core: ObservationCore) -> tuple: + """ + Internal helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = observation_core.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.update_with_response_info( + method="PATCH", uri=self._uri, data=data, headers=headers + ) + + def update(self, observation_core: ObservationCore) -> ObservationInstance: + """ + Update the ObservationInstance + + :param observation_core: + + :returns: The updated ObservationInstance + """ + payload, _, _ = self._update(observation_core=observation_core) + return ObservationInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + observation_id=self._solution["observation_id"], + ) + + def update_with_http_info(self, observation_core: ObservationCore) -> ApiResponse: + """ + Update the ObservationInstance and return response metadata + + :param observation_core: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._update(observation_core=observation_core) + instance = ObservationInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + observation_id=self._solution["observation_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _update_async(self, observation_core: ObservationCore) -> tuple: + """ + Internal async helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = observation_core.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.update_with_response_info_async( + method="PATCH", uri=self._uri, data=data, headers=headers + ) + + async def update_async( + self, observation_core: ObservationCore + ) -> ObservationInstance: + """ + Asynchronous coroutine to update the ObservationInstance + + :param observation_core: + + :returns: The updated ObservationInstance + """ + payload, _, _ = await self._update_async(observation_core=observation_core) + return ObservationInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + observation_id=self._solution["observation_id"], + ) + + async def update_with_http_info_async( + self, observation_core: ObservationCore + ) -> ApiResponse: + """ + Asynchronous coroutine to update the ObservationInstance and return response metadata + + :param observation_core: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._update_async( + observation_core=observation_core + ) + instance = ObservationInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + observation_id=self._solution["observation_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class ObservationPage(TokenPagination): + def get_instance(self, payload: Dict[str, Any]) -> ObservationInstance: + """ + Build an instance of ObservationInstance + + :param payload: Payload response from the API + """ + return ObservationInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class ObservationList(ListResource): + class CreateObservationsRequest(object): + """ + :ivar observations: Array of observations to create in a single batch operation. + """ + + def __init__(self, payload: Dict[str, Any]): + self.observations: Optional[ + List[ObservationList.ObservationCore] + ] = payload.get("observations") + + def to_dict(self): + return { + "observations": [ + observations.to_dict() for observations in self.observations + ] + if self.observations is not None + else None, + } + + class ObservationCore(object): + """ + :ivar content: The main content of the observation. + :ivar occurred_at: The timestamp when the observation originally occurred. + :ivar source: The source system that generated this observation. Allows letters, numbers, spaces, and URL-safe symbols. Excludes URL-unsafe characters like quotes, angle brackets, and control characters. + :ivar conversation_ids: Array of conversation IDs associated with this observation. + """ + + def __init__(self, payload: Dict[str, Any]): + self.content: Optional[str] = payload.get("content") + self.occurred_at: Optional[datetime] = payload.get("occurred_at") + self.source: Optional[str] = payload.get("source") + self.conversation_ids: Optional[List[str]] = payload.get("conversation_ids") + + def to_dict(self): + return { + "content": self.content, + "occurred_at": self.occurred_at, + "source": self.source, + "conversation_ids": self.conversation_ids, + } + + def __init__(self, version: Version): + """ + Initialize the ObservationList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get( + self, store_id: str, profile_id: str, observation_id: str + ) -> ObservationContext: + """ + Constructs a ObservationContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + :param profile_id: The unique identifier for the profile using Twilio Type ID (TTID) format. + :param observation_id: The observation ID. + """ + return ObservationContext( + self._version, + store_id=store_id, + profile_id=profile_id, + observation_id=observation_id, + ) + + def __call__( + self, store_id: str, profile_id: str, observation_id: str + ) -> ObservationContext: + """ + Constructs a ObservationContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + :param profile_id: The unique identifier for the profile using Twilio Type ID (TTID) format. + :param observation_id: The observation ID. + """ + return ObservationContext( + self._version, + store_id=store_id, + profile_id=profile_id, + observation_id=observation_id, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/memory/v1/profile.py b/twilio/rest/memory/v1/profile.py new file mode 100644 index 000000000..35a5253d0 --- /dev/null +++ b/twilio/rest/memory/v1/profile.py @@ -0,0 +1,927 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio Memory API + APIs for managing memory stores, profiles, events, and conversational intelligence capabilities. + + 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, Protocol +from twilio.base import values +from twilio.base.api_response import ApiResponse +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.token_pagination import TokenPagination + + +class ResponseResource(Protocol): + pass + + +""" +Nested response model for ProfileData +""" + + +class ProfileData: + def __init__(self, traits: Dict[str, Dict[str, object]]): + self.traits = traits + + +""" +Nested response model for ProfilePatch +""" + + +class ProfilePatch: + def __init__(self, traits: Dict[str, Dict[str, object]]): + self.traits = traits + + +""" +Response model for UpdateProfileTraits_202_response operations +""" + + +class UpdateProfileTraits_202_responseResource: + def __init__(self, message: str): + """ + Initialize the UpdateProfileTraits_202_responseResource + :param message: + + """ + self.message = message + + +""" +Response model for DeleteProfile_202_response operations +""" + + +class DeleteProfile_202_responseResource: + def __init__(self, message: str): + """ + Initialize the DeleteProfile_202_responseResource + :param message: + + """ + self.message = message + + +""" +Response model for CreateProfile_202_response operations +""" + + +class CreateProfile_202_responseResource: + def __init__(self, id: str, message: str): + """ + Initialize the CreateProfile_202_responseResource + :param id: The canonical profile ID. + :param message: + + """ + self.id = id + self.message = message + + +""" +Response model for Profile operations +""" + + +class ProfileResource: + def __init__( + self, id: str, createdAt: datetime, traits: Dict[str, Dict[str, object]] + ): + """ + Initialize the ProfileResource + :param id: The canonical profile ID. + :param createdAt: The time the profile was created. + :param traits: Multiple trait groups. + + """ + self.id = id + self.createdAt = createdAt + self.traits = traits + + +class ProfileInstance(InstanceResource): + class ProfileData(object): + """ + :ivar traits: Multiple trait groups. + """ + + def __init__(self, payload: Dict[str, Any]): + self.traits: Optional[Dict[str, Dict[str, object]]] = payload.get("traits") + + def to_dict(self): + return { + "traits": self.traits, + } + + class ProfilePatch(object): + """ + :ivar traits: Multiple trait groups. + """ + + def __init__(self, payload: Dict[str, Any]): + self.traits: Optional[Dict[str, Dict[str, object]]] = payload.get("traits") + + def to_dict(self): + return { + "traits": self.traits, + } + + """ + :ivar id: The canonical profile ID. + :ivar message: + """ + + def __init__( + self, + version: Version, + payload: ResponseResource, + store_id: Optional[str] = None, + profile_id: Optional[str] = None, + ): + super().__init__(version) + + self.id: Optional[str] = payload.get("id") + self.message: Optional[str] = payload.get("message") + + self._solution = { + "store_id": store_id or self.store_id, + "profile_id": profile_id or self.profile_id, + } + self._context: Optional[ProfileContext] = None + + @property + def _proxy(self) -> "ProfileContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: ProfileContext for this ProfileInstance + """ + if self._context is None: + self._context = ProfileContext( + self._version, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + return self._context + + def create(self, profile_data: ProfileData) -> "ProfileInstance": + """ + Create the ProfileInstance + + :param profile_data: + + :returns: The created ProfileInstance + """ + return self._proxy.create( + profile_data, + ) + + async def create_async(self, profile_data: ProfileData) -> "ProfileInstance": + """ + Asynchronous coroutine to create the ProfileInstance + + :param profile_data: + + :returns: The created ProfileInstance + """ + return await self._proxy.create_async( + profile_data, + ) + + def create_with_http_info(self, profile_data: ProfileData) -> ApiResponse: + """ + Create the ProfileInstance with HTTP info + + :param profile_data: + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.create_with_http_info( + profile_data, + ) + + async def create_with_http_info_async( + self, profile_data: ProfileData + ) -> ApiResponse: + """ + Asynchronous coroutine to create the ProfileInstance with HTTP info + + :param profile_data: + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.create_with_http_info_async( + profile_data, + ) + + def delete(self) -> bool: + """ + Deletes the ProfileInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the ProfileInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the ProfileInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return self._proxy.delete_with_http_info() + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the ProfileInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return await self._proxy.delete_with_http_info_async() + + def fetch( + self, trait_groups: Union[str, object] = values.unset + ) -> "ProfileInstance": + """ + Fetch the ProfileInstance + + :param trait_groups: Comma separated list of trait group names to include. + + :returns: The fetched ProfileInstance + """ + return self._proxy.fetch( + trait_groups=trait_groups, + ) + + async def fetch_async( + self, trait_groups: Union[str, object] = values.unset + ) -> "ProfileInstance": + """ + Asynchronous coroutine to fetch the ProfileInstance + + :param trait_groups: Comma separated list of trait group names to include. + + :returns: The fetched ProfileInstance + """ + return await self._proxy.fetch_async( + trait_groups=trait_groups, + ) + + def fetch_with_http_info( + self, trait_groups: Union[str, object] = values.unset + ) -> ApiResponse: + """ + Fetch the ProfileInstance with HTTP info + + :param trait_groups: Comma separated list of trait group names to include. + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info( + trait_groups=trait_groups, + ) + + async def fetch_with_http_info_async( + self, trait_groups: Union[str, object] = values.unset + ) -> ApiResponse: + """ + Asynchronous coroutine to fetch the ProfileInstance with HTTP info + + :param trait_groups: Comma separated list of trait group names to include. + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_async( + trait_groups=trait_groups, + ) + + def update(self, profile_patch: ProfilePatch) -> "ProfileInstance": + """ + Update the ProfileInstance + + :param profile_patch: + + :returns: The updated ProfileInstance + """ + return self._proxy.update( + profile_patch=profile_patch, + ) + + async def update_async(self, profile_patch: ProfilePatch) -> "ProfileInstance": + """ + Asynchronous coroutine to update the ProfileInstance + + :param profile_patch: + + :returns: The updated ProfileInstance + """ + return await self._proxy.update_async( + profile_patch=profile_patch, + ) + + def update_with_http_info(self, profile_patch: ProfilePatch) -> ApiResponse: + """ + Update the ProfileInstance with HTTP info + + :param profile_patch: + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.update_with_http_info( + profile_patch=profile_patch, + ) + + async def update_with_http_info_async( + self, profile_patch: ProfilePatch + ) -> ApiResponse: + """ + Asynchronous coroutine to update the ProfileInstance with HTTP info + + :param profile_patch: + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.update_with_http_info_async( + profile_patch=profile_patch, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class ProfileContext(InstanceContext): + class ProfileData(object): + """ + :ivar traits: Multiple trait groups. + """ + + def __init__(self, payload: Dict[str, Any]): + self.traits: Optional[Dict[str, Dict[str, object]]] = payload.get("traits") + + def to_dict(self): + return { + "traits": self.traits, + } + + class ProfilePatch(object): + """ + :ivar traits: Multiple trait groups. + """ + + def __init__(self, payload: Dict[str, Any]): + self.traits: Optional[Dict[str, Dict[str, object]]] = payload.get("traits") + + def to_dict(self): + return { + "traits": self.traits, + } + + def __init__(self, version: Version, store_id: str, profile_id: str): + """ + Initialize the ProfileContext + + :param version: Version that contains the resource + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + :param profile_id: The unique identifier for the profile using Twilio Type ID (TTID) format. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "store_id": store_id, + "profile_id": profile_id, + } + self._uri = "/Stores/{store_id}/Profiles/{profile_id}".format(**self._solution) + + def _create(self, profile_data: ProfileData) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = profile_data.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create(self, profile_data: ProfileData) -> ProfileInstance: + """ + Create the ProfileInstance + + :param profile_data: + + :returns: The created ProfileInstance + """ + payload, _, _ = self._create(profile_data=profile_data) + return ProfileInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + + def create_with_http_info(self, profile_data: ProfileData) -> ApiResponse: + """ + Create the ProfileInstance and return response metadata + + :param profile_data: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create(profile_data=profile_data) + instance = ProfileInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async(self, profile_data: ProfileData) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = profile_data.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async(self, profile_data: ProfileData) -> ProfileInstance: + """ + Asynchronous coroutine to create the ProfileInstance + + :param profile_data: + + :returns: The created ProfileInstance + """ + payload, _, _ = await self._create_async(profile_data=profile_data) + return ProfileInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + + async def create_with_http_info_async( + self, profile_data: ProfileData + ) -> ApiResponse: + """ + Asynchronous coroutine to create the ProfileInstance and return response metadata + + :param profile_data: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + profile_data=profile_data + ) + instance = ProfileInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def _delete(self) -> tuple: + """ + Internal helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.delete_with_response_info( + method="DELETE", uri=self._uri, headers=headers + ) + + def delete(self) -> bool: + """ + Deletes the ProfileInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = self._delete() + return success + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the ProfileInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = self._delete() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + async def _delete_async(self) -> tuple: + """ + Internal async helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.delete_with_response_info_async( + method="DELETE", uri=self._uri, headers=headers + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the ProfileInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = await self._delete_async() + return success + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the ProfileInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = await self._delete_async() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + def _fetch(self, trait_groups: Union[str, object] = values.unset) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + params = values.of( + { + "traitGroups": trait_groups, + } + ) + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, params=params, headers=headers + ) + + def fetch(self, trait_groups: Union[str, object] = values.unset) -> ProfileInstance: + """ + Fetch the ProfileInstance + + :param trait_groups: Comma separated list of trait group names to include. + + :returns: The fetched ProfileInstance + """ + payload, _, _ = self._fetch(trait_groups=trait_groups) + return ProfileInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + + def fetch_with_http_info( + self, trait_groups: Union[str, object] = values.unset + ) -> ApiResponse: + """ + Fetch the ProfileInstance and return response metadata + + :param trait_groups: Comma separated list of trait group names to include. + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch(trait_groups=trait_groups) + instance = ProfileInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async( + self, trait_groups: Union[str, object] = values.unset + ) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + params = values.of( + { + "traitGroups": trait_groups, + } + ) + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, params=params, headers=headers + ) + + async def fetch_async( + self, trait_groups: Union[str, object] = values.unset + ) -> ProfileInstance: + """ + Asynchronous coroutine to fetch the ProfileInstance + + :param trait_groups: Comma separated list of trait group names to include. + + :returns: The fetched ProfileInstance + """ + payload, _, _ = await self._fetch_async(trait_groups=trait_groups) + return ProfileInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + + async def fetch_with_http_info_async( + self, trait_groups: Union[str, object] = values.unset + ) -> ApiResponse: + """ + Asynchronous coroutine to fetch the ProfileInstance and return response metadata + + :param trait_groups: Comma separated list of trait group names to include. + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async( + trait_groups=trait_groups + ) + instance = ProfileInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def _update(self, profile_patch: ProfilePatch) -> tuple: + """ + Internal helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = profile_patch.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.update_with_response_info( + method="PATCH", uri=self._uri, data=data, headers=headers + ) + + def update(self, profile_patch: ProfilePatch) -> ProfileInstance: + """ + Update the ProfileInstance + + :param profile_patch: + + :returns: The updated ProfileInstance + """ + payload, _, _ = self._update(profile_patch=profile_patch) + return ProfileInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + + def update_with_http_info(self, profile_patch: ProfilePatch) -> ApiResponse: + """ + Update the ProfileInstance and return response metadata + + :param profile_patch: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._update(profile_patch=profile_patch) + instance = ProfileInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _update_async(self, profile_patch: ProfilePatch) -> tuple: + """ + Internal async helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = profile_patch.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.update_with_response_info_async( + method="PATCH", uri=self._uri, data=data, headers=headers + ) + + async def update_async(self, profile_patch: ProfilePatch) -> ProfileInstance: + """ + Asynchronous coroutine to update the ProfileInstance + + :param profile_patch: + + :returns: The updated ProfileInstance + """ + payload, _, _ = await self._update_async(profile_patch=profile_patch) + return ProfileInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + + async def update_with_http_info_async( + self, profile_patch: ProfilePatch + ) -> ApiResponse: + """ + Asynchronous coroutine to update the ProfileInstance and return response metadata + + :param profile_patch: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._update_async( + profile_patch=profile_patch + ) + instance = ProfileInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class ProfilePage(TokenPagination): + def get_instance(self, payload: Dict[str, Any]) -> ProfileInstance: + """ + Build an instance of ProfileInstance + + :param payload: Payload response from the API + """ + return ProfileInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class ProfileList(ListResource): + class ProfileData(object): + """ + :ivar traits: Multiple trait groups. + """ + + def __init__(self, payload: Dict[str, Any]): + self.traits: Optional[Dict[str, Dict[str, object]]] = payload.get("traits") + + def to_dict(self): + return { + "traits": self.traits, + } + + class ProfilePatch(object): + """ + :ivar traits: Multiple trait groups. + """ + + def __init__(self, payload: Dict[str, Any]): + self.traits: Optional[Dict[str, Dict[str, object]]] = payload.get("traits") + + def to_dict(self): + return { + "traits": self.traits, + } + + def __init__(self, version: Version): + """ + Initialize the ProfileList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, store_id: str, profile_id: str) -> ProfileContext: + """ + Constructs a ProfileContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + :param profile_id: The unique identifier for the profile using Twilio Type ID (TTID) format. + """ + return ProfileContext(self._version, store_id=store_id, profile_id=profile_id) + + def __call__(self, store_id: str, profile_id: str) -> ProfileContext: + """ + Constructs a ProfileContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + :param profile_id: The unique identifier for the profile using Twilio Type ID (TTID) format. + """ + return ProfileContext(self._version, store_id=store_id, profile_id=profile_id) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/memory/v1/profile_import.py b/twilio/rest/memory/v1/profile_import.py new file mode 100644 index 000000000..2ce305e37 --- /dev/null +++ b/twilio/rest/memory/v1/profile_import.py @@ -0,0 +1,724 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio Memory API + APIs for managing memory stores, profiles, events, and conversational intelligence capabilities. + + 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, Protocol +from twilio.base import values +from twilio.base.api_response import ApiResponse +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.token_pagination import TokenPagination + + +class ResponseResource(Protocol): + pass + + +""" +Nested response model for ColumnMappingItem +""" + + +class ColumnMappingItem: + def __init__(self, columnName: str, traitGroup: str, traitName: str): + self.columnName = columnName + self.traitGroup = traitGroup + self.traitName = traitName + + +""" +Nested response model for CreateProfilesImportRequest +""" + + +class CreateProfilesImportRequest: + def __init__( + self, + filename: str, + fileSize: int, + columnMappings: List["ImportList.ColumnMappingItem"], + ): + self.filename = filename + self.fileSize = fileSize + self.columnMappings = columnMappings + + +""" +Nested response model for FetchProfileImport200ResponseSummary +""" + + +class FetchProfileImport200ResponseSummary: + def __init__(self, errors: int, warnings: int): + self.errors = errors + self.warnings = warnings + + +""" +Response model for CreateProfilesImport_201_response operations +""" + + +class CreateProfilesImport_201_responseResource: + def __init__(self, importId: str, url: str): + """ + Initialize the CreateProfilesImport_201_responseResource + :param importId: ID of the import task. + :param url: Pre-signed URL to upload the CSV via a single PUT request. + + """ + self.importId = importId + self.url = url + + +""" +Response model for FetchProfileImportV2_200_response operations +""" + + +class FetchProfileImportV2_200_responseResource: + def __init__( + self, + status: str, + filename: str, + createdAt: datetime, + updatedAt: datetime, + fileSize: int, + columnMappings: List[ColumnMappingItem], + summary: FetchProfileImport200ResponseSummary, + ): + """ + Initialize the FetchProfileImportV2_200_responseResource + :param status: Current processing status of the import task + :param filename: Original filename of the uploaded CSV + :param createdAt: Timestamp when the import was created + :param updatedAt: Timestamp when the import was last updated + :param fileSize: Size of the uploaded file in bytes (1 byte to 100 MiB) + :param columnMappings: Mappings of CSV header columns to traits' fields + :param summary: + + """ + self.status = status + self.filename = filename + self.createdAt = createdAt + self.updatedAt = updatedAt + self.fileSize = fileSize + self.columnMappings = columnMappings + self.summary = summary + + +class ProfileImportInstance(InstanceResource): + class ColumnMappingItem(object): + """ + :ivar column_name: The name of the column in the CSV header + :ivar trait_group: The trait group to which this trait belongs + :ivar trait_name: The name of the trait in the trait group + """ + + def __init__(self, payload: Dict[str, Any]): + self.column_name: Optional[str] = payload.get("column_name") + self.trait_group: Optional[str] = payload.get("trait_group") + self.trait_name: Optional[str] = payload.get("trait_name") + + def to_dict(self): + return { + "column_name": self.column_name, + "trait_group": self.trait_group, + "trait_name": self.trait_name, + } + + class CreateProfilesImportRequest(object): + """ + :ivar filename: The name of the file to generate a presigned URL + :ivar file_size: The size of the file in bytes (1 byte to 100 MiB) + :ivar column_mappings: Mappings of CSV header columns to traits' fields + """ + + def __init__(self, payload: Dict[str, Any]): + self.filename: Optional[str] = payload.get("filename") + self.file_size: Optional[int] = payload.get("file_size") + self.column_mappings: Optional[ + List["ImportList.ColumnMappingItem"] + ] = payload.get("column_mappings") + + def to_dict(self): + return { + "filename": self.filename, + "file_size": self.file_size, + "column_mappings": [ + column_mappings.to_dict() + for column_mappings in self.column_mappings + ] + if self.column_mappings is not None + else None, + } + + class FetchProfileImport200ResponseSummary(object): + """ + :ivar errors: Total count of errors encountered during import + :ivar warnings: Total count of warnings encountered during import + """ + + def __init__(self, payload: Dict[str, Any]): + self.errors: Optional[int] = payload.get("errors") + self.warnings: Optional[int] = payload.get("warnings") + + def to_dict(self): + return { + "": self.errors, + "": self.warnings, + } + + """ + :ivar import_id: ID of the import task. + :ivar url: Pre-signed URL to upload the CSV via a single PUT request. + """ + + def __init__( + self, + version: Version, + payload: ResponseResource, + store_id: Optional[str] = None, + ): + super().__init__(version) + + self.import_id: Optional[str] = payload.get("importId") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "store_id": store_id or self.store_id, + } + self._context: Optional[ProfileImportContext] = None + + @property + def _proxy(self) -> "ProfileImportContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: ProfileImportContext for this ProfileImportInstance + """ + if self._context is None: + self._context = ProfileImportContext( + self._version, + store_id=self._solution["store_id"], + ) + return self._context + + def create( + self, create_profiles_import_request: CreateProfilesImportRequest + ) -> "ProfileImportInstance": + """ + Create the ProfileImportInstance + + :param create_profiles_import_request: + + :returns: The created ProfileImportInstance + """ + return self._proxy.create( + create_profiles_import_request, + ) + + async def create_async( + self, create_profiles_import_request: CreateProfilesImportRequest + ) -> "ProfileImportInstance": + """ + Asynchronous coroutine to create the ProfileImportInstance + + :param create_profiles_import_request: + + :returns: The created ProfileImportInstance + """ + return await self._proxy.create_async( + create_profiles_import_request, + ) + + def create_with_http_info( + self, create_profiles_import_request: CreateProfilesImportRequest + ) -> ApiResponse: + """ + Create the ProfileImportInstance with HTTP info + + :param create_profiles_import_request: + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.create_with_http_info( + create_profiles_import_request, + ) + + async def create_with_http_info_async( + self, create_profiles_import_request: CreateProfilesImportRequest + ) -> ApiResponse: + """ + Asynchronous coroutine to create the ProfileImportInstance with HTTP info + + :param create_profiles_import_request: + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.create_with_http_info_async( + create_profiles_import_request, + ) + + def fetch(self) -> "ProfileImportInstance": + """ + Fetch the ProfileImportInstance + + + :returns: The fetched ProfileImportInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "ProfileImportInstance": + """ + Asynchronous coroutine to fetch the ProfileImportInstance + + + :returns: The fetched ProfileImportInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the ProfileImportInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the ProfileImportInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_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 ProfileImportContext(InstanceContext): + class ColumnMappingItem(object): + """ + :ivar column_name: The name of the column in the CSV header + :ivar trait_group: The trait group to which this trait belongs + :ivar trait_name: The name of the trait in the trait group + """ + + def __init__(self, payload: Dict[str, Any]): + self.column_name: Optional[str] = payload.get("column_name") + self.trait_group: Optional[str] = payload.get("trait_group") + self.trait_name: Optional[str] = payload.get("trait_name") + + def to_dict(self): + return { + "column_name": self.column_name, + "trait_group": self.trait_group, + "trait_name": self.trait_name, + } + + class CreateProfilesImportRequest(object): + """ + :ivar filename: The name of the file to generate a presigned URL + :ivar file_size: The size of the file in bytes (1 byte to 100 MiB) + :ivar column_mappings: Mappings of CSV header columns to traits' fields + """ + + def __init__(self, payload: Dict[str, Any]): + self.filename: Optional[str] = payload.get("filename") + self.file_size: Optional[int] = payload.get("file_size") + self.column_mappings: Optional[ + List["ImportList.ColumnMappingItem"] + ] = payload.get("column_mappings") + + def to_dict(self): + return { + "filename": self.filename, + "file_size": self.file_size, + "column_mappings": [ + column_mappings.to_dict() + for column_mappings in self.column_mappings + ] + if self.column_mappings is not None + else None, + } + + class FetchProfileImport200ResponseSummary(object): + """ + :ivar errors: Total count of errors encountered during import + :ivar warnings: Total count of warnings encountered during import + """ + + def __init__(self, payload: Dict[str, Any]): + self.errors: Optional[int] = payload.get("errors") + self.warnings: Optional[int] = payload.get("warnings") + + def to_dict(self): + return { + "": self.errors, + "": self.warnings, + } + + def __init__(self, version: Version, store_id: str): + """ + Initialize the ProfileImportContext + + :param version: Version that contains the resource + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + """ + super().__init__(version) + + # Path Solution + self._solution = { + "store_id": store_id, + } + self._uri = "/Stores/{store_id}/Profiles/Imports".format(**self._solution) + + def _create( + self, create_profiles_import_request: CreateProfilesImportRequest + ) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = create_profiles_import_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, create_profiles_import_request: CreateProfilesImportRequest + ) -> ProfileImportInstance: + """ + Create the ProfileImportInstance + + :param create_profiles_import_request: + + :returns: The created ProfileImportInstance + """ + payload, _, _ = self._create( + create_profiles_import_request=create_profiles_import_request + ) + return ProfileImportInstance( + self._version, payload, store_id=self._solution["store_id"] + ) + + def create_with_http_info( + self, create_profiles_import_request: CreateProfilesImportRequest + ) -> ApiResponse: + """ + Create the ProfileImportInstance and return response metadata + + :param create_profiles_import_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create( + create_profiles_import_request=create_profiles_import_request + ) + instance = ProfileImportInstance( + self._version, payload, store_id=self._solution["store_id"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async( + self, create_profiles_import_request: CreateProfilesImportRequest + ) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = create_profiles_import_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, create_profiles_import_request: CreateProfilesImportRequest + ) -> ProfileImportInstance: + """ + Asynchronous coroutine to create the ProfileImportInstance + + :param create_profiles_import_request: + + :returns: The created ProfileImportInstance + """ + payload, _, _ = await self._create_async( + create_profiles_import_request=create_profiles_import_request + ) + return ProfileImportInstance( + self._version, payload, store_id=self._solution["store_id"] + ) + + async def create_with_http_info_async( + self, create_profiles_import_request: CreateProfilesImportRequest + ) -> ApiResponse: + """ + Asynchronous coroutine to create the ProfileImportInstance and return response metadata + + :param create_profiles_import_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + create_profiles_import_request=create_profiles_import_request + ) + instance = ProfileImportInstance( + self._version, payload, store_id=self._solution["store_id"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> ProfileImportInstance: + """ + Fetch the ProfileImportInstance + + + :returns: The fetched ProfileImportInstance + """ + payload, _, _ = self._fetch() + return ProfileImportInstance( + self._version, + payload, + store_id=self._solution["store_id"], + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the ProfileImportInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = ProfileImportInstance( + self._version, + payload, + store_id=self._solution["store_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> ProfileImportInstance: + """ + Asynchronous coroutine to fetch the ProfileImportInstance + + + :returns: The fetched ProfileImportInstance + """ + payload, _, _ = await self._fetch_async() + return ProfileImportInstance( + self._version, + payload, + store_id=self._solution["store_id"], + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the ProfileImportInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = ProfileImportInstance( + self._version, + payload, + store_id=self._solution["store_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class ProfileImportPage(TokenPagination): + def get_instance(self, payload: Dict[str, Any]) -> ProfileImportInstance: + """ + Build an instance of ProfileImportInstance + + :param payload: Payload response from the API + """ + return ProfileImportInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class ProfileImportList(ListResource): + class ColumnMappingItem(object): + """ + :ivar column_name: The name of the column in the CSV header + :ivar trait_group: The trait group to which this trait belongs + :ivar trait_name: The name of the trait in the trait group + """ + + def __init__(self, payload: Dict[str, Any]): + self.column_name: Optional[str] = payload.get("column_name") + self.trait_group: Optional[str] = payload.get("trait_group") + self.trait_name: Optional[str] = payload.get("trait_name") + + def to_dict(self): + return { + "column_name": self.column_name, + "trait_group": self.trait_group, + "trait_name": self.trait_name, + } + + class CreateProfilesImportRequest(object): + """ + :ivar filename: The name of the file to generate a presigned URL + :ivar file_size: The size of the file in bytes (1 byte to 100 MiB) + :ivar column_mappings: Mappings of CSV header columns to traits' fields + """ + + def __init__(self, payload: Dict[str, Any]): + self.filename: Optional[str] = payload.get("filename") + self.file_size: Optional[int] = payload.get("file_size") + self.column_mappings: Optional[ + List[ImportList.ColumnMappingItem] + ] = payload.get("column_mappings") + + def to_dict(self): + return { + "filename": self.filename, + "file_size": self.file_size, + "column_mappings": [ + column_mappings.to_dict() + for column_mappings in self.column_mappings + ] + if self.column_mappings is not None + else None, + } + + class FetchProfileImport200ResponseSummary(object): + """ + :ivar errors: Total count of errors encountered during import + :ivar warnings: Total count of warnings encountered during import + """ + + def __init__(self, payload: Dict[str, Any]): + self.errors: Optional[int] = payload.get("errors") + self.warnings: Optional[int] = payload.get("warnings") + + def to_dict(self): + return { + "": self.errors, + "": self.warnings, + } + + def __init__(self, version: Version): + """ + Initialize the ProfileImportList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, store_id: str) -> ProfileImportContext: + """ + Constructs a ProfileImportContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + """ + return ProfileImportContext(self._version, store_id=store_id) + + def __call__(self, store_id: str) -> ProfileImportContext: + """ + Constructs a ProfileImportContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + """ + return ProfileImportContext(self._version, store_id=store_id) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/memory/v1/recall.py b/twilio/rest/memory/v1/recall.py new file mode 100644 index 000000000..428a08996 --- /dev/null +++ b/twilio/rest/memory/v1/recall.py @@ -0,0 +1,652 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio Memory API + APIs for managing memory stores, profiles, events, and conversational intelligence capabilities. + + 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.api_response import ApiResponse +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 RecallInstance(InstanceResource): + class CommunicationContent(object): + """ + :ivar text: Primary text content (optional). + """ + + def __init__(self, payload: Dict[str, Any]): + self.text: Optional[str] = payload.get("text") + + def to_dict(self): + return { + "": self.text, + } + + class MemoryRetrievalRequest(object): + """ + :ivar conversation_id: A unique identifier for the conversation using Twilio Type ID (TTID) format. + :ivar query: Hybrid search query for finding relevant memories. Omit to use query expansion to generate query from previous 10 communications in conversation. + :ivar begin_date: Start date for filtering memories (inclusive). + :ivar end_date: End date for filtering memories (exclusive). + :ivar communications_limit: Maximum number of conversational session memories to return. If omitted or set to 0, no session memories will be fetched. + :ivar observations_limit: Maximum number of observation memories to return. If omitted, defaults to 20. If set to 0, no observation memories will be fetched. + :ivar summaries_limit: Maximum number of summary memories to return. If omitted, defaults to 5. If set to 0, no summary memories will be fetched. + :ivar relevance_threshold: Minimum relevance score threshold for observations and summaries to be returned. Only memories with a relevance score greater than or equal to this threshold will be included in the response. + """ + + def __init__(self, payload: Dict[str, Any]): + self.conversation_id: Optional[str] = payload.get("conversation_id") + self.query: Optional[str] = payload.get("query") + self.begin_date: Optional[datetime] = payload.get("begin_date") + self.end_date: Optional[datetime] = payload.get("end_date") + self.communications_limit: Optional[int] = payload.get( + "communications_limit" + ) + self.observations_limit: Optional[int] = payload.get("observations_limit") + self.summaries_limit: Optional[int] = payload.get("summaries_limit") + self.relevance_threshold: Optional[float] = payload.get( + "relevance_threshold" + ) + + def to_dict(self): + return { + "conversation_id": self.conversation_id, + "query": self.query, + "begin_date": self.begin_date, + "end_date": self.end_date, + "communications_limit": self.communications_limit, + "observations_limit": self.observations_limit, + "summaries_limit": self.summaries_limit, + "relevance_threshold": self.relevance_threshold, + } + + class Participant(object): + """ + :ivar id: Participant identifier. + :ivar name: Participant display name + :ivar type: + :ivar profile_id: The canonical profile ID. + :ivar address: Address of the Participant (e.g., phone number, email address) + :ivar channel: The channel on which the message originated + """ + + def __init__(self, payload: Dict[str, Any]): + self.id: Optional[str] = payload.get("id") + self.name: Optional[str] = payload.get("name") + self.type: Optional["ParticipantType"] = payload.get("type") + self.profile_id: Optional[str] = payload.get("profile_id") + self.address: Optional[str] = payload.get("address") + self.channel: Optional[str] = payload.get("channel") + + def to_dict(self): + return { + "": self.id, + "": self.name, + "": self.type.to_dict() if self.type is not None else None, + "": self.profile_id, + "": self.address, + "": self.channel, + } + + class ParticipantType(object): + HUMAN_AGENT = "HUMAN_AGENT" + CUSTOMER = "CUSTOMER" + AI_AGENT = "AI_AGENT" + + """ + :ivar observations: Array of observation memories. + :ivar summaries: Array of summary memories derived from observations at the end of conversations. + :ivar communications: Array of recent communication context. + :ivar meta: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + store_id: Optional[str] = None, + profile_id: Optional[str] = None, + ): + super().__init__(version) + + self.observations: Optional[List[Dict[str, object]]] = payload.get( + "observations" + ) + self.summaries: Optional[List[Dict[str, object]]] = payload.get("summaries") + self.communications: Optional[List[str]] = payload.get("communications") + self.meta: Optional[str] = payload.get("meta") + + self._solution = { + "store_id": store_id or self.store_id, + "profile_id": profile_id or self.profile_id, + } + self._context: Optional[RecallContext] = None + + @property + def _proxy(self) -> "RecallContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: RecallContext for this RecallInstance + """ + if self._context is None: + self._context = RecallContext( + self._version, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + return self._context + + def fetch( + self, + memory_retrieval_request: MemoryRetrievalRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> "RecallInstance": + """ + Fetch the RecallInstance + + :param memory_retrieval_request: + :param accept_encoding: Compression algorithms supported by the client (e.g., gzip, deflate, br) + :param content_encoding: Compression algorithm used for the request body (e.g., gzip, deflate, br) + + :returns: The fetched RecallInstance + """ + return self._proxy.fetch( + memory_retrieval_request=memory_retrieval_request, + accept_encoding=accept_encoding, + content_encoding=content_encoding, + ) + + async def fetch_async( + self, + memory_retrieval_request: MemoryRetrievalRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> "RecallInstance": + """ + Asynchronous coroutine to fetch the RecallInstance + + :param memory_retrieval_request: + :param accept_encoding: Compression algorithms supported by the client (e.g., gzip, deflate, br) + :param content_encoding: Compression algorithm used for the request body (e.g., gzip, deflate, br) + + :returns: The fetched RecallInstance + """ + return await self._proxy.fetch_async( + memory_retrieval_request=memory_retrieval_request, + accept_encoding=accept_encoding, + content_encoding=content_encoding, + ) + + def fetch_with_http_info( + self, + memory_retrieval_request: MemoryRetrievalRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Fetch the RecallInstance with HTTP info + + :param memory_retrieval_request: + :param accept_encoding: Compression algorithms supported by the client (e.g., gzip, deflate, br) + :param content_encoding: Compression algorithm used for the request body (e.g., gzip, deflate, br) + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info( + memory_retrieval_request=memory_retrieval_request, + accept_encoding=accept_encoding, + content_encoding=content_encoding, + ) + + async def fetch_with_http_info_async( + self, + memory_retrieval_request: MemoryRetrievalRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to fetch the RecallInstance with HTTP info + + :param memory_retrieval_request: + :param accept_encoding: Compression algorithms supported by the client (e.g., gzip, deflate, br) + :param content_encoding: Compression algorithm used for the request body (e.g., gzip, deflate, br) + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_async( + memory_retrieval_request=memory_retrieval_request, + accept_encoding=accept_encoding, + content_encoding=content_encoding, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class RecallContext(InstanceContext): + class CommunicationContent(object): + """ + :ivar text: Primary text content (optional). + """ + + def __init__(self, payload: Dict[str, Any]): + self.text: Optional[str] = payload.get("text") + + def to_dict(self): + return { + "": self.text, + } + + class MemoryRetrievalRequest(object): + """ + :ivar conversation_id: A unique identifier for the conversation using Twilio Type ID (TTID) format. + :ivar query: Hybrid search query for finding relevant memories. Omit to use query expansion to generate query from previous 10 communications in conversation. + :ivar begin_date: Start date for filtering memories (inclusive). + :ivar end_date: End date for filtering memories (exclusive). + :ivar communications_limit: Maximum number of conversational session memories to return. If omitted or set to 0, no session memories will be fetched. + :ivar observations_limit: Maximum number of observation memories to return. If omitted, defaults to 20. If set to 0, no observation memories will be fetched. + :ivar summaries_limit: Maximum number of summary memories to return. If omitted, defaults to 5. If set to 0, no summary memories will be fetched. + :ivar relevance_threshold: Minimum relevance score threshold for observations and summaries to be returned. Only memories with a relevance score greater than or equal to this threshold will be included in the response. + """ + + def __init__(self, payload: Dict[str, Any]): + self.conversation_id: Optional[str] = payload.get("conversation_id") + self.query: Optional[str] = payload.get("query") + self.begin_date: Optional[datetime] = payload.get("begin_date") + self.end_date: Optional[datetime] = payload.get("end_date") + self.communications_limit: Optional[int] = payload.get( + "communications_limit" + ) + self.observations_limit: Optional[int] = payload.get("observations_limit") + self.summaries_limit: Optional[int] = payload.get("summaries_limit") + self.relevance_threshold: Optional[float] = payload.get( + "relevance_threshold" + ) + + def to_dict(self): + return { + "conversation_id": self.conversation_id, + "query": self.query, + "begin_date": self.begin_date, + "end_date": self.end_date, + "communications_limit": self.communications_limit, + "observations_limit": self.observations_limit, + "summaries_limit": self.summaries_limit, + "relevance_threshold": self.relevance_threshold, + } + + class Participant(object): + """ + :ivar id: Participant identifier. + :ivar name: Participant display name + :ivar type: + :ivar profile_id: The canonical profile ID. + :ivar address: Address of the Participant (e.g., phone number, email address) + :ivar channel: The channel on which the message originated + """ + + def __init__(self, payload: Dict[str, Any]): + self.id: Optional[str] = payload.get("id") + self.name: Optional[str] = payload.get("name") + self.type: Optional["ParticipantType"] = payload.get("type") + self.profile_id: Optional[str] = payload.get("profile_id") + self.address: Optional[str] = payload.get("address") + self.channel: Optional[str] = payload.get("channel") + + def to_dict(self): + return { + "": self.id, + "": self.name, + "": self.type.to_dict() if self.type is not None else None, + "": self.profile_id, + "": self.address, + "": self.channel, + } + + def __init__(self, version: Version, store_id: str, profile_id: str): + """ + Initialize the RecallContext + + :param version: Version that contains the resource + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + :param profile_id: The unique identifier for the profile using Twilio Type ID (TTID) format. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "store_id": store_id, + "profile_id": profile_id, + } + self._uri = "/Stores/{store_id}/Profiles/{profile_id}/Recall".format( + **self._solution + ) + + def _fetch( + self, + memory_retrieval_request: MemoryRetrievalRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + if not ( + accept_encoding is values.unset + or (isinstance(accept_encoding, str) and not accept_encoding) + ): + headers["Accept-Encoding"] = accept_encoding + + if not ( + content_encoding is values.unset + or (isinstance(content_encoding, str) and not content_encoding) + ): + headers["Content-Encoding"] = content_encoding + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="POST", uri=self._uri, headers=headers + ) + + def fetch( + self, + memory_retrieval_request: MemoryRetrievalRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> RecallInstance: + """ + Fetch the RecallInstance + + :param memory_retrieval_request: + :param accept_encoding: Compression algorithms supported by the client (e.g., gzip, deflate, br) + :param content_encoding: Compression algorithm used for the request body (e.g., gzip, deflate, br) + + :returns: The fetched RecallInstance + """ + payload, _, _ = self._fetch( + memory_retrieval_request=memory_retrieval_request, + accept_encoding=accept_encoding, + content_encoding=content_encoding, + ) + return RecallInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + + def fetch_with_http_info( + self, + memory_retrieval_request: MemoryRetrievalRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Fetch the RecallInstance and return response metadata + + :param memory_retrieval_request: + :param accept_encoding: Compression algorithms supported by the client (e.g., gzip, deflate, br) + :param content_encoding: Compression algorithm used for the request body (e.g., gzip, deflate, br) + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch( + memory_retrieval_request=memory_retrieval_request, + accept_encoding=accept_encoding, + content_encoding=content_encoding, + ) + instance = RecallInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async( + self, + memory_retrieval_request: MemoryRetrievalRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + if not ( + accept_encoding is values.unset + or (isinstance(accept_encoding, str) and not accept_encoding) + ): + headers["Accept-Encoding"] = accept_encoding + + if not ( + content_encoding is values.unset + or (isinstance(content_encoding, str) and not content_encoding) + ): + headers["Content-Encoding"] = content_encoding + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="POST", uri=self._uri, headers=headers + ) + + async def fetch_async( + self, + memory_retrieval_request: MemoryRetrievalRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> RecallInstance: + """ + Asynchronous coroutine to fetch the RecallInstance + + :param memory_retrieval_request: + :param accept_encoding: Compression algorithms supported by the client (e.g., gzip, deflate, br) + :param content_encoding: Compression algorithm used for the request body (e.g., gzip, deflate, br) + + :returns: The fetched RecallInstance + """ + payload, _, _ = await self._fetch_async( + memory_retrieval_request=memory_retrieval_request, + accept_encoding=accept_encoding, + content_encoding=content_encoding, + ) + return RecallInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + + async def fetch_with_http_info_async( + self, + memory_retrieval_request: MemoryRetrievalRequest, + accept_encoding: Union[str, object] = values.unset, + content_encoding: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to fetch the RecallInstance and return response metadata + + :param memory_retrieval_request: + :param accept_encoding: Compression algorithms supported by the client (e.g., gzip, deflate, br) + :param content_encoding: Compression algorithm used for the request body (e.g., gzip, deflate, br) + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async( + memory_retrieval_request=memory_retrieval_request, + accept_encoding=accept_encoding, + content_encoding=content_encoding, + ) + instance = RecallInstance( + self._version, + payload, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class RecallList(ListResource): + class CommunicationContent(object): + """ + :ivar text: Primary text content (optional). + """ + + def __init__(self, payload: Dict[str, Any]): + self.text: Optional[str] = payload.get("text") + + def to_dict(self): + return { + "": self.text, + } + + class MemoryRetrievalRequest(object): + """ + :ivar conversation_id: A unique identifier for the conversation using Twilio Type ID (TTID) format. + :ivar query: Hybrid search query for finding relevant memories. Omit to use query expansion to generate query from previous 10 communications in conversation. + :ivar begin_date: Start date for filtering memories (inclusive). + :ivar end_date: End date for filtering memories (exclusive). + :ivar communications_limit: Maximum number of conversational session memories to return. If omitted or set to 0, no session memories will be fetched. + :ivar observations_limit: Maximum number of observation memories to return. If omitted, defaults to 20. If set to 0, no observation memories will be fetched. + :ivar summaries_limit: Maximum number of summary memories to return. If omitted, defaults to 5. If set to 0, no summary memories will be fetched. + :ivar relevance_threshold: Minimum relevance score threshold for observations and summaries to be returned. Only memories with a relevance score greater than or equal to this threshold will be included in the response. + """ + + def __init__(self, payload: Dict[str, Any]): + self.conversation_id: Optional[str] = payload.get("conversation_id") + self.query: Optional[str] = payload.get("query") + self.begin_date: Optional[datetime] = payload.get("begin_date") + self.end_date: Optional[datetime] = payload.get("end_date") + self.communications_limit: Optional[int] = payload.get( + "communications_limit" + ) + self.observations_limit: Optional[int] = payload.get("observations_limit") + self.summaries_limit: Optional[int] = payload.get("summaries_limit") + self.relevance_threshold: Optional[float] = payload.get( + "relevance_threshold" + ) + + def to_dict(self): + return { + "conversation_id": self.conversation_id, + "query": self.query, + "begin_date": self.begin_date, + "end_date": self.end_date, + "communications_limit": self.communications_limit, + "observations_limit": self.observations_limit, + "summaries_limit": self.summaries_limit, + "relevance_threshold": self.relevance_threshold, + } + + class Participant(object): + """ + :ivar id: Participant identifier. + :ivar name: Participant display name + :ivar type: + :ivar profile_id: The canonical profile ID. + :ivar address: Address of the Participant (e.g., phone number, email address) + :ivar channel: The channel on which the message originated + """ + + def __init__(self, payload: Dict[str, Any]): + self.id: Optional[str] = payload.get("id") + self.name: Optional[str] = payload.get("name") + self.type: Optional["ParticipantType"] = payload.get("type") + self.profile_id: Optional[str] = payload.get("profile_id") + self.address: Optional[str] = payload.get("address") + self.channel: Optional[str] = payload.get("channel") + + def to_dict(self): + return { + "": self.id, + "": self.name, + "": self.type.to_dict() if self.type is not None else None, + "": self.profile_id, + "": self.address, + "": self.channel, + } + + def __init__(self, version: Version): + """ + Initialize the RecallList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, store_id: str, profile_id: str) -> RecallContext: + """ + Constructs a RecallContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + :param profile_id: The unique identifier for the profile using Twilio Type ID (TTID) format. + """ + return RecallContext(self._version, store_id=store_id, profile_id=profile_id) + + def __call__(self, store_id: str, profile_id: str) -> RecallContext: + """ + Constructs a RecallContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + :param profile_id: The unique identifier for the profile using Twilio Type ID (TTID) format. + """ + return RecallContext(self._version, store_id=store_id, profile_id=profile_id) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/memory/v1/revision.py b/twilio/rest/memory/v1/revision.py new file mode 100644 index 000000000..c48a46267 --- /dev/null +++ b/twilio/rest/memory/v1/revision.py @@ -0,0 +1,126 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio Memory API + APIs for managing memory stores, profiles, events, and conversational intelligence capabilities. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from typing import Any, Dict +from twilio.base.instance_context import InstanceContext + +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.token_pagination import TokenPagination + + +class RevisionContext(InstanceContext): + def __init__( + self, version: Version, store_id: str, profile_id: str, observation_id: str + ): + """ + Initialize the RevisionContext + + :param version: Version that contains the resource + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + :param profile_id: The unique identifier for the profile using Twilio Type ID (TTID) format. + :param observation_id: The observation ID. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "store_id": store_id, + "profile_id": profile_id, + "observation_id": observation_id, + } + self._uri = "/Stores/{store_id}/Profiles/{profile_id}/Observations/{observation_id}/Revisions".format( + **self._solution + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class RevisionPage(TokenPagination): + def get_instance(self, payload: Dict[str, Any]) -> "RevisionInstance": + """ + Build an instance of RevisionInstance + + :param payload: Payload response from the API + """ + return RevisionInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class RevisionList(ListResource): + def __init__(self, version: Version): + """ + Initialize the RevisionList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get( + self, store_id: str, profile_id: str, observation_id: str + ) -> RevisionContext: + """ + Constructs a RevisionContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + :param profile_id: The unique identifier for the profile using Twilio Type ID (TTID) format. + :param observation_id: The observation ID. + """ + return RevisionContext( + self._version, + store_id=store_id, + profile_id=profile_id, + observation_id=observation_id, + ) + + def __call__( + self, store_id: str, profile_id: str, observation_id: str + ) -> RevisionContext: + """ + Constructs a RevisionContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + :param profile_id: The unique identifier for the profile using Twilio Type ID (TTID) format. + :param observation_id: The observation ID. + """ + return RevisionContext( + self._version, + store_id=store_id, + profile_id=profile_id, + observation_id=observation_id, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/memory/v1/store.py b/twilio/rest/memory/v1/store.py new file mode 100644 index 000000000..60a566fd9 --- /dev/null +++ b/twilio/rest/memory/v1/store.py @@ -0,0 +1,1126 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio Memory API + APIs for managing memory stores, profiles, events, and conversational intelligence capabilities. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.api_response import ApiResponse +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.token_pagination import TokenPagination + + +class StoreInstance(InstanceResource): + class ServiceRequest(object): + """ + :ivar display_name: Provides a unique and addressable name to be assigned to this Store. This name is assigned by the developer and can be used in addition to the ID. It is intended to be human-readable and unique within the account. + :ivar description: A human readable description of this resource, up to 128 characters. + """ + + def __init__(self, payload: Dict[str, Any]): + self.display_name: Optional[str] = payload.get("display_name") + self.description: Optional[str] = payload.get("description") + + def to_dict(self): + return { + "display_name": self.display_name, + "description": self.description, + } + + class UpdateStoreRequest(object): + """ + :ivar display_name: Provides a unique and addressable name to be assigned to this Store. This name is assigned by the developer and can be used in addition to the ID. It is intended to be human-readable and unique within the account. + :ivar description: A human readable description of this resource, up to 128 characters. + """ + + def __init__(self, payload: Dict[str, Any]): + self.display_name: Optional[str] = payload.get("display_name") + self.description: Optional[str] = payload.get("description") + + def to_dict(self): + return { + "display_name": self.display_name, + "description": self.description, + } + + """ + :ivar display_name: Provides a unique and addressable name to be assigned to this Store. This name is assigned by the developer and can be used in addition to the ID. It is intended to be human-readable and unique within the account. + :ivar description: A human readable description of this resource, up to 128 characters. + :ivar id: The unique identifier for the Memory Store + :ivar status: The current status of the Memory Store. A store begins in the QUEUED state as it is scheduled for processing. It then moves to PROVISIONING at the beginning of processing. It transitions to ACTIVE once all dependent resources are provisioned, including Conversational Intelligence capabilities. If there is an issue provisioning resources, the store will move to the FAILED state. + :ivar intelligence_service_id: The ID of the associated intelligence service that was provisioned for memory extraction. + :ivar version: The current version number of the Memory Store. Incremented on each successful update. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], store_id: Optional[str] = None + ): + super().__init__(version) + + self.display_name: Optional[str] = payload.get("displayName") + self.description: Optional[str] = payload.get("description") + self.id: Optional[str] = payload.get("id") + self.status: Optional[str] = payload.get("status") + self.intelligence_service_id: Optional[str] = payload.get( + "intelligenceServiceId" + ) + self.version: Optional[int] = deserialize.integer(payload.get("version")) + + self._solution = { + "store_id": store_id or self.store_id, + } + self._context: Optional[StoreContext] = None + + @property + def _proxy(self) -> "StoreContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: StoreContext for this StoreInstance + """ + if self._context is None: + self._context = StoreContext( + self._version, + store_id=self._solution["store_id"], + ) + return self._context + + def fetch(self) -> "StoreInstance": + """ + Fetch the StoreInstance + + + :returns: The fetched StoreInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "StoreInstance": + """ + Asynchronous coroutine to fetch the StoreInstance + + + :returns: The fetched StoreInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the StoreInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the StoreInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_async() + + def update( + self, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + update_store_request: Union[UpdateStoreRequest, object] = values.unset, + ) -> "StoreInstance": + """ + Update the StoreInstance + + :param if_match: Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches one provided, preventing accidental overwrites and responding with 412 Precondition Failed if they don't match. + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + :param update_store_request: + + :returns: The updated StoreInstance + """ + return self._proxy.update( + if_match=if_match, + prefer=prefer, + update_store_request=update_store_request, + ) + + async def update_async( + self, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + update_store_request: Union[UpdateStoreRequest, object] = values.unset, + ) -> "StoreInstance": + """ + Asynchronous coroutine to update the StoreInstance + + :param if_match: Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches one provided, preventing accidental overwrites and responding with 412 Precondition Failed if they don't match. + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + :param update_store_request: + + :returns: The updated StoreInstance + """ + return await self._proxy.update_async( + if_match=if_match, + prefer=prefer, + update_store_request=update_store_request, + ) + + def update_with_http_info( + self, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + update_store_request: Union[UpdateStoreRequest, object] = values.unset, + ) -> ApiResponse: + """ + Update the StoreInstance with HTTP info + + :param if_match: Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches one provided, preventing accidental overwrites and responding with 412 Precondition Failed if they don't match. + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + :param update_store_request: + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.update_with_http_info( + if_match=if_match, + prefer=prefer, + update_store_request=update_store_request, + ) + + async def update_with_http_info_async( + self, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + update_store_request: Union[UpdateStoreRequest, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to update the StoreInstance with HTTP info + + :param if_match: Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches one provided, preventing accidental overwrites and responding with 412 Precondition Failed if they don't match. + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + :param update_store_request: + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.update_with_http_info_async( + if_match=if_match, + prefer=prefer, + update_store_request=update_store_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 StoreContext(InstanceContext): + class ServiceRequest(object): + """ + :ivar display_name: Provides a unique and addressable name to be assigned to this Store. This name is assigned by the developer and can be used in addition to the ID. It is intended to be human-readable and unique within the account. + :ivar description: A human readable description of this resource, up to 128 characters. + """ + + def __init__(self, payload: Dict[str, Any]): + self.display_name: Optional[str] = payload.get("display_name") + self.description: Optional[str] = payload.get("description") + + def to_dict(self): + return { + "display_name": self.display_name, + "description": self.description, + } + + class UpdateStoreRequest(object): + """ + :ivar display_name: Provides a unique and addressable name to be assigned to this Store. This name is assigned by the developer and can be used in addition to the ID. It is intended to be human-readable and unique within the account. + :ivar description: A human readable description of this resource, up to 128 characters. + """ + + def __init__(self, payload: Dict[str, Any]): + self.display_name: Optional[str] = payload.get("display_name") + self.description: Optional[str] = payload.get("description") + + def to_dict(self): + return { + "display_name": self.display_name, + "description": self.description, + } + + def __init__(self, version: Version, store_id: str): + """ + Initialize the StoreContext + + :param version: Version that contains the resource + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + """ + super().__init__(version) + + # Path Solution + self._solution = { + "store_id": store_id, + } + self._uri = "/ControlPlane/Stores/{store_id}".format(**self._solution) + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> StoreInstance: + """ + Fetch the StoreInstance + + + :returns: The fetched StoreInstance + """ + payload, _, _ = self._fetch() + return StoreInstance( + self._version, + payload, + store_id=self._solution["store_id"], + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the StoreInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = StoreInstance( + self._version, + payload, + store_id=self._solution["store_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> StoreInstance: + """ + Asynchronous coroutine to fetch the StoreInstance + + + :returns: The fetched StoreInstance + """ + payload, _, _ = await self._fetch_async() + return StoreInstance( + self._version, + payload, + store_id=self._solution["store_id"], + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the StoreInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = StoreInstance( + self._version, + payload, + store_id=self._solution["store_id"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def _update( + self, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + update_store_request: Union[UpdateStoreRequest, object] = values.unset, + ) -> tuple: + """ + Internal helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = update_store_request.to_dict() + + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + if not (prefer is values.unset or (isinstance(prefer, str) and not prefer)): + headers["Prefer"] = prefer + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.update_with_response_info( + method="PATCH", uri=self._uri, data=data, headers=headers + ) + + def update( + self, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + update_store_request: Union[UpdateStoreRequest, object] = values.unset, + ) -> StoreInstance: + """ + Update the StoreInstance + + :param if_match: Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches one provided, preventing accidental overwrites and responding with 412 Precondition Failed if they don't match. + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + :param update_store_request: + + :returns: The updated StoreInstance + """ + payload, _, _ = self._update( + if_match=if_match, prefer=prefer, update_store_request=update_store_request + ) + return StoreInstance( + self._version, payload, store_id=self._solution["store_id"] + ) + + def update_with_http_info( + self, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + update_store_request: Union[UpdateStoreRequest, object] = values.unset, + ) -> ApiResponse: + """ + Update the StoreInstance and return response metadata + + :param if_match: Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches one provided, preventing accidental overwrites and responding with 412 Precondition Failed if they don't match. + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + :param update_store_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._update( + if_match=if_match, prefer=prefer, update_store_request=update_store_request + ) + instance = StoreInstance( + self._version, payload, store_id=self._solution["store_id"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _update_async( + self, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + update_store_request: Union[UpdateStoreRequest, object] = values.unset, + ) -> tuple: + """ + Internal async helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = update_store_request.to_dict() + + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + if not (prefer is values.unset or (isinstance(prefer, str) and not prefer)): + headers["Prefer"] = prefer + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.update_with_response_info_async( + method="PATCH", uri=self._uri, data=data, headers=headers + ) + + async def update_async( + self, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + update_store_request: Union[UpdateStoreRequest, object] = values.unset, + ) -> StoreInstance: + """ + Asynchronous coroutine to update the StoreInstance + + :param if_match: Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches one provided, preventing accidental overwrites and responding with 412 Precondition Failed if they don't match. + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + :param update_store_request: + + :returns: The updated StoreInstance + """ + payload, _, _ = await self._update_async( + if_match=if_match, prefer=prefer, update_store_request=update_store_request + ) + return StoreInstance( + self._version, payload, store_id=self._solution["store_id"] + ) + + async def update_with_http_info_async( + self, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + update_store_request: Union[UpdateStoreRequest, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to update the StoreInstance and return response metadata + + :param if_match: Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches one provided, preventing accidental overwrites and responding with 412 Precondition Failed if they don't match. + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + :param update_store_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._update_async( + if_match=if_match, prefer=prefer, update_store_request=update_store_request + ) + instance = StoreInstance( + self._version, payload, store_id=self._solution["store_id"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class StorePage(TokenPagination): + def get_instance(self, payload: Dict[str, Any]) -> StoreInstance: + """ + Build an instance of StoreInstance + + :param payload: Payload response from the API + """ + return StoreInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class StoreList(ListResource): + class ServiceRequest(object): + """ + :ivar display_name: Provides a unique and addressable name to be assigned to this Store. This name is assigned by the developer and can be used in addition to the ID. It is intended to be human-readable and unique within the account. + :ivar description: A human readable description of this resource, up to 128 characters. + """ + + def __init__(self, payload: Dict[str, Any]): + self.display_name: Optional[str] = payload.get("display_name") + self.description: Optional[str] = payload.get("description") + + def to_dict(self): + return { + "display_name": self.display_name, + "description": self.description, + } + + class UpdateStoreRequest(object): + """ + :ivar display_name: Provides a unique and addressable name to be assigned to this Store. This name is assigned by the developer and can be used in addition to the ID. It is intended to be human-readable and unique within the account. + :ivar description: A human readable description of this resource, up to 128 characters. + """ + + def __init__(self, payload: Dict[str, Any]): + self.display_name: Optional[str] = payload.get("display_name") + self.description: Optional[str] = payload.get("description") + + def to_dict(self): + return { + "display_name": self.display_name, + "description": self.description, + } + + def __init__(self, version: Version): + """ + Initialize the StoreList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/ControlPlane/Stores" + + def _create(self, service_request: ServiceRequest) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = service_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create(self, service_request: ServiceRequest) -> StoreInstance: + """ + Create the StoreInstance + + :param service_request: + + :returns: The created StoreInstance + """ + payload, _, _ = self._create(service_request=service_request) + return StoreInstance(self._version, payload) + + def create_with_http_info(self, service_request: ServiceRequest) -> ApiResponse: + """ + Create the StoreInstance and return response metadata + + :param service_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create(service_request=service_request) + instance = StoreInstance(self._version, payload) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async(self, service_request: ServiceRequest) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = service_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async(self, service_request: ServiceRequest) -> StoreInstance: + """ + Asynchronously create the StoreInstance + + :param service_request: + + :returns: The created StoreInstance + """ + payload, _, _ = await self._create_async(service_request=service_request) + return StoreInstance(self._version, payload) + + async def create_with_http_info_async( + self, service_request: ServiceRequest + ) -> ApiResponse: + """ + Asynchronously create the StoreInstance and return response metadata + + :param service_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + service_request=service_request + ) + instance = StoreInstance(self._version, payload) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def stream( + self, + page_token: Union[str, object] = values.unset, + order_by: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[StoreInstance]: + """ + Streams StoreInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str page_token: The token for the page of results to retrieve. + :param str order_by: Either 'ASC' or 'DESC' to sort results ascending or descending respectively. + :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_token=page_token, order_by=order_by, page_size=limits["page_size"] + ) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + page_token: Union[str, object] = values.unset, + order_by: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[StoreInstance]: + """ + Asynchronously streams StoreInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str page_token: The token for the page of results to retrieve. + :param str order_by: Either 'ASC' or 'DESC' to sort results ascending or descending respectively. + :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_token=page_token, order_by=order_by, page_size=limits["page_size"] + ) + + return self._version.stream_async(page, limits["limit"]) + + def stream_with_http_info( + self, + page_token: Union[str, object] = values.unset, + order_by: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams StoreInstance and returns headers from first page + + + :param str page_token: The token for the page of results to retrieve. + :param str order_by: Either 'ASC' or 'DESC' to sort results ascending or descending respectively. + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info( + page_token=page_token, order_by=order_by, page_size=limits["page_size"] + ) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + page_token: Union[str, object] = values.unset, + order_by: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams StoreInstance and returns headers from first page + + + :param str page_token: The token for the page of results to retrieve. + :param str order_by: Either 'ASC' or 'DESC' to sort results ascending or descending respectively. + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + page_token=page_token, order_by=order_by, page_size=limits["page_size"] + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + page_token: Union[str, object] = values.unset, + order_by: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[StoreInstance]: + """ + Lists StoreInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str page_token: The token for the page of results to retrieve. + :param str order_by: Either 'ASC' or 'DESC' to sort results ascending or descending respectively. + :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( + page_token=page_token, + order_by=order_by, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + page_token: Union[str, object] = values.unset, + order_by: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[StoreInstance]: + """ + Asynchronously lists StoreInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str page_token: The token for the page of results to retrieve. + :param str order_by: Either 'ASC' or 'DESC' to sort results ascending or descending respectively. + :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( + page_token=page_token, + order_by=order_by, + limit=limit, + page_size=page_size, + ) + ] + + def list_with_http_info( + self, + page_token: Union[str, object] = values.unset, + order_by: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists StoreInstance and returns headers from first page + + + :param str page_token: The token for the page of results to retrieve. + :param str order_by: Either 'ASC' or 'DESC' to sort results ascending or descending respectively. + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + page_token=page_token, + order_by=order_by, + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + page_token: Union[str, object] = values.unset, + order_by: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists StoreInstance and returns headers from first page + + + :param str page_token: The token for the page of results to retrieve. + :param str order_by: Either 'ASC' or 'DESC' to sort results ascending or descending respectively. + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + page_token=page_token, + order_by=order_by, + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + page_size: Union[int, object] = values.unset, + page_token: Union[str, object] = values.unset, + order_by: Union[str, object] = values.unset, + ) -> StorePage: + """ + Retrieve a single page of StoreInstance records from the API. + Request is executed immediately + + :param page_size: The maximum number of items to return per page, maximum of 100. + :param page_token: The token for the page of results to retrieve. + :param order_by: Either 'ASC' or 'DESC' to sort results ascending or descending respectively. + :returns: Page of StoreInstance + """ + data = values.of( + { + "pageSize": page_size, + "pageToken": page_token, + "orderBy": order_by, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) + return StorePage(self._version, response, uri=self._uri, params=data) + + async def page_async( + self, + page_size: Union[int, object] = values.unset, + page_token: Union[str, object] = values.unset, + order_by: Union[str, object] = values.unset, + ) -> StorePage: + """ + Asynchronously retrieve a single page of StoreInstance records from the API. + Request is executed immediately + + :param page_size: The maximum number of items to return per page, maximum of 100. + :param page_token: The token for the page of results to retrieve. + :param order_by: Either 'ASC' or 'DESC' to sort results ascending or descending respectively. + :returns: Page of StoreInstance + """ + data = values.of( + { + "pageSize": page_size, + "pageToken": page_token, + "orderBy": order_by, + } + ) + + headers = values.of({"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 StorePage(self._version, response, uri=self._uri, params=data) + + def page_with_http_info( + self, + order_by: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :param page_token: The token for the page of results to retrieve. + :param order_by: Either 'ASC' or 'DESC' to sort results ascending or descending respectively. + :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: ApiResponse with StorePage, status code, and headers + """ + data = values.of( + { + "pageToken": page_token, + "orderBy": order_by, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = StorePage(self._version, response, uri=self._uri) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + page_token: Union[str, object] = values.unset, + order_by: Union[str, object] = values.unset, + # page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :param page_token: The token for the page of results to retrieve. + :param order_by: Either 'ASC' or 'DESC' to sort results ascending or descending respectively. + :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: ApiResponse with StorePage, status code, and headers + """ + data = values.of( + { + "pageToken": page_token, + "orderBy": order_by, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = StorePage(self._version, response) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> StorePage: + """ + Retrieve a specific page of StoreInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of StoreInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return StorePage(self._version, response) + + async def get_page_async(self, target_url: str) -> StorePage: + """ + Asynchronously retrieve a specific page of StoreInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of StoreInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return StorePage(self._version, response) + + def get(self, store_id: str) -> StoreContext: + """ + Constructs a StoreContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + """ + return StoreContext(self._version, store_id=store_id) + + def __call__(self, store_id: str) -> StoreContext: + """ + Constructs a StoreContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + """ + return StoreContext(self._version, store_id=store_id) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/memory/v1/trait.py b/twilio/rest/memory/v1/trait.py new file mode 100644 index 000000000..0a51a4b07 --- /dev/null +++ b/twilio/rest/memory/v1/trait.py @@ -0,0 +1,165 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio Memory API + APIs for managing memory stores, profiles, events, and conversational intelligence capabilities. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from datetime import datetime +from typing import Any, Dict, Optional +from twilio.base import deserialize +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.token_pagination import TokenPagination + + +class TraitInstance(InstanceResource): + + """ + :ivar name: The name of the trait. + :ivar value: The value of a trait. Can be a string, integer, boolean, or an array of these types (arrays cannot contain nested arrays). + :ivar trait_group: The trait group name to which this trait belongs. + :ivar timestamp: The time the trait was created or last updated. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + store_id: Optional[str] = None, + profile_id: Optional[str] = None, + ): + super().__init__(version) + + self.name: Optional[str] = payload.get("name") + self.value: Optional[Dict[str, object]] = payload.get("value") + self.trait_group: Optional[str] = payload.get("traitGroup") + self.timestamp: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("timestamp") + ) + + self._solution = { + "store_id": store_id or self.store_id, + "profile_id": profile_id or self.profile_id, + } + self._context: Optional[TraitContext] = None + + @property + def _proxy(self) -> "TraitContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: TraitContext for this TraitInstance + """ + if self._context is None: + self._context = TraitContext( + self._version, + store_id=self._solution["store_id"], + profile_id=self._solution["profile_id"], + ) + return self._context + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class TraitContext(InstanceContext): + def __init__(self, version: Version, store_id: str, profile_id: str): + """ + Initialize the TraitContext + + :param version: Version that contains the resource + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + :param profile_id: The unique identifier for the profile using Twilio Type ID (TTID) format. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "store_id": store_id, + "profile_id": profile_id, + } + self._uri = "/Stores/{store_id}/Profiles/{profile_id}/Traits".format( + **self._solution + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class TraitPage(TokenPagination): + def get_instance(self, payload: Dict[str, Any]) -> TraitInstance: + """ + Build an instance of TraitInstance + + :param payload: Payload response from the API + """ + return TraitInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class TraitList(ListResource): + def __init__(self, version: Version): + """ + Initialize the TraitList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, store_id: str, profile_id: str) -> TraitContext: + """ + Constructs a TraitContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + :param profile_id: The unique identifier for the profile using Twilio Type ID (TTID) format. + """ + return TraitContext(self._version, store_id=store_id, profile_id=profile_id) + + def __call__(self, store_id: str, profile_id: str) -> TraitContext: + """ + Constructs a TraitContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + :param profile_id: The unique identifier for the profile using Twilio Type ID (TTID) format. + """ + return TraitContext(self._version, store_id=store_id, profile_id=profile_id) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/memory/v1/trait_group.py b/twilio/rest/memory/v1/trait_group.py new file mode 100644 index 000000000..9b3b4c3c3 --- /dev/null +++ b/twilio/rest/memory/v1/trait_group.py @@ -0,0 +1,1646 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio Memory API + APIs for managing memory stores, profiles, events, and conversational intelligence capabilities. + + 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, Protocol +from twilio.base import serialize, values +from twilio.base.api_response import ApiResponse +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.token_pagination import TokenPagination + + +class ResponseResource(Protocol): + pass + + +""" +Nested response model for Meta +""" + + +class Meta: + def __init__(self, key: str, pageSize: int, nextToken: str, previousToken: str): + self.key = key + self.pageSize = pageSize + self.nextToken = nextToken + self.previousToken = previousToken + + +""" +Nested response model for TraitDefinition +""" + + +class TraitDefinition: + def __init__( + self, displayName: str, dataType: str, description: str, idTypePromotion: str + ): + self.displayName = displayName + self.dataType = dataType + self.description = description + self.idTypePromotion = idTypePromotion + + +""" +Nested response model for TraitGroup +""" + + +class TraitGroup: + def __init__( + self, + displayName: str, + description: str, + traits: Dict[str, "TraitGroupCoreTraitsValue"], + version: int, + ): + self.displayName = displayName + self.description = description + self.traits = traits + self.version = version + + +""" +Nested response model for TraitGroupCoreTraitsValue +""" + + +class TraitGroupCoreTraitsValue: + def __init__( + self, + displayName: str, + dataType: str, + description: str, + validationRule: "ValidationRule", + idTypePromotion: str, + ): + self.displayName = displayName + self.dataType = dataType + self.description = description + self.validationRule = validationRule + self.idTypePromotion = idTypePromotion + + +""" +Nested response model for TraitGroupRequest +""" + + +class TraitGroupRequest: + def __init__( + self, + displayName: str, + description: str, + traits: Dict[str, TraitGroupCoreTraitsValue], + ): + self.displayName = displayName + self.description = description + self.traits = traits + + +""" +Nested response model for UpdateTraitGroupRequest +""" + + +class UpdateTraitGroupRequest: + def __init__(self, description: str, traits: Dict[str, TraitDefinition]): + self.description = description + self.traits = traits + + +""" +Nested response model for ValidationRule +""" + + +class ValidationRule: + def __init__( + self, + pattern: str, + minLength: int, + maxLength: int, + ruleType: str, + min: float, + max: float, + minItems: int, + maxItems: int, + ): + self.pattern = pattern + self.minLength = minLength + self.maxLength = maxLength + self.ruleType = ruleType + self.min = min + self.max = max + self.minItems = minItems + self.maxItems = maxItems + + +""" +Response model for DeleteTraitGroup_202_response operations +""" + + +class DeleteTraitGroup_202_responseResource: + def __init__(self, message: str): + """ + Initialize the DeleteTraitGroup_202_responseResource + :param message: + + """ + self.message = message + + +""" +Response model for CreateTraitGroup_201_response operations +""" + + +class CreateTraitGroup_201_responseResource: + def __init__(self, traitGroup: str, meta: str): + """ + Initialize the CreateTraitGroup_201_responseResource + :param traitGroup: + :param meta: + + """ + self.traitGroup = traitGroup + self.meta = meta + + +""" +Response model for TraitGroup operations +""" + + +class TraitGroupResource: + def __init__( + self, + displayName: str, + description: str, + traits: Dict[str, TraitGroupCoreTraitsValue], + version: int, + ): + """ + Initialize the TraitGroupResource + :param displayName: Provides a unique and addressable name to be assigned to this Trait Group + :param description: description of the Trait Group + :param traits: Map of traits that are part of this Trait Group, where the key is the trait name and the value is the trait's definition. + :param version: The current version number of the Trait Group. Incremented on each successful update. + + """ + self.displayName = displayName + self.description = description + self.traits = traits + self.version = version + + +class TraitGroupInstance(InstanceResource): + class TraitDefinition(object): + """ + :ivar display_name: Display name of the Trait, which is unique within the Trait Group. Trait names are normalized to lowerCamelCase naming conventions and can include letters, numbers, underscores, hyphens, and periods. They must start with a letter. + :ivar data_type: Data type of the Trait, such as STRING, NUMBER, BOOLEAN, ARRAY. For DELETE operations in PATCH requests, set this to an empty string (\"\") to mark the trait for deletion. + :ivar description: Description of the Trait, providing additional context or information. + :ivar id_type_promotion: The name of the identifier type to promote the trait value to, such as ''email'', ''phone'', ''user_id'', etc. This allows the trait to be mapped to an identifier in Identity Resolution. The identifier type should be configured in the Identity Resolution Settings. + """ + + def __init__(self, payload: Dict[str, Any]): + self.display_name: Optional[str] = payload.get("display_name") + self.data_type: Optional[str] = payload.get("data_type") + self.description: Optional[str] = payload.get("description") + self.id_type_promotion: Optional[str] = payload.get("id_type_promotion") + + def to_dict(self): + return { + "": self.display_name, + "": self.data_type, + "": self.description, + "": self.id_type_promotion, + } + + class TraitGroupCoreTraitsValue(object): + """ + :ivar display_name: Display name of the Trait, which is unique within the Trait Group. Trait names are normalized to lowerCamelCase naming conventions and can include letters, numbers, underscores, hyphens, and periods. They must start with a letter. + :ivar data_type: Data type of the Trait, such as STRING, NUMBER, BOOLEAN, ARRAY. For DELETE operations in PATCH requests, set this to an empty string (\"\") to mark the trait for deletion. + :ivar description: Description of the Trait, providing additional context or information. + :ivar validation_rule: + :ivar id_type_promotion: The name of the identifier type to promote the trait value to, such as ''email'', ''phone'', ''user_id'', etc. This allows the trait to be mapped to an identifier in Identity Resolution. The identifier type should be configured in the Identity Resolution Settings. + """ + + def __init__(self, payload: Dict[str, Any]): + self.display_name: Optional[str] = payload.get("display_name") + self.data_type: Optional[str] = payload.get("data_type") + self.description: Optional[str] = payload.get("description") + self.validation_rule: Optional[ValidationRule] = payload.get( + "validation_rule" + ) + self.id_type_promotion: Optional[str] = payload.get("id_type_promotion") + + def to_dict(self): + return { + "": self.display_name, + "": self.data_type, + "": self.description, + "": self.validation_rule.to_dict() + if self.validation_rule is not None + else None, + "": self.id_type_promotion, + } + + class TraitGroupRequest(object): + """ + :ivar display_name: Unique name of the Trait Group + :ivar description: description of the Trait Group + :ivar traits: Map of traits belonging to this Trait Group, keyed by trait name. + """ + + def __init__(self, payload: Dict[str, Any]): + self.display_name: Optional[str] = payload.get("display_name") + self.description: Optional[str] = payload.get("description") + self.traits: Optional[Dict[str, TraitGroupCoreTraitsValue]] = payload.get( + "traits" + ) + + def to_dict(self): + return { + "display_name": self.display_name, + "description": self.description, + "traits": [traits.to_dict() for traits in self.traits] + if self.traits is not None + else None, + } + + class UpdateTraitGroupRequest(object): + """ + :ivar description: Updated description of the Trait Group + :ivar traits: Map of traits to add, update, or remove in this Trait Group, where the key is the trait name. - To update/add a trait: provide the complete TraitDefinition object - To remove a trait: set dataType to an empty string (\"\") + """ + + def __init__(self, payload: Dict[str, Any]): + self.description: Optional[str] = payload.get("description") + self.traits: Optional[Dict[str, TraitDefinition]] = payload.get("traits") + + def to_dict(self): + return { + "description": self.description, + "traits": [traits.to_dict() for traits in self.traits] + if self.traits is not None + else None, + } + + class ValidationRule(object): + """ + :ivar pattern: Regex pattern (max 1000 chars) + :ivar min_length: Minimum string length + :ivar max_length: Maximum string length + :ivar rule_type: Discriminator field indicating this is an array validation rule. + :ivar min: Minimum value + :ivar max: Maximum value + :ivar min_items: Minimum number of items + :ivar max_items: Maximum number of items + """ + + def __init__(self, payload: Dict[str, Any]): + self.pattern: Optional[str] = payload.get("pattern") + self.min_length: Optional[int] = payload.get("min_length") + self.max_length: Optional[int] = payload.get("max_length") + self.rule_type: Optional[str] = payload.get("rule_type") + self.min: Optional[float] = payload.get("min") + self.max: Optional[float] = payload.get("max") + self.min_items: Optional[int] = payload.get("min_items") + self.max_items: Optional[int] = payload.get("max_items") + + def to_dict(self): + return { + "": self.pattern, + "": self.min_length, + "": self.max_length, + "": self.rule_type, + "": self.min, + "": self.max, + "": self.min_items, + "": self.max_items, + } + + """ + :ivar trait_group: + :ivar meta: + """ + + def __init__( + self, + version: Version, + payload: ResponseResource, + store_id: Optional[str] = None, + trait_group_name: Optional[str] = None, + ): + super().__init__(version) + + self.trait_group: Optional[str] = payload.get("traitGroup") + self.meta: Optional[str] = payload.get("meta") + + self._solution = { + "store_id": store_id or self.store_id, + "trait_group_name": trait_group_name or self.trait_group_name, + } + self._context: Optional[TraitGroupContext] = None + + @property + def _proxy(self) -> "TraitGroupContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: TraitGroupContext for this TraitGroupInstance + """ + if self._context is None: + self._context = TraitGroupContext( + self._version, + store_id=self._solution["store_id"], + trait_group_name=self._solution["trait_group_name"], + ) + return self._context + + def create( + self, + prefer: Union[str, object] = values.unset, + trait_group_request: Union[TraitGroupRequest, object] = values.unset, + ) -> "TraitGroupInstance": + """ + Create the TraitGroupInstance + + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + :param trait_group_request: + + :returns: The created TraitGroupInstance + """ + return self._proxy.create( + prefer=prefer, + trait_group_request=trait_group_request, + ) + + async def create_async( + self, + prefer: Union[str, object] = values.unset, + trait_group_request: Union[TraitGroupRequest, object] = values.unset, + ) -> "TraitGroupInstance": + """ + Asynchronous coroutine to create the TraitGroupInstance + + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + :param trait_group_request: + + :returns: The created TraitGroupInstance + """ + return await self._proxy.create_async( + prefer=prefer, + trait_group_request=trait_group_request, + ) + + def create_with_http_info( + self, + prefer: Union[str, object] = values.unset, + trait_group_request: Union[TraitGroupRequest, object] = values.unset, + ) -> ApiResponse: + """ + Create the TraitGroupInstance with HTTP info + + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + :param trait_group_request: + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.create_with_http_info( + prefer=prefer, + trait_group_request=trait_group_request, + ) + + async def create_with_http_info_async( + self, + prefer: Union[str, object] = values.unset, + trait_group_request: Union[TraitGroupRequest, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to create the TraitGroupInstance with HTTP info + + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + :param trait_group_request: + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.create_with_http_info_async( + prefer=prefer, + trait_group_request=trait_group_request, + ) + + def delete(self, prefer: Union[str, object] = values.unset) -> bool: + """ + Deletes the TraitGroupInstance + + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete( + prefer=prefer, + ) + + async def delete_async(self, prefer: Union[str, object] = values.unset) -> bool: + """ + Asynchronous coroutine that deletes the TraitGroupInstance + + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async( + prefer=prefer, + ) + + def delete_with_http_info( + self, prefer: Union[str, object] = values.unset + ) -> ApiResponse: + """ + Deletes the TraitGroupInstance with HTTP info + + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + + :returns: ApiResponse with success boolean, status code, and headers + """ + return self._proxy.delete_with_http_info( + prefer=prefer, + ) + + async def delete_with_http_info_async( + self, prefer: Union[str, object] = values.unset + ) -> ApiResponse: + """ + Asynchronous coroutine that deletes the TraitGroupInstance with HTTP info + + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + + :returns: ApiResponse with success boolean, status code, and headers + """ + return await self._proxy.delete_with_http_info_async( + prefer=prefer, + ) + + def fetch( + self, + include_traits: Union[bool, object] = values.unset, + page_size: Union[int, object] = values.unset, + page_token: Union[str, object] = values.unset, + order_by: Union[str, object] = values.unset, + ) -> "TraitGroupInstance": + """ + Fetch the TraitGroupInstance + + :param include_traits: Whether to include trait definitions in the response + :param page_size: The maximum number of items to return per page, maximum of 100. + :param page_token: The token for the page of results to retrieve. + :param order_by: Either 'ASC' or 'DESC' to sort results ascending or descending respectively. + + :returns: The fetched TraitGroupInstance + """ + return self._proxy.fetch( + include_traits=include_traits, + page_size=page_size, + page_token=page_token, + order_by=order_by, + ) + + async def fetch_async( + self, + include_traits: Union[bool, object] = values.unset, + page_size: Union[int, object] = values.unset, + page_token: Union[str, object] = values.unset, + order_by: Union[str, object] = values.unset, + ) -> "TraitGroupInstance": + """ + Asynchronous coroutine to fetch the TraitGroupInstance + + :param include_traits: Whether to include trait definitions in the response + :param page_size: The maximum number of items to return per page, maximum of 100. + :param page_token: The token for the page of results to retrieve. + :param order_by: Either 'ASC' or 'DESC' to sort results ascending or descending respectively. + + :returns: The fetched TraitGroupInstance + """ + return await self._proxy.fetch_async( + include_traits=include_traits, + page_size=page_size, + page_token=page_token, + order_by=order_by, + ) + + def fetch_with_http_info( + self, + include_traits: Union[bool, object] = values.unset, + page_size: Union[int, object] = values.unset, + page_token: Union[str, object] = values.unset, + order_by: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Fetch the TraitGroupInstance with HTTP info + + :param include_traits: Whether to include trait definitions in the response + :param page_size: The maximum number of items to return per page, maximum of 100. + :param page_token: The token for the page of results to retrieve. + :param order_by: Either 'ASC' or 'DESC' to sort results ascending or descending respectively. + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info( + include_traits=include_traits, + page_size=page_size, + page_token=page_token, + order_by=order_by, + ) + + async def fetch_with_http_info_async( + self, + include_traits: Union[bool, object] = values.unset, + page_size: Union[int, object] = values.unset, + page_token: Union[str, object] = values.unset, + order_by: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to fetch the TraitGroupInstance with HTTP info + + :param include_traits: Whether to include trait definitions in the response + :param page_size: The maximum number of items to return per page, maximum of 100. + :param page_token: The token for the page of results to retrieve. + :param order_by: Either 'ASC' or 'DESC' to sort results ascending or descending respectively. + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_async( + include_traits=include_traits, + page_size=page_size, + page_token=page_token, + order_by=order_by, + ) + + def update( + self, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + update_trait_group_request: Union[ + UpdateTraitGroupRequest, object + ] = values.unset, + ) -> "TraitGroupInstance": + """ + Update the TraitGroupInstance + + :param if_match: Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches one provided, preventing accidental overwrites and responding with 412 Precondition Failed if they don't match. + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + :param update_trait_group_request: + + :returns: The updated TraitGroupInstance + """ + return self._proxy.update( + if_match=if_match, + prefer=prefer, + update_trait_group_request=update_trait_group_request, + ) + + async def update_async( + self, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + update_trait_group_request: Union[ + UpdateTraitGroupRequest, object + ] = values.unset, + ) -> "TraitGroupInstance": + """ + Asynchronous coroutine to update the TraitGroupInstance + + :param if_match: Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches one provided, preventing accidental overwrites and responding with 412 Precondition Failed if they don't match. + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + :param update_trait_group_request: + + :returns: The updated TraitGroupInstance + """ + return await self._proxy.update_async( + if_match=if_match, + prefer=prefer, + update_trait_group_request=update_trait_group_request, + ) + + def update_with_http_info( + self, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + update_trait_group_request: Union[ + UpdateTraitGroupRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Update the TraitGroupInstance with HTTP info + + :param if_match: Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches one provided, preventing accidental overwrites and responding with 412 Precondition Failed if they don't match. + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + :param update_trait_group_request: + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.update_with_http_info( + if_match=if_match, + prefer=prefer, + update_trait_group_request=update_trait_group_request, + ) + + async def update_with_http_info_async( + self, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + update_trait_group_request: Union[ + UpdateTraitGroupRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to update the TraitGroupInstance with HTTP info + + :param if_match: Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches one provided, preventing accidental overwrites and responding with 412 Precondition Failed if they don't match. + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + :param update_trait_group_request: + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.update_with_http_info_async( + if_match=if_match, + prefer=prefer, + update_trait_group_request=update_trait_group_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 TraitGroupContext(InstanceContext): + class TraitDefinition(object): + """ + :ivar display_name: Display name of the Trait, which is unique within the Trait Group. Trait names are normalized to lowerCamelCase naming conventions and can include letters, numbers, underscores, hyphens, and periods. They must start with a letter. + :ivar data_type: Data type of the Trait, such as STRING, NUMBER, BOOLEAN, ARRAY. For DELETE operations in PATCH requests, set this to an empty string (\"\") to mark the trait for deletion. + :ivar description: Description of the Trait, providing additional context or information. + :ivar id_type_promotion: The name of the identifier type to promote the trait value to, such as ''email'', ''phone'', ''user_id'', etc. This allows the trait to be mapped to an identifier in Identity Resolution. The identifier type should be configured in the Identity Resolution Settings. + """ + + def __init__(self, payload: Dict[str, Any]): + self.display_name: Optional[str] = payload.get("display_name") + self.data_type: Optional[str] = payload.get("data_type") + self.description: Optional[str] = payload.get("description") + self.id_type_promotion: Optional[str] = payload.get("id_type_promotion") + + def to_dict(self): + return { + "": self.display_name, + "": self.data_type, + "": self.description, + "": self.id_type_promotion, + } + + class TraitGroupCoreTraitsValue(object): + """ + :ivar display_name: Display name of the Trait, which is unique within the Trait Group. Trait names are normalized to lowerCamelCase naming conventions and can include letters, numbers, underscores, hyphens, and periods. They must start with a letter. + :ivar data_type: Data type of the Trait, such as STRING, NUMBER, BOOLEAN, ARRAY. For DELETE operations in PATCH requests, set this to an empty string (\"\") to mark the trait for deletion. + :ivar description: Description of the Trait, providing additional context or information. + :ivar validation_rule: + :ivar id_type_promotion: The name of the identifier type to promote the trait value to, such as ''email'', ''phone'', ''user_id'', etc. This allows the trait to be mapped to an identifier in Identity Resolution. The identifier type should be configured in the Identity Resolution Settings. + """ + + def __init__(self, payload: Dict[str, Any]): + self.display_name: Optional[str] = payload.get("display_name") + self.data_type: Optional[str] = payload.get("data_type") + self.description: Optional[str] = payload.get("description") + self.validation_rule: Optional[ValidationRule] = payload.get( + "validation_rule" + ) + self.id_type_promotion: Optional[str] = payload.get("id_type_promotion") + + def to_dict(self): + return { + "": self.display_name, + "": self.data_type, + "": self.description, + "": self.validation_rule.to_dict() + if self.validation_rule is not None + else None, + "": self.id_type_promotion, + } + + class TraitGroupRequest(object): + """ + :ivar display_name: Unique name of the Trait Group + :ivar description: description of the Trait Group + :ivar traits: Map of traits belonging to this Trait Group, keyed by trait name. + """ + + def __init__(self, payload: Dict[str, Any]): + self.display_name: Optional[str] = payload.get("display_name") + self.description: Optional[str] = payload.get("description") + self.traits: Optional[Dict[str, TraitGroupCoreTraitsValue]] = payload.get( + "traits" + ) + + def to_dict(self): + return { + "display_name": self.display_name, + "description": self.description, + "traits": [traits.to_dict() for traits in self.traits] + if self.traits is not None + else None, + } + + class UpdateTraitGroupRequest(object): + """ + :ivar description: Updated description of the Trait Group + :ivar traits: Map of traits to add, update, or remove in this Trait Group, where the key is the trait name. - To update/add a trait: provide the complete TraitDefinition object - To remove a trait: set dataType to an empty string (\"\") + """ + + def __init__(self, payload: Dict[str, Any]): + self.description: Optional[str] = payload.get("description") + self.traits: Optional[Dict[str, TraitDefinition]] = payload.get("traits") + + def to_dict(self): + return { + "description": self.description, + "traits": [traits.to_dict() for traits in self.traits] + if self.traits is not None + else None, + } + + class ValidationRule(object): + """ + :ivar pattern: Regex pattern (max 1000 chars) + :ivar min_length: Minimum string length + :ivar max_length: Maximum string length + :ivar rule_type: Discriminator field indicating this is an array validation rule. + :ivar min: Minimum value + :ivar max: Maximum value + :ivar min_items: Minimum number of items + :ivar max_items: Maximum number of items + """ + + def __init__(self, payload: Dict[str, Any]): + self.pattern: Optional[str] = payload.get("pattern") + self.min_length: Optional[int] = payload.get("min_length") + self.max_length: Optional[int] = payload.get("max_length") + self.rule_type: Optional[str] = payload.get("rule_type") + self.min: Optional[float] = payload.get("min") + self.max: Optional[float] = payload.get("max") + self.min_items: Optional[int] = payload.get("min_items") + self.max_items: Optional[int] = payload.get("max_items") + + def to_dict(self): + return { + "": self.pattern, + "": self.min_length, + "": self.max_length, + "": self.rule_type, + "": self.min, + "": self.max, + "": self.min_items, + "": self.max_items, + } + + def __init__(self, version: Version, store_id: str, trait_group_name: str): + """ + Initialize the TraitGroupContext + + :param version: Version that contains the resource + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + :param trait_group_name: A unique Name of the TraitGroup + """ + super().__init__(version) + + # Path Solution + self._solution = { + "store_id": store_id, + "trait_group_name": trait_group_name, + } + self._uri = ( + "/ControlPlane/Stores/{store_id}/TraitGroups/{trait_group_name}".format( + **self._solution + ) + ) + + def _create( + self, + prefer: Union[str, object] = values.unset, + trait_group_request: Union[TraitGroupRequest, object] = values.unset, + ) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = trait_group_request.to_dict() + + headers = values.of({}) + + if not (prefer is values.unset or (isinstance(prefer, str) and not prefer)): + headers["Prefer"] = prefer + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, + prefer: Union[str, object] = values.unset, + trait_group_request: Union[TraitGroupRequest, object] = values.unset, + ) -> TraitGroupInstance: + """ + Create the TraitGroupInstance + + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + :param trait_group_request: + + :returns: The created TraitGroupInstance + """ + payload, _, _ = self._create( + prefer=prefer, trait_group_request=trait_group_request + ) + return TraitGroupInstance( + self._version, + payload, + store_id=self._solution["store_id"], + trait_group_name=self._solution["trait_group_name"], + ) + + def create_with_http_info( + self, + prefer: Union[str, object] = values.unset, + trait_group_request: Union[TraitGroupRequest, object] = values.unset, + ) -> ApiResponse: + """ + Create the TraitGroupInstance and return response metadata + + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + :param trait_group_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create( + prefer=prefer, trait_group_request=trait_group_request + ) + instance = TraitGroupInstance( + self._version, + payload, + store_id=self._solution["store_id"], + trait_group_name=self._solution["trait_group_name"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async( + self, + prefer: Union[str, object] = values.unset, + trait_group_request: Union[TraitGroupRequest, object] = values.unset, + ) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = trait_group_request.to_dict() + + headers = values.of({}) + + if not (prefer is values.unset or (isinstance(prefer, str) and not prefer)): + headers["Prefer"] = prefer + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, + prefer: Union[str, object] = values.unset, + trait_group_request: Union[TraitGroupRequest, object] = values.unset, + ) -> TraitGroupInstance: + """ + Asynchronous coroutine to create the TraitGroupInstance + + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + :param trait_group_request: + + :returns: The created TraitGroupInstance + """ + payload, _, _ = await self._create_async( + prefer=prefer, trait_group_request=trait_group_request + ) + return TraitGroupInstance( + self._version, + payload, + store_id=self._solution["store_id"], + trait_group_name=self._solution["trait_group_name"], + ) + + async def create_with_http_info_async( + self, + prefer: Union[str, object] = values.unset, + trait_group_request: Union[TraitGroupRequest, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to create the TraitGroupInstance and return response metadata + + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + :param trait_group_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + prefer=prefer, trait_group_request=trait_group_request + ) + instance = TraitGroupInstance( + self._version, + payload, + store_id=self._solution["store_id"], + trait_group_name=self._solution["trait_group_name"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def _delete(self, prefer: Union[str, object] = values.unset) -> tuple: + """ + Internal helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + headers = values.of( + { + "Prefer": prefer, + } + ) + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.delete_with_response_info( + method="DELETE", uri=self._uri, headers=headers + ) + + def delete(self, prefer: Union[str, object] = values.unset) -> bool: + """ + Deletes the TraitGroupInstance + + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = self._delete(prefer=prefer) + return success + + def delete_with_http_info( + self, prefer: Union[str, object] = values.unset + ) -> ApiResponse: + """ + Deletes the TraitGroupInstance and return response metadata + + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = self._delete(prefer=prefer) + return ApiResponse(data=success, status_code=status_code, headers=headers) + + async def _delete_async(self, prefer: Union[str, object] = values.unset) -> tuple: + """ + Internal async helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + headers = values.of( + { + "Prefer": prefer, + } + ) + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.delete_with_response_info_async( + method="DELETE", uri=self._uri, headers=headers + ) + + async def delete_async(self, prefer: Union[str, object] = values.unset) -> bool: + """ + Asynchronous coroutine that deletes the TraitGroupInstance + + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = await self._delete_async(prefer=prefer) + return success + + async def delete_with_http_info_async( + self, prefer: Union[str, object] = values.unset + ) -> ApiResponse: + """ + Asynchronous coroutine that deletes the TraitGroupInstance and return response metadata + + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = await self._delete_async(prefer=prefer) + return ApiResponse(data=success, status_code=status_code, headers=headers) + + def _fetch( + self, + include_traits: Union[bool, object] = values.unset, + page_size: Union[int, object] = values.unset, + page_token: Union[str, object] = values.unset, + order_by: Union[str, object] = values.unset, + ) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + params = values.of( + { + "includeTraits": serialize.boolean_to_string(include_traits), + "pageSize": page_size, + "pageToken": page_token, + "orderBy": order_by, + } + ) + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, params=params, headers=headers + ) + + def fetch( + self, + include_traits: Union[bool, object] = values.unset, + page_size: Union[int, object] = values.unset, + page_token: Union[str, object] = values.unset, + order_by: Union[str, object] = values.unset, + ) -> TraitGroupInstance: + """ + Fetch the TraitGroupInstance + + :param include_traits: Whether to include trait definitions in the response + :param page_size: The maximum number of items to return per page, maximum of 100. + :param page_token: The token for the page of results to retrieve. + :param order_by: Either 'ASC' or 'DESC' to sort results ascending or descending respectively. + + :returns: The fetched TraitGroupInstance + """ + payload, _, _ = self._fetch( + include_traits=include_traits, + page_size=page_size, + page_token=page_token, + order_by=order_by, + ) + return TraitGroupInstance( + self._version, + payload, + store_id=self._solution["store_id"], + trait_group_name=self._solution["trait_group_name"], + ) + + def fetch_with_http_info( + self, + include_traits: Union[bool, object] = values.unset, + page_size: Union[int, object] = values.unset, + page_token: Union[str, object] = values.unset, + order_by: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Fetch the TraitGroupInstance and return response metadata + + :param include_traits: Whether to include trait definitions in the response + :param page_size: The maximum number of items to return per page, maximum of 100. + :param page_token: The token for the page of results to retrieve. + :param order_by: Either 'ASC' or 'DESC' to sort results ascending or descending respectively. + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch( + include_traits=include_traits, + page_size=page_size, + page_token=page_token, + order_by=order_by, + ) + instance = TraitGroupInstance( + self._version, + payload, + store_id=self._solution["store_id"], + trait_group_name=self._solution["trait_group_name"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async( + self, + include_traits: Union[bool, object] = values.unset, + page_size: Union[int, object] = values.unset, + page_token: Union[str, object] = values.unset, + order_by: Union[str, object] = values.unset, + ) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + params = values.of( + { + "includeTraits": serialize.boolean_to_string(include_traits), + "pageSize": page_size, + "pageToken": page_token, + "orderBy": order_by, + } + ) + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, params=params, headers=headers + ) + + async def fetch_async( + self, + include_traits: Union[bool, object] = values.unset, + page_size: Union[int, object] = values.unset, + page_token: Union[str, object] = values.unset, + order_by: Union[str, object] = values.unset, + ) -> TraitGroupInstance: + """ + Asynchronous coroutine to fetch the TraitGroupInstance + + :param include_traits: Whether to include trait definitions in the response + :param page_size: The maximum number of items to return per page, maximum of 100. + :param page_token: The token for the page of results to retrieve. + :param order_by: Either 'ASC' or 'DESC' to sort results ascending or descending respectively. + + :returns: The fetched TraitGroupInstance + """ + payload, _, _ = await self._fetch_async( + include_traits=include_traits, + page_size=page_size, + page_token=page_token, + order_by=order_by, + ) + return TraitGroupInstance( + self._version, + payload, + store_id=self._solution["store_id"], + trait_group_name=self._solution["trait_group_name"], + ) + + async def fetch_with_http_info_async( + self, + include_traits: Union[bool, object] = values.unset, + page_size: Union[int, object] = values.unset, + page_token: Union[str, object] = values.unset, + order_by: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to fetch the TraitGroupInstance and return response metadata + + :param include_traits: Whether to include trait definitions in the response + :param page_size: The maximum number of items to return per page, maximum of 100. + :param page_token: The token for the page of results to retrieve. + :param order_by: Either 'ASC' or 'DESC' to sort results ascending or descending respectively. + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async( + include_traits=include_traits, + page_size=page_size, + page_token=page_token, + order_by=order_by, + ) + instance = TraitGroupInstance( + self._version, + payload, + store_id=self._solution["store_id"], + trait_group_name=self._solution["trait_group_name"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def _update( + self, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + update_trait_group_request: Union[ + UpdateTraitGroupRequest, object + ] = values.unset, + ) -> tuple: + """ + Internal helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = update_trait_group_request.to_dict() + + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + if not (prefer is values.unset or (isinstance(prefer, str) and not prefer)): + headers["Prefer"] = prefer + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.update_with_response_info( + method="PATCH", uri=self._uri, data=data, headers=headers + ) + + def update( + self, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + update_trait_group_request: Union[ + UpdateTraitGroupRequest, object + ] = values.unset, + ) -> TraitGroupInstance: + """ + Update the TraitGroupInstance + + :param if_match: Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches one provided, preventing accidental overwrites and responding with 412 Precondition Failed if they don't match. + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + :param update_trait_group_request: + + :returns: The updated TraitGroupInstance + """ + payload, _, _ = self._update( + if_match=if_match, + prefer=prefer, + update_trait_group_request=update_trait_group_request, + ) + return TraitGroupInstance( + self._version, + payload, + store_id=self._solution["store_id"], + trait_group_name=self._solution["trait_group_name"], + ) + + def update_with_http_info( + self, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + update_trait_group_request: Union[ + UpdateTraitGroupRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Update the TraitGroupInstance and return response metadata + + :param if_match: Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches one provided, preventing accidental overwrites and responding with 412 Precondition Failed if they don't match. + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + :param update_trait_group_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._update( + if_match=if_match, + prefer=prefer, + update_trait_group_request=update_trait_group_request, + ) + instance = TraitGroupInstance( + self._version, + payload, + store_id=self._solution["store_id"], + trait_group_name=self._solution["trait_group_name"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _update_async( + self, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + update_trait_group_request: Union[ + UpdateTraitGroupRequest, object + ] = values.unset, + ) -> tuple: + """ + Internal async helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = update_trait_group_request.to_dict() + + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + if not (prefer is values.unset or (isinstance(prefer, str) and not prefer)): + headers["Prefer"] = prefer + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.update_with_response_info_async( + method="PATCH", uri=self._uri, data=data, headers=headers + ) + + async def update_async( + self, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + update_trait_group_request: Union[ + UpdateTraitGroupRequest, object + ] = values.unset, + ) -> TraitGroupInstance: + """ + Asynchronous coroutine to update the TraitGroupInstance + + :param if_match: Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches one provided, preventing accidental overwrites and responding with 412 Precondition Failed if they don't match. + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + :param update_trait_group_request: + + :returns: The updated TraitGroupInstance + """ + payload, _, _ = await self._update_async( + if_match=if_match, + prefer=prefer, + update_trait_group_request=update_trait_group_request, + ) + return TraitGroupInstance( + self._version, + payload, + store_id=self._solution["store_id"], + trait_group_name=self._solution["trait_group_name"], + ) + + async def update_with_http_info_async( + self, + if_match: Union[str, object] = values.unset, + prefer: Union[str, object] = values.unset, + update_trait_group_request: Union[ + UpdateTraitGroupRequest, object + ] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to update the TraitGroupInstance and return response metadata + + :param if_match: Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches one provided, preventing accidental overwrites and responding with 412 Precondition Failed if they don't match. + :param prefer: Allows specifying a preference for waiting for completion of the operation before responding. Set **respond-async; wait=X**, where **X** is the number of seconds for the server to wait. The operation will return a 2xx success code if it completes within the specified wait time, otherwise a 202 Accepted is returned and processing continues asynchronously. + :param update_trait_group_request: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._update_async( + if_match=if_match, + prefer=prefer, + update_trait_group_request=update_trait_group_request, + ) + instance = TraitGroupInstance( + self._version, + payload, + store_id=self._solution["store_id"], + trait_group_name=self._solution["trait_group_name"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class TraitGroupPage(TokenPagination): + def get_instance(self, payload: Dict[str, Any]) -> TraitGroupInstance: + """ + Build an instance of TraitGroupInstance + + :param payload: Payload response from the API + """ + return TraitGroupInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class TraitGroupList(ListResource): + class TraitDefinition(object): + """ + :ivar display_name: Display name of the Trait, which is unique within the Trait Group. Trait names are normalized to lowerCamelCase naming conventions and can include letters, numbers, underscores, hyphens, and periods. They must start with a letter. + :ivar data_type: Data type of the Trait, such as STRING, NUMBER, BOOLEAN, ARRAY. For DELETE operations in PATCH requests, set this to an empty string (\"\") to mark the trait for deletion. + :ivar description: Description of the Trait, providing additional context or information. + :ivar id_type_promotion: The name of the identifier type to promote the trait value to, such as ''email'', ''phone'', ''user_id'', etc. This allows the trait to be mapped to an identifier in Identity Resolution. The identifier type should be configured in the Identity Resolution Settings. + """ + + def __init__(self, payload: Dict[str, Any]): + self.display_name: Optional[str] = payload.get("display_name") + self.data_type: Optional[str] = payload.get("data_type") + self.description: Optional[str] = payload.get("description") + self.id_type_promotion: Optional[str] = payload.get("id_type_promotion") + + def to_dict(self): + return { + "": self.display_name, + "": self.data_type, + "": self.description, + "": self.id_type_promotion, + } + + class TraitGroupCoreTraitsValue(object): + """ + :ivar display_name: Display name of the Trait, which is unique within the Trait Group. Trait names are normalized to lowerCamelCase naming conventions and can include letters, numbers, underscores, hyphens, and periods. They must start with a letter. + :ivar data_type: Data type of the Trait, such as STRING, NUMBER, BOOLEAN, ARRAY. For DELETE operations in PATCH requests, set this to an empty string (\"\") to mark the trait for deletion. + :ivar description: Description of the Trait, providing additional context or information. + :ivar validation_rule: + :ivar id_type_promotion: The name of the identifier type to promote the trait value to, such as ''email'', ''phone'', ''user_id'', etc. This allows the trait to be mapped to an identifier in Identity Resolution. The identifier type should be configured in the Identity Resolution Settings. + """ + + def __init__(self, payload: Dict[str, Any]): + self.display_name: Optional[str] = payload.get("display_name") + self.data_type: Optional[str] = payload.get("data_type") + self.description: Optional[str] = payload.get("description") + self.validation_rule: Optional[ValidationRule] = payload.get( + "validation_rule" + ) + self.id_type_promotion: Optional[str] = payload.get("id_type_promotion") + + def to_dict(self): + return { + "": self.display_name, + "": self.data_type, + "": self.description, + "": self.validation_rule.to_dict() + if self.validation_rule is not None + else None, + "": self.id_type_promotion, + } + + class TraitGroupRequest(object): + """ + :ivar display_name: Unique name of the Trait Group + :ivar description: description of the Trait Group + :ivar traits: Map of traits belonging to this Trait Group, keyed by trait name. + """ + + def __init__(self, payload: Dict[str, Any]): + self.display_name: Optional[str] = payload.get("display_name") + self.description: Optional[str] = payload.get("description") + self.traits: Optional[Dict[str, TraitGroupCoreTraitsValue]] = payload.get( + "traits" + ) + + def to_dict(self): + return { + "display_name": self.display_name, + "description": self.description, + "traits": [traits.to_dict() for traits in self.traits] + if self.traits is not None + else None, + } + + class UpdateTraitGroupRequest(object): + """ + :ivar description: Updated description of the Trait Group + :ivar traits: Map of traits to add, update, or remove in this Trait Group, where the key is the trait name. - To update/add a trait: provide the complete TraitDefinition object - To remove a trait: set dataType to an empty string (\"\") + """ + + def __init__(self, payload: Dict[str, Any]): + self.description: Optional[str] = payload.get("description") + self.traits: Optional[Dict[str, TraitDefinition]] = payload.get("traits") + + def to_dict(self): + return { + "description": self.description, + "traits": [traits.to_dict() for traits in self.traits] + if self.traits is not None + else None, + } + + class ValidationRule(object): + """ + :ivar pattern: Regex pattern (max 1000 chars) + :ivar min_length: Minimum string length + :ivar max_length: Maximum string length + :ivar rule_type: Discriminator field indicating this is an array validation rule. + :ivar min: Minimum value + :ivar max: Maximum value + :ivar min_items: Minimum number of items + :ivar max_items: Maximum number of items + """ + + def __init__(self, payload: Dict[str, Any]): + self.pattern: Optional[str] = payload.get("pattern") + self.min_length: Optional[int] = payload.get("min_length") + self.max_length: Optional[int] = payload.get("max_length") + self.rule_type: Optional[str] = payload.get("rule_type") + self.min: Optional[float] = payload.get("min") + self.max: Optional[float] = payload.get("max") + self.min_items: Optional[int] = payload.get("min_items") + self.max_items: Optional[int] = payload.get("max_items") + + def to_dict(self): + return { + "": self.pattern, + "": self.min_length, + "": self.max_length, + "": self.rule_type, + "": self.min, + "": self.max, + "": self.min_items, + "": self.max_items, + } + + def __init__(self, version: Version): + """ + Initialize the TraitGroupList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, store_id: str, trait_group_name: str) -> TraitGroupContext: + """ + Constructs a TraitGroupContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + :param trait_group_name: A unique Name of the TraitGroup + """ + return TraitGroupContext( + self._version, store_id=store_id, trait_group_name=trait_group_name + ) + + def __call__(self, store_id: str, trait_group_name: str) -> TraitGroupContext: + """ + Constructs a TraitGroupContext + + :param store_id: A unique Memory Store ID using Twilio Type ID (TTID) format + :param trait_group_name: A unique Name of the TraitGroup + """ + return TraitGroupContext( + self._version, store_id=store_id, trait_group_name=trait_group_name + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/messaging/MessagingBase.py b/twilio/rest/messaging/MessagingBase.py index e45ed56fc..4e42ea01b 100644 --- a/twilio/rest/messaging/MessagingBase.py +++ b/twilio/rest/messaging/MessagingBase.py @@ -18,7 +18,6 @@ class MessagingBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Messaging Domain diff --git a/twilio/rest/messaging/v1/__init__.py b/twilio/rest/messaging/v1/__init__.py index 1e1100e32..3a4d4fea9 100644 --- a/twilio/rest/messaging/v1/__init__.py +++ b/twilio/rest/messaging/v1/__init__.py @@ -37,7 +37,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Messaging diff --git a/twilio/rest/messaging/v1/brand_registration/__init__.py b/twilio/rest/messaging/v1/brand_registration/__init__.py index 4fd33237a..c2e7b1375 100644 --- a/twilio/rest/messaging/v1/brand_registration/__init__.py +++ b/twilio/rest/messaging/v1/brand_registration/__init__.py @@ -12,6 +12,7 @@ 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 @@ -28,7 +29,6 @@ class BrandRegistrationInstance(InstanceResource): - class BrandFeedback(object): TAX_ID = "TAX_ID" STOCK_SYMBOL = "STOCK_SYMBOL" @@ -108,9 +108,9 @@ def __init__( self.brand_feedback: Optional[ List["BrandRegistrationInstance.BrandFeedback"] ] = payload.get("brand_feedback") - self.identity_status: Optional["BrandRegistrationInstance.IdentityStatus"] = ( - payload.get("identity_status") - ) + self.identity_status: Optional[ + "BrandRegistrationInstance.IdentityStatus" + ] = payload.get("identity_status") self.russell_3000: Optional[bool] = payload.get("russell_3000") self.government_entity: Optional[bool] = payload.get("government_entity") self.tax_exempt_status: Optional[str] = payload.get("tax_exempt_status") @@ -237,7 +237,6 @@ def __repr__(self) -> str: class BrandRegistrationContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the BrandRegistrationContext @@ -465,7 +464,6 @@ def __repr__(self) -> str: class BrandRegistrationPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> BrandRegistrationInstance: """ Build an instance of BrandRegistrationInstance @@ -484,7 +482,6 @@ def __repr__(self) -> str: class BrandRegistrationList(ListResource): - def __init__(self, version: Version): """ Initialize the BrandRegistrationList @@ -1013,10 +1010,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = BrandRegistrationPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/messaging/v1/brand_registration/brand_registration_otp.py b/twilio/rest/messaging/v1/brand_registration/brand_registration_otp.py index 0ac2f302c..ffe0b1e28 100644 --- a/twilio/rest/messaging/v1/brand_registration/brand_registration_otp.py +++ b/twilio/rest/messaging/v1/brand_registration/brand_registration_otp.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class BrandRegistrationOtpInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Brand Registration resource. :ivar brand_registration_sid: The unique string to identify Brand Registration of Sole Proprietor Brand @@ -52,7 +54,6 @@ def __repr__(self) -> str: class BrandRegistrationOtpList(ListResource): - def __init__(self, version: Version, brand_registration_sid: str): """ Initialize the BrandRegistrationOtpList diff --git a/twilio/rest/messaging/v1/brand_registration/brand_vetting.py b/twilio/rest/messaging/v1/brand_registration/brand_vetting.py index 34c332a41..e7a4eaf04 100644 --- a/twilio/rest/messaging/v1/brand_registration/brand_vetting.py +++ b/twilio/rest/messaging/v1/brand_registration/brand_vetting.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class BrandVettingInstance(InstanceResource): - class VettingProvider(object): CAMPAIGN_VERIFY = "campaign-verify" AEGIS = "aegis" @@ -63,9 +63,9 @@ def __init__( self.vetting_id: Optional[str] = payload.get("vetting_id") self.vetting_class: Optional[str] = payload.get("vetting_class") self.vetting_status: Optional[str] = payload.get("vetting_status") - self.vetting_provider: Optional["BrandVettingInstance.VettingProvider"] = ( - payload.get("vetting_provider") - ) + self.vetting_provider: Optional[ + "BrandVettingInstance.VettingProvider" + ] = payload.get("vetting_provider") self.url: Optional[str] = payload.get("url") self._solution = { @@ -137,7 +137,6 @@ def __repr__(self) -> str: class BrandVettingContext(InstanceContext): - def __init__(self, version: Version, brand_sid: str, brand_vetting_sid: str): """ Initialize the BrandVettingContext @@ -264,7 +263,6 @@ def __repr__(self) -> str: class BrandVettingPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> BrandVettingInstance: """ Build an instance of BrandVettingInstance @@ -285,7 +283,6 @@ def __repr__(self) -> str: class BrandVettingList(ListResource): - def __init__(self, version: Version, brand_sid: str): """ Initialize the BrandVettingList @@ -835,10 +832,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = BrandVettingPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/messaging/v1/deactivations.py b/twilio/rest/messaging/v1/deactivations.py index ddcbff4af..361898fdc 100644 --- a/twilio/rest/messaging/v1/deactivations.py +++ b/twilio/rest/messaging/v1/deactivations.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import date from typing import Any, Dict, Optional, Union from twilio.base import serialize, values @@ -23,6 +24,7 @@ class DeactivationsInstance(InstanceResource): + """ :ivar redirect_to: Returns an authenticated url that redirects to a file containing the deactivated numbers for the requested day. This url is valid for up to two minutes. """ @@ -115,7 +117,6 @@ def __repr__(self) -> str: class DeactivationsContext(InstanceContext): - def __init__(self, version: Version): """ Initialize the DeactivationsContext @@ -245,7 +246,6 @@ def __repr__(self) -> str: class DeactivationsList(ListResource): - def __init__(self, version: Version): """ Initialize the DeactivationsList diff --git a/twilio/rest/messaging/v1/domain_certs.py b/twilio/rest/messaging/v1/domain_certs.py index 776d09faa..c6896ce7d 100644 --- a/twilio/rest/messaging/v1/domain_certs.py +++ b/twilio/rest/messaging/v1/domain_certs.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional from twilio.base import deserialize, values @@ -23,6 +24,7 @@ class DomainCertsInstance(InstanceResource): + """ :ivar domain_sid: The unique string that we created to identify the Domain resource. :ivar date_updated: Date that this Domain was last updated. @@ -210,7 +212,6 @@ def __repr__(self) -> str: class DomainCertsContext(InstanceContext): - def __init__(self, version: Version, domain_sid: str): """ Initialize the DomainCertsContext @@ -497,7 +498,6 @@ def __repr__(self) -> str: class DomainCertsList(ListResource): - def __init__(self, version: Version): """ Initialize the DomainCertsList diff --git a/twilio/rest/messaging/v1/domain_config.py b/twilio/rest/messaging/v1/domain_config.py index 6bc9d0a0c..e9d898858 100644 --- a/twilio/rest/messaging/v1/domain_config.py +++ b/twilio/rest/messaging/v1/domain_config.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, serialize, values @@ -23,6 +24,7 @@ class DomainConfigInstance(InstanceResource): + """ :ivar domain_sid: The unique string that we created to identify the Domain resource. :ivar config_sid: The unique string that we created to identify the Domain config (prefix ZK). @@ -220,7 +222,6 @@ def __repr__(self) -> str: class DomainConfigContext(InstanceContext): - def __init__(self, version: Version, domain_sid: str): """ Initialize the DomainConfigContext @@ -513,7 +514,6 @@ def __repr__(self) -> str: class DomainConfigList(ListResource): - def __init__(self, version: Version): """ Initialize the DomainConfigList diff --git a/twilio/rest/messaging/v1/domain_config_messaging_service.py b/twilio/rest/messaging/v1/domain_config_messaging_service.py index 2bc55c4bf..aabc266c2 100644 --- a/twilio/rest/messaging/v1/domain_config_messaging_service.py +++ b/twilio/rest/messaging/v1/domain_config_messaging_service.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional from twilio.base import deserialize, values @@ -23,6 +24,7 @@ class DomainConfigMessagingServiceInstance(InstanceResource): + """ :ivar domain_sid: The unique string that we created to identify the Domain resource. :ivar config_sid: The unique string that we created to identify the Domain config (prefix ZK). @@ -127,7 +129,6 @@ def __repr__(self) -> str: class DomainConfigMessagingServiceContext(InstanceContext): - def __init__(self, version: Version, messaging_service_sid: str): """ Initialize the DomainConfigMessagingServiceContext @@ -248,7 +249,6 @@ def __repr__(self) -> str: class DomainConfigMessagingServiceList(ListResource): - def __init__(self, version: Version): """ Initialize the DomainConfigMessagingServiceList diff --git a/twilio/rest/messaging/v1/domain_validate_dn.py b/twilio/rest/messaging/v1/domain_validate_dn.py index 9e55b9ca2..6b0aa29e4 100644 --- a/twilio/rest/messaging/v1/domain_validate_dn.py +++ b/twilio/rest/messaging/v1/domain_validate_dn.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class DomainValidateDnInstance(InstanceResource): + """ :ivar domain_sid: The unique string that we created to identify the Domain resource. :ivar is_valid: @@ -109,7 +111,6 @@ def __repr__(self) -> str: class DomainValidateDnContext(InstanceContext): - def __init__(self, version: Version, domain_sid: str): """ Initialize the DomainValidateDnContext @@ -228,7 +229,6 @@ def __repr__(self) -> str: class DomainValidateDnList(ListResource): - def __init__(self, version: Version): """ Initialize the DomainValidateDnList diff --git a/twilio/rest/messaging/v1/external_campaign.py b/twilio/rest/messaging/v1/external_campaign.py index dd16e8031..1e32bae70 100644 --- a/twilio/rest/messaging/v1/external_campaign.py +++ b/twilio/rest/messaging/v1/external_campaign.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, serialize, values @@ -23,6 +24,7 @@ class ExternalCampaignInstance(InstanceResource): + """ :ivar sid: The unique string that identifies a US A2P Compliance resource `QE2c6890da8086d771620e9b13fadeba0b`. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Campaign belongs to. @@ -53,7 +55,6 @@ def __repr__(self) -> str: class ExternalCampaignList(ListResource): - def __init__(self, version: Version): """ Initialize the ExternalCampaignList diff --git a/twilio/rest/messaging/v1/linkshortening_messaging_service.py b/twilio/rest/messaging/v1/linkshortening_messaging_service.py index ee1c2e9f9..40c0fc383 100644 --- a/twilio/rest/messaging/v1/linkshortening_messaging_service.py +++ b/twilio/rest/messaging/v1/linkshortening_messaging_service.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class LinkshorteningMessagingServiceInstance(InstanceResource): + """ :ivar domain_sid: The unique string identifies the domain resource :ivar messaging_service_sid: The unique string that identifies the messaging service @@ -149,7 +151,6 @@ def __repr__(self) -> str: class LinkshorteningMessagingServiceContext(InstanceContext): - def __init__(self, version: Version, domain_sid: str, messaging_service_sid: str): """ Initialize the LinkshorteningMessagingServiceContext @@ -346,7 +347,6 @@ def __repr__(self) -> str: class LinkshorteningMessagingServiceList(ListResource): - def __init__(self, version: Version): """ Initialize the LinkshorteningMessagingServiceList diff --git a/twilio/rest/messaging/v1/linkshortening_messaging_service_domain_association.py b/twilio/rest/messaging/v1/linkshortening_messaging_service_domain_association.py index e06ec925b..f01a5406a 100644 --- a/twilio/rest/messaging/v1/linkshortening_messaging_service_domain_association.py +++ b/twilio/rest/messaging/v1/linkshortening_messaging_service_domain_association.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class LinkshorteningMessagingServiceDomainAssociationInstance(InstanceResource): + """ :ivar domain_sid: The unique string that we created to identify the Domain resource. :ivar messaging_service_sid: The unique string that identifies the messaging service @@ -114,7 +116,6 @@ def __repr__(self) -> str: class LinkshorteningMessagingServiceDomainAssociationContext(InstanceContext): - def __init__(self, version: Version, messaging_service_sid: str): """ Initialize the LinkshorteningMessagingServiceDomainAssociationContext @@ -239,7 +240,6 @@ def __repr__(self) -> str: class LinkshorteningMessagingServiceDomainAssociationList(ListResource): - def __init__(self, version: Version): """ Initialize the LinkshorteningMessagingServiceDomainAssociationList diff --git a/twilio/rest/messaging/v1/request_managed_cert.py b/twilio/rest/messaging/v1/request_managed_cert.py index b55327712..aa9765682 100644 --- a/twilio/rest/messaging/v1/request_managed_cert.py +++ b/twilio/rest/messaging/v1/request_managed_cert.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional from twilio.base import deserialize, values @@ -23,6 +24,7 @@ class RequestManagedCertInstance(InstanceResource): + """ :ivar domain_sid: The unique string that we created to identify the Domain resource. :ivar date_updated: Date that this Domain was last updated. @@ -126,7 +128,6 @@ def __repr__(self) -> str: class RequestManagedCertContext(InstanceContext): - def __init__(self, version: Version, domain_sid: str): """ Initialize the RequestManagedCertContext @@ -239,7 +240,6 @@ def __repr__(self) -> str: class RequestManagedCertList(ListResource): - def __init__(self, version: Version): """ Initialize the RequestManagedCertList diff --git a/twilio/rest/messaging/v1/service/__init__.py b/twilio/rest/messaging/v1/service/__init__.py index 0456e7f8d..e76f96549 100644 --- a/twilio/rest/messaging/v1/service/__init__.py +++ b/twilio/rest/messaging/v1/service/__init__.py @@ -12,6 +12,7 @@ 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 @@ -21,11 +22,14 @@ from twilio.base.list_resource import ListResource from twilio.base.version import Version from twilio.base.page import Page +from twilio.rest.messaging.v1.service.add_on import AddOnList from twilio.rest.messaging.v1.service.alpha_sender import AlphaSenderList from twilio.rest.messaging.v1.service.channel_sender import ChannelSenderList from twilio.rest.messaging.v1.service.destination_alpha_sender import ( DestinationAlphaSenderList, ) +from twilio.rest.messaging.v1.service.message import MessageList +from twilio.rest.messaging.v1.service.numbers_and_sender import NumbersAndSenderList from twilio.rest.messaging.v1.service.phone_number import PhoneNumberList from twilio.rest.messaging.v1.service.short_code import ShortCodeList from twilio.rest.messaging.v1.service.us_app_to_person import UsAppToPersonList @@ -35,7 +39,6 @@ class ServiceInstance(InstanceResource): - class ScanMessageContent(object): INHERIT = "inherit" ENABLE = "enable" @@ -65,6 +68,7 @@ class ScanMessageContent(object): :ivar usecase: A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. :ivar us_app_to_person_registered: Whether US A2P campaign is registered for this Service. :ivar use_inbound_webhook_on_number: A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. + :ivar sending_windows: A list of Sending Windows, which indicate defined time ranges in which a message can be sent, in the UTC time zone. Each window is defined by two strings, labeled \"start_time\" and \"end_time\". """ def __init__( @@ -89,9 +93,9 @@ def __init__( self.sticky_sender: Optional[bool] = payload.get("sticky_sender") self.mms_converter: Optional[bool] = payload.get("mms_converter") self.smart_encoding: Optional[bool] = payload.get("smart_encoding") - self.scan_message_content: Optional["ServiceInstance.ScanMessageContent"] = ( - payload.get("scan_message_content") - ) + self.scan_message_content: Optional[ + "ServiceInstance.ScanMessageContent" + ] = payload.get("scan_message_content") self.fallback_to_long_code: Optional[bool] = payload.get( "fallback_to_long_code" ) @@ -111,6 +115,9 @@ def __init__( self.use_inbound_webhook_on_number: Optional[bool] = payload.get( "use_inbound_webhook_on_number" ) + self.sending_windows: Optional[Dict[str, object]] = payload.get( + "sending_windows" + ) self._solution = { "sid": sid or self.sid, @@ -452,6 +459,13 @@ async def update_with_http_info_async( use_inbound_webhook_on_number=use_inbound_webhook_on_number, ) + @property + def add_ons(self) -> AddOnList: + """ + Access the add_ons + """ + return self._proxy.add_ons + @property def alpha_senders(self) -> AlphaSenderList: """ @@ -473,6 +487,20 @@ def destination_alpha_senders(self) -> DestinationAlphaSenderList: """ return self._proxy.destination_alpha_senders + @property + def messages(self) -> MessageList: + """ + Access the messages + """ + return self._proxy.messages + + @property + def numbers_and_senders(self) -> NumbersAndSenderList: + """ + Access the numbers_and_senders + """ + return self._proxy.numbers_and_senders + @property def phone_numbers(self) -> PhoneNumberList: """ @@ -512,7 +540,6 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -528,9 +555,12 @@ def __init__(self, version: Version, sid: str): } self._uri = "/Services/{sid}".format(**self._solution) + self._add_ons: Optional[AddOnList] = None self._alpha_senders: Optional[AlphaSenderList] = None self._channel_senders: Optional[ChannelSenderList] = None self._destination_alpha_senders: Optional[DestinationAlphaSenderList] = None + self._messages: Optional[MessageList] = None + self._numbers_and_senders: Optional[NumbersAndSenderList] = None self._phone_numbers: Optional[PhoneNumberList] = None self._short_codes: Optional[ShortCodeList] = None self._us_app_to_person: Optional[UsAppToPersonList] = None @@ -1076,6 +1106,18 @@ async def update_with_http_info_async( instance = ServiceInstance(self._version, payload, sid=self._solution["sid"]) return ApiResponse(data=instance, status_code=status_code, headers=headers) + @property + def add_ons(self) -> AddOnList: + """ + Access the add_ons + """ + if self._add_ons is None: + self._add_ons = AddOnList( + self._version, + self._solution["sid"], + ) + return self._add_ons + @property def alpha_senders(self) -> AlphaSenderList: """ @@ -1112,6 +1154,30 @@ def destination_alpha_senders(self) -> DestinationAlphaSenderList: ) return self._destination_alpha_senders + @property + def messages(self) -> MessageList: + """ + Access the messages + """ + if self._messages is None: + self._messages = MessageList( + self._version, + self._solution["sid"], + ) + return self._messages + + @property + def numbers_and_senders(self) -> NumbersAndSenderList: + """ + Access the numbers_and_senders + """ + if self._numbers_and_senders is None: + self._numbers_and_senders = NumbersAndSenderList( + self._version, + self._solution["sid"], + ) + return self._numbers_and_senders + @property def phone_numbers(self) -> PhoneNumberList: """ @@ -1171,7 +1237,6 @@ def __repr__(self) -> str: class ServicePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -1190,7 +1255,6 @@ def __repr__(self) -> str: class ServiceList(ListResource): - def __init__(self, version: Version): """ Initialize the ServiceList @@ -1915,10 +1979,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ServicePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/messaging/v1/service/add_on.py b/twilio/rest/messaging/v1/service/add_on.py new file mode 100644 index 000000000..8fb6ea9c0 --- /dev/null +++ b/twilio/rest/messaging/v1/service/add_on.py @@ -0,0 +1,974 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.api_response import ApiResponse +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 AddOnInstance(InstanceResource): + + """ + :ivar sid: The unique string that we created to identify the add on resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the add on resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar add_on_type_sid: The SID that identifies the add on type. + :ivar add_on_config: The config of the add on in JSON string format. + :ivar url: The absolute URL of the add on resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.add_on_type_sid: Optional[str] = payload.get("add_on_type_sid") + self.add_on_config: Optional[str] = payload.get("add_on_config") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "service_sid": service_sid, + "sid": sid or self.sid, + } + self._context: Optional[AddOnContext] = None + + @property + def _proxy(self) -> "AddOnContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: AddOnContext for this AddOnInstance + """ + if self._context is None: + self._context = AddOnContext( + self._version, + service_sid=self._solution["service_sid"], + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the AddOnInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the AddOnInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the AddOnInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return self._proxy.delete_with_http_info() + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the AddOnInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return await self._proxy.delete_with_http_info_async() + + def update(self, add_on_config: str) -> "AddOnInstance": + """ + Update the AddOnInstance + + :param add_on_config: Add on config in JSON format. + + :returns: The updated AddOnInstance + """ + return self._proxy.update( + add_on_config=add_on_config, + ) + + async def update_async(self, add_on_config: str) -> "AddOnInstance": + """ + Asynchronous coroutine to update the AddOnInstance + + :param add_on_config: Add on config in JSON format. + + :returns: The updated AddOnInstance + """ + return await self._proxy.update_async( + add_on_config=add_on_config, + ) + + def update_with_http_info(self, add_on_config: str) -> ApiResponse: + """ + Update the AddOnInstance with HTTP info + + :param add_on_config: Add on config in JSON format. + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.update_with_http_info( + add_on_config=add_on_config, + ) + + async def update_with_http_info_async(self, add_on_config: str) -> ApiResponse: + """ + Asynchronous coroutine to update the AddOnInstance with HTTP info + + :param add_on_config: Add on config in JSON format. + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.update_with_http_info_async( + add_on_config=add_on_config, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class AddOnContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): + """ + Initialize the AddOnContext + + :param version: Version that contains the resource + :param service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to fetch the resource from. + :param sid: The SID that identifies the add on to update. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "service_sid": service_sid, + "sid": sid, + } + self._uri = "/Services/{service_sid}/AddOns/{sid}".format(**self._solution) + + def _delete(self) -> tuple: + """ + Internal helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + return self._version.delete_with_response_info( + method="DELETE", uri=self._uri, headers=headers + ) + + def delete(self) -> bool: + """ + Deletes the AddOnInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = self._delete() + return success + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the AddOnInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = self._delete() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + async def _delete_async(self) -> tuple: + """ + Internal async helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + return await self._version.delete_with_response_info_async( + method="DELETE", uri=self._uri, headers=headers + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the AddOnInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = await self._delete_async() + return success + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the AddOnInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = await self._delete_async() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + def _update(self, add_on_config: str) -> tuple: + """ + Internal helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "addOnConfig": add_on_config, + } + ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return self._version.update_with_response_info( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + def update(self, add_on_config: str) -> AddOnInstance: + """ + Update the AddOnInstance + + :param add_on_config: Add on config in JSON format. + + :returns: The updated AddOnInstance + """ + payload, _, _ = self._update(add_on_config=add_on_config) + return AddOnInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + sid=self._solution["sid"], + ) + + def update_with_http_info(self, add_on_config: str) -> ApiResponse: + """ + Update the AddOnInstance and return response metadata + + :param add_on_config: Add on config in JSON format. + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._update(add_on_config=add_on_config) + instance = AddOnInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _update_async(self, add_on_config: str) -> tuple: + """ + Internal async helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "addOnConfig": add_on_config, + } + ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return await self._version.update_with_response_info_async( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + async def update_async(self, add_on_config: str) -> AddOnInstance: + """ + Asynchronous coroutine to update the AddOnInstance + + :param add_on_config: Add on config in JSON format. + + :returns: The updated AddOnInstance + """ + payload, _, _ = await self._update_async(add_on_config=add_on_config) + return AddOnInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + sid=self._solution["sid"], + ) + + async def update_with_http_info_async(self, add_on_config: str) -> ApiResponse: + """ + Asynchronous coroutine to update the AddOnInstance and return response metadata + + :param add_on_config: Add on config in JSON format. + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._update_async( + add_on_config=add_on_config + ) + instance = AddOnInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class AddOnPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> AddOnInstance: + """ + Build an instance of AddOnInstance + + :param payload: Payload response from the API + """ + return AddOnInstance( + self._version, payload, service_sid=self._solution["service_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class AddOnList(ListResource): + def __init__(self, version: Version, service_sid: str): + """ + Initialize the AddOnList + + :param version: Version that contains the resource + :param service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to read the resources from. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "service_sid": service_sid, + } + self._uri = "/Services/{service_sid}/AddOns".format(**self._solution) + + def _create( + self, + add_on_type_sid: str, + add_on_sid: Union[str, object] = values.unset, + add_on_config: Union[str, object] = values.unset, + ) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "addOnTypeSid": add_on_type_sid, + "addOnSid": add_on_sid, + "addOnConfig": add_on_config, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, + add_on_type_sid: str, + add_on_sid: Union[str, object] = values.unset, + add_on_config: Union[str, object] = values.unset, + ) -> AddOnInstance: + """ + Create the AddOnInstance + + :param add_on_type_sid: The SID of the add on type. + :param add_on_sid: The SID of the add on. + :param add_on_config: Add on config in JSON format. + + :returns: The created AddOnInstance + """ + payload, _, _ = self._create( + add_on_type_sid=add_on_type_sid, + add_on_sid=add_on_sid, + add_on_config=add_on_config, + ) + return AddOnInstance( + self._version, payload, service_sid=self._solution["service_sid"] + ) + + def create_with_http_info( + self, + add_on_type_sid: str, + add_on_sid: Union[str, object] = values.unset, + add_on_config: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Create the AddOnInstance and return response metadata + + :param add_on_type_sid: The SID of the add on type. + :param add_on_sid: The SID of the add on. + :param add_on_config: Add on config in JSON format. + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create( + add_on_type_sid=add_on_type_sid, + add_on_sid=add_on_sid, + add_on_config=add_on_config, + ) + instance = AddOnInstance( + self._version, payload, service_sid=self._solution["service_sid"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async( + self, + add_on_type_sid: str, + add_on_sid: Union[str, object] = values.unset, + add_on_config: Union[str, object] = values.unset, + ) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "addOnTypeSid": add_on_type_sid, + "addOnSid": add_on_sid, + "addOnConfig": add_on_config, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, + add_on_type_sid: str, + add_on_sid: Union[str, object] = values.unset, + add_on_config: Union[str, object] = values.unset, + ) -> AddOnInstance: + """ + Asynchronously create the AddOnInstance + + :param add_on_type_sid: The SID of the add on type. + :param add_on_sid: The SID of the add on. + :param add_on_config: Add on config in JSON format. + + :returns: The created AddOnInstance + """ + payload, _, _ = await self._create_async( + add_on_type_sid=add_on_type_sid, + add_on_sid=add_on_sid, + add_on_config=add_on_config, + ) + return AddOnInstance( + self._version, payload, service_sid=self._solution["service_sid"] + ) + + async def create_with_http_info_async( + self, + add_on_type_sid: str, + add_on_sid: Union[str, object] = values.unset, + add_on_config: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously create the AddOnInstance and return response metadata + + :param add_on_type_sid: The SID of the add on type. + :param add_on_sid: The SID of the add on. + :param add_on_config: Add on config in JSON format. + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + add_on_type_sid=add_on_type_sid, + add_on_sid=add_on_sid, + add_on_config=add_on_config, + ) + instance = AddOnInstance( + self._version, payload, service_sid=self._solution["service_sid"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[AddOnInstance]: + """ + Streams AddOnInstance 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[AddOnInstance]: + """ + Asynchronously streams AddOnInstance 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 stream_with_http_info( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams AddOnInstance and returns headers from first page + + + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info(page_size=limits["page_size"]) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams AddOnInstance and returns headers from first page + + + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + page_size=limits["page_size"] + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[AddOnInstance]: + """ + Lists AddOnInstance 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[AddOnInstance]: + """ + Asynchronously lists AddOnInstance 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 list_with_http_info( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists AddOnInstance and returns headers from first page + + + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists AddOnInstance and returns headers from first page + + + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> AddOnPage: + """ + Retrieve a single page of AddOnInstance 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 AddOnInstance + """ + 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 AddOnPage(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, + ) -> AddOnPage: + """ + Asynchronously retrieve a single page of AddOnInstance 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 AddOnInstance + """ + 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 AddOnPage(self._version, response, self._solution) + + def page_with_http_info( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :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: ApiResponse with AddOnPage, status code, and headers + """ + 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, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = AddOnPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :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: ApiResponse with AddOnPage, status code, and headers + """ + 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, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = AddOnPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> AddOnPage: + """ + Retrieve a specific page of AddOnInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of AddOnInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return AddOnPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> AddOnPage: + """ + Asynchronously retrieve a specific page of AddOnInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of AddOnInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return AddOnPage(self._version, response, self._solution) + + def get(self, sid: str) -> AddOnContext: + """ + Constructs a AddOnContext + + :param sid: The SID that identifies the add on to update. + """ + return AddOnContext( + self._version, service_sid=self._solution["service_sid"], sid=sid + ) + + def __call__(self, sid: str) -> AddOnContext: + """ + Constructs a AddOnContext + + :param sid: The SID that identifies the add on to update. + """ + return AddOnContext( + self._version, service_sid=self._solution["service_sid"], sid=sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/messaging/v1/service/alpha_sender.py b/twilio/rest/messaging/v1/service/alpha_sender.py index f1c20f9d1..058723a08 100644 --- a/twilio/rest/messaging/v1/service/alpha_sender.py +++ b/twilio/rest/messaging/v1/service/alpha_sender.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class AlphaSenderInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the AlphaSender resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AlphaSender resource. @@ -162,7 +164,6 @@ def __repr__(self) -> str: class AlphaSenderContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the AlphaSenderContext @@ -355,7 +356,6 @@ def __repr__(self) -> str: class AlphaSenderPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> AlphaSenderInstance: """ Build an instance of AlphaSenderInstance @@ -376,7 +376,6 @@ def __repr__(self) -> str: class AlphaSenderList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the AlphaSenderList @@ -826,10 +825,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AlphaSenderPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/messaging/v1/service/channel_sender.py b/twilio/rest/messaging/v1/service/channel_sender.py index a1d28767b..c3a70f76a 100644 --- a/twilio/rest/messaging/v1/service/channel_sender.py +++ b/twilio/rest/messaging/v1/service/channel_sender.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class ChannelSenderInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ChannelSender resource. :ivar messaging_service_sid: The SID of the [Service](https://www.twilio.com/docs/messaging/services) the resource is associated with. @@ -164,7 +166,6 @@ def __repr__(self) -> str: class ChannelSenderContext(InstanceContext): - def __init__(self, version: Version, messaging_service_sid: str, sid: str): """ Initialize the ChannelSenderContext @@ -357,7 +358,6 @@ def __repr__(self) -> str: class ChannelSenderPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ChannelSenderInstance: """ Build an instance of ChannelSenderInstance @@ -380,7 +380,6 @@ def __repr__(self) -> str: class ChannelSenderList(ListResource): - def __init__(self, version: Version, messaging_service_sid: str): """ Initialize the ChannelSenderList @@ -838,10 +837,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ChannelSenderPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/messaging/v1/service/destination_alpha_sender.py b/twilio/rest/messaging/v1/service/destination_alpha_sender.py index cb636857f..baf92e9f6 100644 --- a/twilio/rest/messaging/v1/service/destination_alpha_sender.py +++ b/twilio/rest/messaging/v1/service/destination_alpha_sender.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class DestinationAlphaSenderInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the AlphaSender resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AlphaSender resource. @@ -164,7 +166,6 @@ def __repr__(self) -> str: class DestinationAlphaSenderContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the DestinationAlphaSenderContext @@ -357,7 +358,6 @@ def __repr__(self) -> str: class DestinationAlphaSenderPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> DestinationAlphaSenderInstance: """ Build an instance of DestinationAlphaSenderInstance @@ -378,7 +378,6 @@ def __repr__(self) -> str: class DestinationAlphaSenderList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the DestinationAlphaSenderList @@ -892,10 +891,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = DestinationAlphaSenderPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/messaging/v1/service/message.py b/twilio/rest/messaging/v1/service/message.py new file mode 100644 index 000000000..098a68140 --- /dev/null +++ b/twilio/rest/messaging/v1/service/message.py @@ -0,0 +1,374 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from datetime import datetime +from typing import Any, Dict, List, Optional, Union +from twilio.base import deserialize, serialize, values +from twilio.base.api_response import ApiResponse + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class MessageInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Message resource. + :ivar messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) the message belongs to. + :ivar sid: The unique string that we created to identify the Message resource. + :ivar url: The absolute URL of the Message resource. + :ivar recipients: The list of message recipients, formatted as `channel:number`. + :ivar _from: A single colon-delimited address. + :ivar body: The message body. + :ivar broadcast_sid: The SID of the Broadcast resource. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_of_expiry: The date when the resource expires. + :ivar template: Template for message body. + :ivar template_sid: Template sid to get template for message body. + :ivar template_language: Template language which complements template sid to get template for message body. + :ivar template_args: The dictionary of arguments to construct message body from template. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], messaging_service_sid: str + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.messaging_service_sid: Optional[str] = payload.get("messaging_service_sid") + self.sid: Optional[str] = payload.get("sid") + self.url: Optional[str] = payload.get("url") + self.recipients: Optional[List[Dict[str, object]]] = payload.get("recipients") + self._from: Optional[str] = payload.get("from") + self.body: Optional[str] = payload.get("body") + self.broadcast_sid: Optional[str] = payload.get("broadcast_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.date_of_expiry: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_of_expiry") + ) + self.template: Optional[str] = payload.get("template") + self.template_sid: Optional[str] = payload.get("template_sid") + self.template_language: Optional[str] = payload.get("template_language") + self.template_args: Optional[Dict[str, object]] = payload.get("template_args") + + self._solution = { + "messaging_service_sid": messaging_service_sid, + } + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class MessageList(ListResource): + def __init__(self, version: Version, messaging_service_sid: str): + """ + Initialize the MessageList + + :param version: Version that contains the resource + :param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) the message belongs to. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "messaging_service_sid": messaging_service_sid, + } + self._uri = "/Services/{messaging_service_sid}/Messages".format( + **self._solution + ) + + def _create( + self, + recipient: List[str], + from_: Union[str, object] = values.unset, + ttl: Union[int, object] = values.unset, + template: Union[str, object] = values.unset, + template_sid: Union[str, object] = values.unset, + template_language: Union[str, object] = values.unset, + template_args: Union[object, object] = values.unset, + body: Union[str, object] = values.unset, + media_url: Union[List[str], object] = values.unset, + ) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "Recipient": serialize.map(recipient, lambda e: e), + "From": from_, + "Ttl": ttl, + "Template": template, + "TemplateSid": template_sid, + "TemplateLanguage": template_language, + "TemplateArgs": serialize.object(template_args), + "Body": body, + "MediaUrl": serialize.map(media_url, lambda e: e), + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, + recipient: List[str], + from_: Union[str, object] = values.unset, + ttl: Union[int, object] = values.unset, + template: Union[str, object] = values.unset, + template_sid: Union[str, object] = values.unset, + template_language: Union[str, object] = values.unset, + template_args: Union[object, object] = values.unset, + body: Union[str, object] = values.unset, + media_url: Union[List[str], object] = values.unset, + ) -> MessageInstance: + """ + Create the MessageInstance + + :param recipient: The list of message recipients, formatted as `channel:number`. + :param from_: A single colon-delimited address. + :param ttl: The message's time-to-live in seconds. Can be an integer between 1 and 36,000. + :param template: Template for message body. + :param template_sid: Template sid to get template for message body. + :param template_language: Template language which complements template sid to get template for message body. + :param template_args: The dictionary of arguments to construct message body from template. + :param body: The message body. + :param media_url: The list of media URLs. + + :returns: The created MessageInstance + """ + payload, _, _ = self._create( + recipient=recipient, + from_=from_, + ttl=ttl, + template=template, + template_sid=template_sid, + template_language=template_language, + template_args=template_args, + body=body, + media_url=media_url, + ) + return MessageInstance( + self._version, + payload, + messaging_service_sid=self._solution["messaging_service_sid"], + ) + + def create_with_http_info( + self, + recipient: List[str], + from_: Union[str, object] = values.unset, + ttl: Union[int, object] = values.unset, + template: Union[str, object] = values.unset, + template_sid: Union[str, object] = values.unset, + template_language: Union[str, object] = values.unset, + template_args: Union[object, object] = values.unset, + body: Union[str, object] = values.unset, + media_url: Union[List[str], object] = values.unset, + ) -> ApiResponse: + """ + Create the MessageInstance and return response metadata + + :param recipient: The list of message recipients, formatted as `channel:number`. + :param from_: A single colon-delimited address. + :param ttl: The message's time-to-live in seconds. Can be an integer between 1 and 36,000. + :param template: Template for message body. + :param template_sid: Template sid to get template for message body. + :param template_language: Template language which complements template sid to get template for message body. + :param template_args: The dictionary of arguments to construct message body from template. + :param body: The message body. + :param media_url: The list of media URLs. + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create( + recipient=recipient, + from_=from_, + ttl=ttl, + template=template, + template_sid=template_sid, + template_language=template_language, + template_args=template_args, + body=body, + media_url=media_url, + ) + instance = MessageInstance( + self._version, + payload, + messaging_service_sid=self._solution["messaging_service_sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async( + self, + recipient: List[str], + from_: Union[str, object] = values.unset, + ttl: Union[int, object] = values.unset, + template: Union[str, object] = values.unset, + template_sid: Union[str, object] = values.unset, + template_language: Union[str, object] = values.unset, + template_args: Union[object, object] = values.unset, + body: Union[str, object] = values.unset, + media_url: Union[List[str], object] = values.unset, + ) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "Recipient": serialize.map(recipient, lambda e: e), + "From": from_, + "Ttl": ttl, + "Template": template, + "TemplateSid": template_sid, + "TemplateLanguage": template_language, + "TemplateArgs": serialize.object(template_args), + "Body": body, + "MediaUrl": serialize.map(media_url, lambda e: e), + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, + recipient: List[str], + from_: Union[str, object] = values.unset, + ttl: Union[int, object] = values.unset, + template: Union[str, object] = values.unset, + template_sid: Union[str, object] = values.unset, + template_language: Union[str, object] = values.unset, + template_args: Union[object, object] = values.unset, + body: Union[str, object] = values.unset, + media_url: Union[List[str], object] = values.unset, + ) -> MessageInstance: + """ + Asynchronously create the MessageInstance + + :param recipient: The list of message recipients, formatted as `channel:number`. + :param from_: A single colon-delimited address. + :param ttl: The message's time-to-live in seconds. Can be an integer between 1 and 36,000. + :param template: Template for message body. + :param template_sid: Template sid to get template for message body. + :param template_language: Template language which complements template sid to get template for message body. + :param template_args: The dictionary of arguments to construct message body from template. + :param body: The message body. + :param media_url: The list of media URLs. + + :returns: The created MessageInstance + """ + payload, _, _ = await self._create_async( + recipient=recipient, + from_=from_, + ttl=ttl, + template=template, + template_sid=template_sid, + template_language=template_language, + template_args=template_args, + body=body, + media_url=media_url, + ) + return MessageInstance( + self._version, + payload, + messaging_service_sid=self._solution["messaging_service_sid"], + ) + + async def create_with_http_info_async( + self, + recipient: List[str], + from_: Union[str, object] = values.unset, + ttl: Union[int, object] = values.unset, + template: Union[str, object] = values.unset, + template_sid: Union[str, object] = values.unset, + template_language: Union[str, object] = values.unset, + template_args: Union[object, object] = values.unset, + body: Union[str, object] = values.unset, + media_url: Union[List[str], object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously create the MessageInstance and return response metadata + + :param recipient: The list of message recipients, formatted as `channel:number`. + :param from_: A single colon-delimited address. + :param ttl: The message's time-to-live in seconds. Can be an integer between 1 and 36,000. + :param template: Template for message body. + :param template_sid: Template sid to get template for message body. + :param template_language: Template language which complements template sid to get template for message body. + :param template_args: The dictionary of arguments to construct message body from template. + :param body: The message body. + :param media_url: The list of media URLs. + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + recipient=recipient, + from_=from_, + ttl=ttl, + template=template, + template_sid=template_sid, + template_language=template_language, + template_args=template_args, + body=body, + media_url=media_url, + ) + instance = MessageInstance( + self._version, + payload, + messaging_service_sid=self._solution["messaging_service_sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/messaging/v1/service/numbers_and_sender.py b/twilio/rest/messaging/v1/service/numbers_and_sender.py new file mode 100644 index 000000000..02dae22a2 --- /dev/null +++ b/twilio/rest/messaging/v1/service/numbers_and_sender.py @@ -0,0 +1,478 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.api_response import ApiResponse + +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 NumbersAndSenderInstance(InstanceResource): + + """ + :ivar sid: The SID to identify the number or channel sender resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the number or channel sender resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar sender: The unique string that identifies the number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format or the channel sender e.g whatsapp:+123456XXXX. + :ivar sender_type: A string value that identifies the number or channel sender type e.g AlphaSenderId, LongCode, ShortCode, Whatsapp, RCS. + :ivar country_code: The 2-character [ISO Country Code](https://www.iso.org/iso-3166-country-codes.html) of the number or channel sender. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], service_sid: str): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.sender: Optional[str] = payload.get("sender") + self.sender_type: Optional[str] = payload.get("sender_type") + self.country_code: Optional[str] = payload.get("country_code") + + self._solution = { + "service_sid": service_sid, + } + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class NumbersAndSenderPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> NumbersAndSenderInstance: + """ + Build an instance of NumbersAndSenderInstance + + :param payload: Payload response from the API + """ + return NumbersAndSenderInstance( + self._version, payload, service_sid=self._solution["service_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class NumbersAndSenderList(ListResource): + def __init__(self, version: Version, service_sid: str): + """ + Initialize the NumbersAndSenderList + + :param version: Version that contains the resource + :param service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to read the resources from. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "service_sid": service_sid, + } + self._uri = "/Services/{service_sid}/NumbersAndSenders".format(**self._solution) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[NumbersAndSenderInstance]: + """ + Streams NumbersAndSenderInstance 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[NumbersAndSenderInstance]: + """ + Asynchronously streams NumbersAndSenderInstance 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 stream_with_http_info( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams NumbersAndSenderInstance and returns headers from first page + + + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info(page_size=limits["page_size"]) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams NumbersAndSenderInstance and returns headers from first page + + + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + page_size=limits["page_size"] + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[NumbersAndSenderInstance]: + """ + Lists NumbersAndSenderInstance 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[NumbersAndSenderInstance]: + """ + Asynchronously lists NumbersAndSenderInstance 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 list_with_http_info( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists NumbersAndSenderInstance and returns headers from first page + + + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists NumbersAndSenderInstance and returns headers from first page + + + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> NumbersAndSenderPage: + """ + Retrieve a single page of NumbersAndSenderInstance 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 NumbersAndSenderInstance + """ + 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 NumbersAndSenderPage(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, + ) -> NumbersAndSenderPage: + """ + Asynchronously retrieve a single page of NumbersAndSenderInstance 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 NumbersAndSenderInstance + """ + 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 NumbersAndSenderPage(self._version, response, self._solution) + + def page_with_http_info( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :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: ApiResponse with NumbersAndSenderPage, status code, and headers + """ + 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, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = NumbersAndSenderPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :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: ApiResponse with NumbersAndSenderPage, status code, and headers + """ + 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, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = NumbersAndSenderPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> NumbersAndSenderPage: + """ + Retrieve a specific page of NumbersAndSenderInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of NumbersAndSenderInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return NumbersAndSenderPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> NumbersAndSenderPage: + """ + Asynchronously retrieve a specific page of NumbersAndSenderInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of NumbersAndSenderInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return NumbersAndSenderPage(self._version, response, self._solution) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/messaging/v1/service/phone_number.py b/twilio/rest/messaging/v1/service/phone_number.py index bac1bc521..1caf20a7a 100644 --- a/twilio/rest/messaging/v1/service/phone_number.py +++ b/twilio/rest/messaging/v1/service/phone_number.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class PhoneNumberInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the PhoneNumber resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PhoneNumber resource. @@ -164,7 +166,6 @@ def __repr__(self) -> str: class PhoneNumberContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the PhoneNumberContext @@ -357,7 +358,6 @@ def __repr__(self) -> str: class PhoneNumberPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> PhoneNumberInstance: """ Build an instance of PhoneNumberInstance @@ -378,7 +378,6 @@ def __repr__(self) -> str: class PhoneNumberList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the PhoneNumberList @@ -828,10 +827,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = PhoneNumberPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/messaging/v1/service/short_code.py b/twilio/rest/messaging/v1/service/short_code.py index 7847ec05e..1c90a6edc 100644 --- a/twilio/rest/messaging/v1/service/short_code.py +++ b/twilio/rest/messaging/v1/service/short_code.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class ShortCodeInstance(InstanceResource): + """ :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. @@ -164,7 +166,6 @@ def __repr__(self) -> str: class ShortCodeContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the ShortCodeContext @@ -355,7 +356,6 @@ def __repr__(self) -> str: class ShortCodePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ShortCodeInstance: """ Build an instance of ShortCodeInstance @@ -376,7 +376,6 @@ def __repr__(self) -> str: class ShortCodeList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the ShortCodeList @@ -826,10 +825,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ShortCodePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/messaging/v1/service/us_app_to_person.py b/twilio/rest/messaging/v1/service/us_app_to_person.py index f32fd0d1b..324a69235 100644 --- a/twilio/rest/messaging/v1/service/us_app_to_person.py +++ b/twilio/rest/messaging/v1/service/us_app_to_person.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class UsAppToPersonInstance(InstanceResource): + """ :ivar sid: The unique string that identifies a US A2P Compliance resource `QE2c6890da8086d771620e9b13fadeba0b`. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Campaign belongs to. @@ -53,6 +55,8 @@ class UsAppToPersonInstance(InstanceResource): :ivar url: The absolute URL of the US App to Person resource. :ivar mock: A boolean that specifies whether campaign is a mock or not. Mock campaigns will be automatically created if using a mock brand. Mock campaigns should only be used for testing purposes. :ivar errors: Details indicating why a campaign registration failed. These errors can indicate one or more fields that were incorrect or did not meet review requirements. + :ivar privacy_policy_url: The URL of the privacy policy for the campaign. + :ivar terms_and_conditions_url: The URL of the terms and conditions for the campaign. """ def __init__( @@ -102,6 +106,10 @@ def __init__( self.url: Optional[str] = payload.get("url") self.mock: Optional[bool] = payload.get("mock") self.errors: Optional[List[Dict[str, object]]] = payload.get("errors") + self.privacy_policy_url: Optional[str] = payload.get("privacy_policy_url") + self.terms_and_conditions_url: Optional[str] = payload.get( + "terms_and_conditions_url" + ) self._solution = { "messaging_service_sid": messaging_service_sid, @@ -161,41 +169,61 @@ async def delete_with_http_info_async(self) -> ApiResponse: """ return await self._proxy.delete_with_http_info_async() - def fetch(self) -> "UsAppToPersonInstance": + def fetch( + self, x_twilio_api_version: Union[str, object] = values.unset + ) -> "UsAppToPersonInstance": """ Fetch the UsAppToPersonInstance + :param x_twilio_api_version: The version of the Messaging API to use for this request :returns: The fetched UsAppToPersonInstance """ - return self._proxy.fetch() + return self._proxy.fetch( + x_twilio_api_version=x_twilio_api_version, + ) - async def fetch_async(self) -> "UsAppToPersonInstance": + async def fetch_async( + self, x_twilio_api_version: Union[str, object] = values.unset + ) -> "UsAppToPersonInstance": """ Asynchronous coroutine to fetch the UsAppToPersonInstance + :param x_twilio_api_version: The version of the Messaging API to use for this request :returns: The fetched UsAppToPersonInstance """ - return await self._proxy.fetch_async() + return await self._proxy.fetch_async( + x_twilio_api_version=x_twilio_api_version, + ) - def fetch_with_http_info(self) -> ApiResponse: + def fetch_with_http_info( + self, x_twilio_api_version: Union[str, object] = values.unset + ) -> ApiResponse: """ Fetch the UsAppToPersonInstance with HTTP info + :param x_twilio_api_version: The version of the Messaging API to use for this request :returns: ApiResponse with instance, status code, and headers """ - return self._proxy.fetch_with_http_info() + return self._proxy.fetch_with_http_info( + x_twilio_api_version=x_twilio_api_version, + ) - async def fetch_with_http_info_async(self) -> ApiResponse: + async def fetch_with_http_info_async( + self, x_twilio_api_version: Union[str, object] = values.unset + ) -> ApiResponse: """ Asynchronous coroutine to fetch the UsAppToPersonInstance with HTTP info + :param x_twilio_api_version: The version of the Messaging API to use for this request :returns: ApiResponse with instance, status code, and headers """ - return await self._proxy.fetch_with_http_info_async() + return await self._proxy.fetch_with_http_info_async( + x_twilio_api_version=x_twilio_api_version, + ) def update( self, @@ -206,6 +234,9 @@ def update( description: str, age_gated: bool, direct_lending: bool, + x_twilio_api_version: Union[str, object] = values.unset, + privacy_policy_url: Union[str, object] = values.unset, + terms_and_conditions_url: Union[str, object] = values.unset, ) -> "UsAppToPersonInstance": """ Update the UsAppToPersonInstance @@ -217,6 +248,9 @@ def update( :param description: A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. :param age_gated: A boolean that specifies whether campaign requires age gate for federally legal content. :param direct_lending: A boolean that specifies whether campaign allows direct lending or not. + :param x_twilio_api_version: The version of the Messaging API to use for this request + :param privacy_policy_url: The URL of the privacy policy for the campaign. + :param terms_and_conditions_url: The URL of the terms and conditions for the campaign. :returns: The updated UsAppToPersonInstance """ @@ -228,6 +262,9 @@ def update( description=description, age_gated=age_gated, direct_lending=direct_lending, + x_twilio_api_version=x_twilio_api_version, + privacy_policy_url=privacy_policy_url, + terms_and_conditions_url=terms_and_conditions_url, ) async def update_async( @@ -239,6 +276,9 @@ async def update_async( description: str, age_gated: bool, direct_lending: bool, + x_twilio_api_version: Union[str, object] = values.unset, + privacy_policy_url: Union[str, object] = values.unset, + terms_and_conditions_url: Union[str, object] = values.unset, ) -> "UsAppToPersonInstance": """ Asynchronous coroutine to update the UsAppToPersonInstance @@ -250,6 +290,9 @@ async def update_async( :param description: A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. :param age_gated: A boolean that specifies whether campaign requires age gate for federally legal content. :param direct_lending: A boolean that specifies whether campaign allows direct lending or not. + :param x_twilio_api_version: The version of the Messaging API to use for this request + :param privacy_policy_url: The URL of the privacy policy for the campaign. + :param terms_and_conditions_url: The URL of the terms and conditions for the campaign. :returns: The updated UsAppToPersonInstance """ @@ -261,6 +304,9 @@ async def update_async( description=description, age_gated=age_gated, direct_lending=direct_lending, + x_twilio_api_version=x_twilio_api_version, + privacy_policy_url=privacy_policy_url, + terms_and_conditions_url=terms_and_conditions_url, ) def update_with_http_info( @@ -272,6 +318,9 @@ def update_with_http_info( description: str, age_gated: bool, direct_lending: bool, + x_twilio_api_version: Union[str, object] = values.unset, + privacy_policy_url: Union[str, object] = values.unset, + terms_and_conditions_url: Union[str, object] = values.unset, ) -> ApiResponse: """ Update the UsAppToPersonInstance with HTTP info @@ -283,6 +332,9 @@ def update_with_http_info( :param description: A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. :param age_gated: A boolean that specifies whether campaign requires age gate for federally legal content. :param direct_lending: A boolean that specifies whether campaign allows direct lending or not. + :param x_twilio_api_version: The version of the Messaging API to use for this request + :param privacy_policy_url: The URL of the privacy policy for the campaign. + :param terms_and_conditions_url: The URL of the terms and conditions for the campaign. :returns: ApiResponse with instance, status code, and headers """ @@ -294,6 +346,9 @@ def update_with_http_info( description=description, age_gated=age_gated, direct_lending=direct_lending, + x_twilio_api_version=x_twilio_api_version, + privacy_policy_url=privacy_policy_url, + terms_and_conditions_url=terms_and_conditions_url, ) async def update_with_http_info_async( @@ -305,6 +360,9 @@ async def update_with_http_info_async( description: str, age_gated: bool, direct_lending: bool, + x_twilio_api_version: Union[str, object] = values.unset, + privacy_policy_url: Union[str, object] = values.unset, + terms_and_conditions_url: Union[str, object] = values.unset, ) -> ApiResponse: """ Asynchronous coroutine to update the UsAppToPersonInstance with HTTP info @@ -316,6 +374,9 @@ async def update_with_http_info_async( :param description: A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. :param age_gated: A boolean that specifies whether campaign requires age gate for federally legal content. :param direct_lending: A boolean that specifies whether campaign allows direct lending or not. + :param x_twilio_api_version: The version of the Messaging API to use for this request + :param privacy_policy_url: The URL of the privacy policy for the campaign. + :param terms_and_conditions_url: The URL of the terms and conditions for the campaign. :returns: ApiResponse with instance, status code, and headers """ @@ -327,6 +388,9 @@ async def update_with_http_info_async( description=description, age_gated=age_gated, direct_lending=direct_lending, + x_twilio_api_version=x_twilio_api_version, + privacy_policy_url=privacy_policy_url, + terms_and_conditions_url=terms_and_conditions_url, ) def __repr__(self) -> str: @@ -340,7 +404,6 @@ def __repr__(self) -> str: class UsAppToPersonContext(InstanceContext): - def __init__(self, version: Version, messaging_service_sid: str, sid: str): """ Initialize the UsAppToPersonContext @@ -428,7 +491,7 @@ async def delete_with_http_info_async(self) -> ApiResponse: success, status_code, headers = await self._delete_async() return ApiResponse(data=success, status_code=status_code, headers=headers) - def _fetch(self) -> tuple: + def _fetch(self, x_twilio_api_version: Union[str, object] = values.unset) -> tuple: """ Internal helper for fetch operation @@ -438,20 +501,29 @@ def _fetch(self) -> tuple: headers = values.of({}) + if not ( + x_twilio_api_version is values.unset + or (isinstance(x_twilio_api_version, str) and not x_twilio_api_version) + ): + headers["X-Twilio-Api-Version"] = x_twilio_api_version + headers["Accept"] = "application/json" return self._version.fetch_with_response_info( method="GET", uri=self._uri, headers=headers ) - def fetch(self) -> UsAppToPersonInstance: + def fetch( + self, x_twilio_api_version: Union[str, object] = values.unset + ) -> UsAppToPersonInstance: """ Fetch the UsAppToPersonInstance + :param x_twilio_api_version: The version of the Messaging API to use for this request :returns: The fetched UsAppToPersonInstance """ - payload, _, _ = self._fetch() + payload, _, _ = self._fetch(x_twilio_api_version=x_twilio_api_version) return UsAppToPersonInstance( self._version, payload, @@ -459,14 +531,19 @@ def fetch(self) -> UsAppToPersonInstance: sid=self._solution["sid"], ) - def fetch_with_http_info(self) -> ApiResponse: + def fetch_with_http_info( + self, x_twilio_api_version: Union[str, object] = values.unset + ) -> ApiResponse: """ Fetch the UsAppToPersonInstance and return response metadata + :param x_twilio_api_version: The version of the Messaging API to use for this request :returns: ApiResponse with instance, status code, and headers """ - payload, status_code, headers = self._fetch() + payload, status_code, headers = self._fetch( + x_twilio_api_version=x_twilio_api_version + ) instance = UsAppToPersonInstance( self._version, payload, @@ -475,7 +552,9 @@ def fetch_with_http_info(self) -> ApiResponse: ) return ApiResponse(data=instance, status_code=status_code, headers=headers) - async def _fetch_async(self) -> tuple: + async def _fetch_async( + self, x_twilio_api_version: Union[str, object] = values.unset + ) -> tuple: """ Internal async helper for fetch operation @@ -485,20 +564,31 @@ async def _fetch_async(self) -> tuple: headers = values.of({}) + if not ( + x_twilio_api_version is values.unset + or (isinstance(x_twilio_api_version, str) and not x_twilio_api_version) + ): + headers["X-Twilio-Api-Version"] = x_twilio_api_version + headers["Accept"] = "application/json" return await self._version.fetch_with_response_info_async( method="GET", uri=self._uri, headers=headers ) - async def fetch_async(self) -> UsAppToPersonInstance: + async def fetch_async( + self, x_twilio_api_version: Union[str, object] = values.unset + ) -> UsAppToPersonInstance: """ Asynchronous coroutine to fetch the UsAppToPersonInstance + :param x_twilio_api_version: The version of the Messaging API to use for this request :returns: The fetched UsAppToPersonInstance """ - payload, _, _ = await self._fetch_async() + payload, _, _ = await self._fetch_async( + x_twilio_api_version=x_twilio_api_version + ) return UsAppToPersonInstance( self._version, payload, @@ -506,14 +596,19 @@ async def fetch_async(self) -> UsAppToPersonInstance: sid=self._solution["sid"], ) - async def fetch_with_http_info_async(self) -> ApiResponse: + async def fetch_with_http_info_async( + self, x_twilio_api_version: Union[str, object] = values.unset + ) -> ApiResponse: """ Asynchronous coroutine to fetch the UsAppToPersonInstance and return response metadata + :param x_twilio_api_version: The version of the Messaging API to use for this request :returns: ApiResponse with instance, status code, and headers """ - payload, status_code, headers = await self._fetch_async() + payload, status_code, headers = await self._fetch_async( + x_twilio_api_version=x_twilio_api_version + ) instance = UsAppToPersonInstance( self._version, payload, @@ -531,6 +626,9 @@ def _update( description: str, age_gated: bool, direct_lending: bool, + x_twilio_api_version: Union[str, object] = values.unset, + privacy_policy_url: Union[str, object] = values.unset, + terms_and_conditions_url: Union[str, object] = values.unset, ) -> tuple: """ Internal helper for update operation @@ -548,10 +646,18 @@ def _update( "Description": description, "AgeGated": serialize.boolean_to_string(age_gated), "DirectLending": serialize.boolean_to_string(direct_lending), + "PrivacyPolicyUrl": privacy_policy_url, + "TermsAndConditionsUrl": terms_and_conditions_url, } ) headers = values.of({}) + if not ( + x_twilio_api_version is values.unset + or (isinstance(x_twilio_api_version, str) and not x_twilio_api_version) + ): + headers["X-Twilio-Api-Version"] = x_twilio_api_version + headers["Content-Type"] = "application/x-www-form-urlencoded" headers["Accept"] = "application/json" @@ -569,6 +675,9 @@ def update( description: str, age_gated: bool, direct_lending: bool, + x_twilio_api_version: Union[str, object] = values.unset, + privacy_policy_url: Union[str, object] = values.unset, + terms_and_conditions_url: Union[str, object] = values.unset, ) -> UsAppToPersonInstance: """ Update the UsAppToPersonInstance @@ -580,6 +689,9 @@ def update( :param description: A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. :param age_gated: A boolean that specifies whether campaign requires age gate for federally legal content. :param direct_lending: A boolean that specifies whether campaign allows direct lending or not. + :param x_twilio_api_version: The version of the Messaging API to use for this request + :param privacy_policy_url: The URL of the privacy policy for the campaign. + :param terms_and_conditions_url: The URL of the terms and conditions for the campaign. :returns: The updated UsAppToPersonInstance """ @@ -591,6 +703,9 @@ def update( description=description, age_gated=age_gated, direct_lending=direct_lending, + x_twilio_api_version=x_twilio_api_version, + privacy_policy_url=privacy_policy_url, + terms_and_conditions_url=terms_and_conditions_url, ) return UsAppToPersonInstance( self._version, @@ -608,6 +723,9 @@ def update_with_http_info( description: str, age_gated: bool, direct_lending: bool, + x_twilio_api_version: Union[str, object] = values.unset, + privacy_policy_url: Union[str, object] = values.unset, + terms_and_conditions_url: Union[str, object] = values.unset, ) -> ApiResponse: """ Update the UsAppToPersonInstance and return response metadata @@ -619,6 +737,9 @@ def update_with_http_info( :param description: A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. :param age_gated: A boolean that specifies whether campaign requires age gate for federally legal content. :param direct_lending: A boolean that specifies whether campaign allows direct lending or not. + :param x_twilio_api_version: The version of the Messaging API to use for this request + :param privacy_policy_url: The URL of the privacy policy for the campaign. + :param terms_and_conditions_url: The URL of the terms and conditions for the campaign. :returns: ApiResponse with instance, status code, and headers """ @@ -630,6 +751,9 @@ def update_with_http_info( description=description, age_gated=age_gated, direct_lending=direct_lending, + x_twilio_api_version=x_twilio_api_version, + privacy_policy_url=privacy_policy_url, + terms_and_conditions_url=terms_and_conditions_url, ) instance = UsAppToPersonInstance( self._version, @@ -648,6 +772,9 @@ async def _update_async( description: str, age_gated: bool, direct_lending: bool, + x_twilio_api_version: Union[str, object] = values.unset, + privacy_policy_url: Union[str, object] = values.unset, + terms_and_conditions_url: Union[str, object] = values.unset, ) -> tuple: """ Internal async helper for update operation @@ -665,10 +792,18 @@ async def _update_async( "Description": description, "AgeGated": serialize.boolean_to_string(age_gated), "DirectLending": serialize.boolean_to_string(direct_lending), + "PrivacyPolicyUrl": privacy_policy_url, + "TermsAndConditionsUrl": terms_and_conditions_url, } ) headers = values.of({}) + if not ( + x_twilio_api_version is values.unset + or (isinstance(x_twilio_api_version, str) and not x_twilio_api_version) + ): + headers["X-Twilio-Api-Version"] = x_twilio_api_version + headers["Content-Type"] = "application/x-www-form-urlencoded" headers["Accept"] = "application/json" @@ -686,6 +821,9 @@ async def update_async( description: str, age_gated: bool, direct_lending: bool, + x_twilio_api_version: Union[str, object] = values.unset, + privacy_policy_url: Union[str, object] = values.unset, + terms_and_conditions_url: Union[str, object] = values.unset, ) -> UsAppToPersonInstance: """ Asynchronous coroutine to update the UsAppToPersonInstance @@ -697,6 +835,9 @@ async def update_async( :param description: A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. :param age_gated: A boolean that specifies whether campaign requires age gate for federally legal content. :param direct_lending: A boolean that specifies whether campaign allows direct lending or not. + :param x_twilio_api_version: The version of the Messaging API to use for this request + :param privacy_policy_url: The URL of the privacy policy for the campaign. + :param terms_and_conditions_url: The URL of the terms and conditions for the campaign. :returns: The updated UsAppToPersonInstance """ @@ -708,6 +849,9 @@ async def update_async( description=description, age_gated=age_gated, direct_lending=direct_lending, + x_twilio_api_version=x_twilio_api_version, + privacy_policy_url=privacy_policy_url, + terms_and_conditions_url=terms_and_conditions_url, ) return UsAppToPersonInstance( self._version, @@ -725,6 +869,9 @@ async def update_with_http_info_async( description: str, age_gated: bool, direct_lending: bool, + x_twilio_api_version: Union[str, object] = values.unset, + privacy_policy_url: Union[str, object] = values.unset, + terms_and_conditions_url: Union[str, object] = values.unset, ) -> ApiResponse: """ Asynchronous coroutine to update the UsAppToPersonInstance and return response metadata @@ -736,6 +883,9 @@ async def update_with_http_info_async( :param description: A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. :param age_gated: A boolean that specifies whether campaign requires age gate for federally legal content. :param direct_lending: A boolean that specifies whether campaign allows direct lending or not. + :param x_twilio_api_version: The version of the Messaging API to use for this request + :param privacy_policy_url: The URL of the privacy policy for the campaign. + :param terms_and_conditions_url: The URL of the terms and conditions for the campaign. :returns: ApiResponse with instance, status code, and headers """ @@ -747,6 +897,9 @@ async def update_with_http_info_async( description=description, age_gated=age_gated, direct_lending=direct_lending, + x_twilio_api_version=x_twilio_api_version, + privacy_policy_url=privacy_policy_url, + terms_and_conditions_url=terms_and_conditions_url, ) instance = UsAppToPersonInstance( self._version, @@ -767,7 +920,6 @@ def __repr__(self) -> str: class UsAppToPersonPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> UsAppToPersonInstance: """ Build an instance of UsAppToPersonInstance @@ -790,7 +942,6 @@ def __repr__(self) -> str: class UsAppToPersonList(ListResource): - def __init__(self, version: Version, messaging_service_sid: str): """ Initialize the UsAppToPersonList @@ -818,6 +969,7 @@ def _create( us_app_to_person_usecase: str, has_embedded_links: bool, has_embedded_phone: bool, + x_twilio_api_version: Union[str, object] = values.unset, opt_in_message: Union[str, object] = values.unset, opt_out_message: Union[str, object] = values.unset, help_message: Union[str, object] = values.unset, @@ -827,6 +979,8 @@ def _create( subscriber_opt_in: Union[bool, object] = values.unset, age_gated: Union[bool, object] = values.unset, direct_lending: Union[bool, object] = values.unset, + privacy_policy_url: Union[str, object] = values.unset, + terms_and_conditions_url: Union[str, object] = values.unset, ) -> tuple: """ Internal helper for create operation @@ -853,9 +1007,16 @@ def _create( "SubscriberOptIn": serialize.boolean_to_string(subscriber_opt_in), "AgeGated": serialize.boolean_to_string(age_gated), "DirectLending": serialize.boolean_to_string(direct_lending), + "PrivacyPolicyUrl": privacy_policy_url, + "TermsAndConditionsUrl": terms_and_conditions_url, + } + ) + headers = values.of( + { + "X-Twilio-Api-Version": x_twilio_api_version, + "Content-Type": "application/x-www-form-urlencoded", } ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) headers["Content-Type"] = "application/x-www-form-urlencoded" @@ -874,6 +1035,7 @@ def create( us_app_to_person_usecase: str, has_embedded_links: bool, has_embedded_phone: bool, + x_twilio_api_version: Union[str, object] = values.unset, opt_in_message: Union[str, object] = values.unset, opt_out_message: Union[str, object] = values.unset, help_message: Union[str, object] = values.unset, @@ -883,6 +1045,8 @@ def create( subscriber_opt_in: Union[bool, object] = values.unset, age_gated: Union[bool, object] = values.unset, direct_lending: Union[bool, object] = values.unset, + privacy_policy_url: Union[str, object] = values.unset, + terms_and_conditions_url: Union[str, object] = values.unset, ) -> UsAppToPersonInstance: """ Create the UsAppToPersonInstance @@ -894,6 +1058,7 @@ def create( :param us_app_to_person_usecase: A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING..] :param has_embedded_links: Indicates that this SMS campaign will send messages that contain links. :param has_embedded_phone: Indicates that this SMS campaign will send messages that contain phone numbers. + :param x_twilio_api_version: The version of the Messaging API to use for this request :param opt_in_message: If end users can text in a keyword to start receiving messages from this campaign, the auto-reply messages sent to the end users must be provided. The opt-in response should include the Brand name, confirmation of opt-in enrollment to a recurring message campaign, how to get help, and clear description of how to opt-out. This field is required if end users can text in a keyword to start receiving messages from this campaign. 20 character minimum. 320 character maximum. :param opt_out_message: Upon receiving the opt-out keywords from the end users, Twilio customers are expected to send back an auto-generated response, which must provide acknowledgment of the opt-out request and confirmation that no further messages will be sent. It is also recommended that these opt-out messages include the brand name. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. :param help_message: When customers receive the help keywords from their end users, Twilio customers are expected to send back an auto-generated response; this may include the brand name and additional support contact information. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. @@ -903,6 +1068,8 @@ def create( :param subscriber_opt_in: A boolean that specifies whether campaign has Subscriber Optin or not. :param age_gated: A boolean that specifies whether campaign is age gated or not. :param direct_lending: A boolean that specifies whether campaign allows direct lending or not. + :param privacy_policy_url: The URL of the privacy policy for the campaign. + :param terms_and_conditions_url: The URL of the terms and conditions for the campaign. :returns: The created UsAppToPersonInstance """ @@ -914,6 +1081,7 @@ def create( us_app_to_person_usecase=us_app_to_person_usecase, has_embedded_links=has_embedded_links, has_embedded_phone=has_embedded_phone, + x_twilio_api_version=x_twilio_api_version, opt_in_message=opt_in_message, opt_out_message=opt_out_message, help_message=help_message, @@ -923,6 +1091,8 @@ def create( subscriber_opt_in=subscriber_opt_in, age_gated=age_gated, direct_lending=direct_lending, + privacy_policy_url=privacy_policy_url, + terms_and_conditions_url=terms_and_conditions_url, ) return UsAppToPersonInstance( self._version, @@ -939,6 +1109,7 @@ def create_with_http_info( us_app_to_person_usecase: str, has_embedded_links: bool, has_embedded_phone: bool, + x_twilio_api_version: Union[str, object] = values.unset, opt_in_message: Union[str, object] = values.unset, opt_out_message: Union[str, object] = values.unset, help_message: Union[str, object] = values.unset, @@ -948,6 +1119,8 @@ def create_with_http_info( subscriber_opt_in: Union[bool, object] = values.unset, age_gated: Union[bool, object] = values.unset, direct_lending: Union[bool, object] = values.unset, + privacy_policy_url: Union[str, object] = values.unset, + terms_and_conditions_url: Union[str, object] = values.unset, ) -> ApiResponse: """ Create the UsAppToPersonInstance and return response metadata @@ -959,6 +1132,7 @@ def create_with_http_info( :param us_app_to_person_usecase: A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING..] :param has_embedded_links: Indicates that this SMS campaign will send messages that contain links. :param has_embedded_phone: Indicates that this SMS campaign will send messages that contain phone numbers. + :param x_twilio_api_version: The version of the Messaging API to use for this request :param opt_in_message: If end users can text in a keyword to start receiving messages from this campaign, the auto-reply messages sent to the end users must be provided. The opt-in response should include the Brand name, confirmation of opt-in enrollment to a recurring message campaign, how to get help, and clear description of how to opt-out. This field is required if end users can text in a keyword to start receiving messages from this campaign. 20 character minimum. 320 character maximum. :param opt_out_message: Upon receiving the opt-out keywords from the end users, Twilio customers are expected to send back an auto-generated response, which must provide acknowledgment of the opt-out request and confirmation that no further messages will be sent. It is also recommended that these opt-out messages include the brand name. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. :param help_message: When customers receive the help keywords from their end users, Twilio customers are expected to send back an auto-generated response; this may include the brand name and additional support contact information. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. @@ -968,6 +1142,8 @@ def create_with_http_info( :param subscriber_opt_in: A boolean that specifies whether campaign has Subscriber Optin or not. :param age_gated: A boolean that specifies whether campaign is age gated or not. :param direct_lending: A boolean that specifies whether campaign allows direct lending or not. + :param privacy_policy_url: The URL of the privacy policy for the campaign. + :param terms_and_conditions_url: The URL of the terms and conditions for the campaign. :returns: ApiResponse with instance, status code, and headers """ @@ -979,6 +1155,7 @@ def create_with_http_info( us_app_to_person_usecase=us_app_to_person_usecase, has_embedded_links=has_embedded_links, has_embedded_phone=has_embedded_phone, + x_twilio_api_version=x_twilio_api_version, opt_in_message=opt_in_message, opt_out_message=opt_out_message, help_message=help_message, @@ -988,6 +1165,8 @@ def create_with_http_info( subscriber_opt_in=subscriber_opt_in, age_gated=age_gated, direct_lending=direct_lending, + privacy_policy_url=privacy_policy_url, + terms_and_conditions_url=terms_and_conditions_url, ) instance = UsAppToPersonInstance( self._version, @@ -1005,6 +1184,7 @@ async def _create_async( us_app_to_person_usecase: str, has_embedded_links: bool, has_embedded_phone: bool, + x_twilio_api_version: Union[str, object] = values.unset, opt_in_message: Union[str, object] = values.unset, opt_out_message: Union[str, object] = values.unset, help_message: Union[str, object] = values.unset, @@ -1014,6 +1194,8 @@ async def _create_async( subscriber_opt_in: Union[bool, object] = values.unset, age_gated: Union[bool, object] = values.unset, direct_lending: Union[bool, object] = values.unset, + privacy_policy_url: Union[str, object] = values.unset, + terms_and_conditions_url: Union[str, object] = values.unset, ) -> tuple: """ Internal async helper for create operation @@ -1040,9 +1222,16 @@ async def _create_async( "SubscriberOptIn": serialize.boolean_to_string(subscriber_opt_in), "AgeGated": serialize.boolean_to_string(age_gated), "DirectLending": serialize.boolean_to_string(direct_lending), + "PrivacyPolicyUrl": privacy_policy_url, + "TermsAndConditionsUrl": terms_and_conditions_url, + } + ) + headers = values.of( + { + "X-Twilio-Api-Version": x_twilio_api_version, + "Content-Type": "application/x-www-form-urlencoded", } ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) headers["Content-Type"] = "application/x-www-form-urlencoded" @@ -1061,6 +1250,7 @@ async def create_async( us_app_to_person_usecase: str, has_embedded_links: bool, has_embedded_phone: bool, + x_twilio_api_version: Union[str, object] = values.unset, opt_in_message: Union[str, object] = values.unset, opt_out_message: Union[str, object] = values.unset, help_message: Union[str, object] = values.unset, @@ -1070,6 +1260,8 @@ async def create_async( subscriber_opt_in: Union[bool, object] = values.unset, age_gated: Union[bool, object] = values.unset, direct_lending: Union[bool, object] = values.unset, + privacy_policy_url: Union[str, object] = values.unset, + terms_and_conditions_url: Union[str, object] = values.unset, ) -> UsAppToPersonInstance: """ Asynchronously create the UsAppToPersonInstance @@ -1081,6 +1273,7 @@ async def create_async( :param us_app_to_person_usecase: A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING..] :param has_embedded_links: Indicates that this SMS campaign will send messages that contain links. :param has_embedded_phone: Indicates that this SMS campaign will send messages that contain phone numbers. + :param x_twilio_api_version: The version of the Messaging API to use for this request :param opt_in_message: If end users can text in a keyword to start receiving messages from this campaign, the auto-reply messages sent to the end users must be provided. The opt-in response should include the Brand name, confirmation of opt-in enrollment to a recurring message campaign, how to get help, and clear description of how to opt-out. This field is required if end users can text in a keyword to start receiving messages from this campaign. 20 character minimum. 320 character maximum. :param opt_out_message: Upon receiving the opt-out keywords from the end users, Twilio customers are expected to send back an auto-generated response, which must provide acknowledgment of the opt-out request and confirmation that no further messages will be sent. It is also recommended that these opt-out messages include the brand name. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. :param help_message: When customers receive the help keywords from their end users, Twilio customers are expected to send back an auto-generated response; this may include the brand name and additional support contact information. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. @@ -1090,6 +1283,8 @@ async def create_async( :param subscriber_opt_in: A boolean that specifies whether campaign has Subscriber Optin or not. :param age_gated: A boolean that specifies whether campaign is age gated or not. :param direct_lending: A boolean that specifies whether campaign allows direct lending or not. + :param privacy_policy_url: The URL of the privacy policy for the campaign. + :param terms_and_conditions_url: The URL of the terms and conditions for the campaign. :returns: The created UsAppToPersonInstance """ @@ -1101,6 +1296,7 @@ async def create_async( us_app_to_person_usecase=us_app_to_person_usecase, has_embedded_links=has_embedded_links, has_embedded_phone=has_embedded_phone, + x_twilio_api_version=x_twilio_api_version, opt_in_message=opt_in_message, opt_out_message=opt_out_message, help_message=help_message, @@ -1110,6 +1306,8 @@ async def create_async( subscriber_opt_in=subscriber_opt_in, age_gated=age_gated, direct_lending=direct_lending, + privacy_policy_url=privacy_policy_url, + terms_and_conditions_url=terms_and_conditions_url, ) return UsAppToPersonInstance( self._version, @@ -1126,6 +1324,7 @@ async def create_with_http_info_async( us_app_to_person_usecase: str, has_embedded_links: bool, has_embedded_phone: bool, + x_twilio_api_version: Union[str, object] = values.unset, opt_in_message: Union[str, object] = values.unset, opt_out_message: Union[str, object] = values.unset, help_message: Union[str, object] = values.unset, @@ -1135,6 +1334,8 @@ async def create_with_http_info_async( subscriber_opt_in: Union[bool, object] = values.unset, age_gated: Union[bool, object] = values.unset, direct_lending: Union[bool, object] = values.unset, + privacy_policy_url: Union[str, object] = values.unset, + terms_and_conditions_url: Union[str, object] = values.unset, ) -> ApiResponse: """ Asynchronously create the UsAppToPersonInstance and return response metadata @@ -1146,6 +1347,7 @@ async def create_with_http_info_async( :param us_app_to_person_usecase: A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING..] :param has_embedded_links: Indicates that this SMS campaign will send messages that contain links. :param has_embedded_phone: Indicates that this SMS campaign will send messages that contain phone numbers. + :param x_twilio_api_version: The version of the Messaging API to use for this request :param opt_in_message: If end users can text in a keyword to start receiving messages from this campaign, the auto-reply messages sent to the end users must be provided. The opt-in response should include the Brand name, confirmation of opt-in enrollment to a recurring message campaign, how to get help, and clear description of how to opt-out. This field is required if end users can text in a keyword to start receiving messages from this campaign. 20 character minimum. 320 character maximum. :param opt_out_message: Upon receiving the opt-out keywords from the end users, Twilio customers are expected to send back an auto-generated response, which must provide acknowledgment of the opt-out request and confirmation that no further messages will be sent. It is also recommended that these opt-out messages include the brand name. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. :param help_message: When customers receive the help keywords from their end users, Twilio customers are expected to send back an auto-generated response; this may include the brand name and additional support contact information. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. @@ -1155,6 +1357,8 @@ async def create_with_http_info_async( :param subscriber_opt_in: A boolean that specifies whether campaign has Subscriber Optin or not. :param age_gated: A boolean that specifies whether campaign is age gated or not. :param direct_lending: A boolean that specifies whether campaign allows direct lending or not. + :param privacy_policy_url: The URL of the privacy policy for the campaign. + :param terms_and_conditions_url: The URL of the terms and conditions for the campaign. :returns: ApiResponse with instance, status code, and headers """ @@ -1166,6 +1370,7 @@ async def create_with_http_info_async( us_app_to_person_usecase=us_app_to_person_usecase, has_embedded_links=has_embedded_links, has_embedded_phone=has_embedded_phone, + x_twilio_api_version=x_twilio_api_version, opt_in_message=opt_in_message, opt_out_message=opt_out_message, help_message=help_message, @@ -1175,6 +1380,8 @@ async def create_with_http_info_async( subscriber_opt_in=subscriber_opt_in, age_gated=age_gated, direct_lending=direct_lending, + privacy_policy_url=privacy_policy_url, + terms_and_conditions_url=terms_and_conditions_url, ) instance = UsAppToPersonInstance( self._version, @@ -1185,6 +1392,7 @@ async def create_with_http_info_async( def stream( self, + x_twilio_api_version: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> Iterator[UsAppToPersonInstance]: @@ -1194,6 +1402,7 @@ def stream( is reached. The results are returned as a generator, so this operation is memory efficient. + :param str x_twilio_api_version: The version of the Messaging API to use for this request :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 @@ -1204,12 +1413,15 @@ def stream( :returns: Generator that will yield up to limit results """ limits = self._version.read_limits(limit, page_size) - page = self.page(page_size=limits["page_size"]) + page = self.page( + x_twilio_api_version=x_twilio_api_version, page_size=limits["page_size"] + ) return self._version.stream(page, limits["limit"]) async def stream_async( self, + x_twilio_api_version: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> AsyncIterator[UsAppToPersonInstance]: @@ -1219,6 +1431,7 @@ async def stream_async( is reached. The results are returned as a generator, so this operation is memory efficient. + :param str x_twilio_api_version: The version of the Messaging API to use for this request :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 @@ -1229,12 +1442,15 @@ async def stream_async( :returns: Generator that will yield up to limit results """ limits = self._version.read_limits(limit, page_size) - page = await self.page_async(page_size=limits["page_size"]) + page = await self.page_async( + x_twilio_api_version=x_twilio_api_version, page_size=limits["page_size"] + ) return self._version.stream_async(page, limits["limit"]) def stream_with_http_info( self, + x_twilio_api_version: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> tuple: @@ -1242,6 +1458,7 @@ def stream_with_http_info( Streams UsAppToPersonInstance and returns headers from first page + :param str x_twilio_api_version: The version of the Messaging API to use for this request :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 @@ -1252,13 +1469,16 @@ def stream_with_http_info( :returns: tuple of (generator, status_code, headers) where generator yields instances """ limits = self._version.read_limits(limit, page_size) - page_response = self.page_with_http_info(page_size=limits["page_size"]) + page_response = self.page_with_http_info( + x_twilio_api_version=x_twilio_api_version, page_size=limits["page_size"] + ) generator = self._version.stream(page_response.data, limits["limit"]) return (generator, page_response.status_code, page_response.headers) async def stream_with_http_info_async( self, + x_twilio_api_version: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> tuple: @@ -1266,6 +1486,7 @@ async def stream_with_http_info_async( Asynchronously streams UsAppToPersonInstance and returns headers from first page + :param str x_twilio_api_version: The version of the Messaging API to use for this request :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 @@ -1277,7 +1498,7 @@ async def stream_with_http_info_async( """ limits = self._version.read_limits(limit, page_size) page_response = await self.page_with_http_info_async( - page_size=limits["page_size"] + x_twilio_api_version=x_twilio_api_version, page_size=limits["page_size"] ) generator = self._version.stream_async(page_response.data, limits["limit"]) @@ -1285,6 +1506,7 @@ async def stream_with_http_info_async( def list( self, + x_twilio_api_version: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[UsAppToPersonInstance]: @@ -1293,6 +1515,7 @@ def list( Unlike stream(), this operation is eager and will load `limit` records into memory before returning. + :param str x_twilio_api_version: The version of the Messaging API to use for this request :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 @@ -1304,6 +1527,7 @@ def list( """ return list( self.stream( + x_twilio_api_version=x_twilio_api_version, limit=limit, page_size=page_size, ) @@ -1311,6 +1535,7 @@ def list( async def list_async( self, + x_twilio_api_version: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[UsAppToPersonInstance]: @@ -1319,6 +1544,7 @@ async def list_async( Unlike stream(), this operation is eager and will load `limit` records into memory before returning. + :param str x_twilio_api_version: The version of the Messaging API to use for this request :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 @@ -1331,6 +1557,7 @@ async def list_async( return [ record async for record in await self.stream_async( + x_twilio_api_version=x_twilio_api_version, limit=limit, page_size=page_size, ) @@ -1338,6 +1565,7 @@ async def list_async( def list_with_http_info( self, + x_twilio_api_version: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> ApiResponse: @@ -1345,6 +1573,7 @@ def list_with_http_info( Lists UsAppToPersonInstance and returns headers from first page + :param str x_twilio_api_version: The version of the Messaging API to use for this request :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 @@ -1355,6 +1584,7 @@ def list_with_http_info( :returns: ApiResponse with list of instances, status code, and headers """ generator, status_code, headers = self.stream_with_http_info( + x_twilio_api_version=x_twilio_api_version, limit=limit, page_size=page_size, ) @@ -1363,6 +1593,7 @@ def list_with_http_info( async def list_with_http_info_async( self, + x_twilio_api_version: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> ApiResponse: @@ -1370,6 +1601,7 @@ async def list_with_http_info_async( Asynchronously lists UsAppToPersonInstance and returns headers from first page + :param str x_twilio_api_version: The version of the Messaging API to use for this request :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 @@ -1380,6 +1612,7 @@ async def list_with_http_info_async( :returns: ApiResponse with list of instances, status code, and headers """ generator, status_code, headers = await self.stream_with_http_info_async( + x_twilio_api_version=x_twilio_api_version, limit=limit, page_size=page_size, ) @@ -1388,6 +1621,7 @@ async def list_with_http_info_async( def page( self, + x_twilio_api_version: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -1396,6 +1630,7 @@ def page( Retrieve a single page of UsAppToPersonInstance records from the API. Request is executed immediately + :param x_twilio_api_version: The version of the Messaging API to use for this request :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 @@ -1404,13 +1639,19 @@ def page( """ data = values.of( { + "X-Twilio-Api-Version": x_twilio_api_version, "PageToken": page_token, "Page": page_number, "PageSize": page_size, } ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers = values.of( + { + "X-Twilio-Api-Version": x_twilio_api_version, + "Content-Type": "application/x-www-form-urlencoded", + } + ) headers["Accept"] = "application/json" @@ -1421,6 +1662,7 @@ def page( async def page_async( self, + x_twilio_api_version: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -1429,6 +1671,7 @@ async def page_async( Asynchronously retrieve a single page of UsAppToPersonInstance records from the API. Request is executed immediately + :param x_twilio_api_version: The version of the Messaging API to use for this request :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 @@ -1437,13 +1680,19 @@ async def page_async( """ data = values.of( { + "X-Twilio-Api-Version": x_twilio_api_version, "PageToken": page_token, "Page": page_number, "PageSize": page_size, } ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers = values.of( + { + "X-Twilio-Api-Version": x_twilio_api_version, + "Content-Type": "application/x-www-form-urlencoded", + } + ) headers["Accept"] = "application/json" @@ -1454,6 +1703,7 @@ async def page_async( def page_with_http_info( self, + x_twilio_api_version: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -1462,6 +1712,7 @@ def page_with_http_info( Retrieve a single page with response metadata + :param x_twilio_api_version: The version of the Messaging API to use for this request :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 @@ -1470,13 +1721,19 @@ def page_with_http_info( """ data = values.of( { + "X-Twilio-Api-Version": x_twilio_api_version, "PageToken": page_token, "Page": page_number, "PageSize": page_size, } ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers = values.of( + { + "X-Twilio-Api-Version": x_twilio_api_version, + "Content-Type": "application/x-www-form-urlencoded", + } + ) headers["Accept"] = "application/json" @@ -1488,6 +1745,7 @@ def page_with_http_info( async def page_with_http_info_async( self, + x_twilio_api_version: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -1496,6 +1754,7 @@ async def page_with_http_info_async( Asynchronously retrieve a single page with response metadata + :param x_twilio_api_version: The version of the Messaging API to use for this request :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 @@ -1504,20 +1763,28 @@ async def page_with_http_info_async( """ data = values.of( { + "X-Twilio-Api-Version": x_twilio_api_version, "PageToken": page_token, "Page": page_number, "PageSize": page_size, } ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers = values.of( + { + "X-Twilio-Api-Version": x_twilio_api_version, + "Content-Type": "application/x-www-form-urlencoded", + } + ) headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = UsAppToPersonPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/messaging/v1/service/us_app_to_person_usecase.py b/twilio/rest/messaging/v1/service/us_app_to_person_usecase.py index 76ab18b76..673b54352 100644 --- a/twilio/rest/messaging/v1/service/us_app_to_person_usecase.py +++ b/twilio/rest/messaging/v1/service/us_app_to_person_usecase.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class UsAppToPersonUsecaseInstance(InstanceResource): + """ :ivar us_app_to_person_usecases: Human readable name, code, description and post_approval_required (indicates whether or not post approval is required for this Use Case) of A2P Campaign Use Cases. """ @@ -50,7 +52,6 @@ def __repr__(self) -> str: class UsAppToPersonUsecaseList(ListResource): - def __init__(self, version: Version, messaging_service_sid: str): """ Initialize the UsAppToPersonUsecaseList diff --git a/twilio/rest/messaging/v1/tollfree_verification.py b/twilio/rest/messaging/v1/tollfree_verification.py index 24525d0aa..a8bbdc8ad 100644 --- a/twilio/rest/messaging/v1/tollfree_verification.py +++ b/twilio/rest/messaging/v1/tollfree_verification.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,32 @@ class TollfreeVerificationInstance(InstanceResource): + class BusinessRegistrationAuthority(object): + EIN = "EIN" + CBN = "CBN" + CRN = "CRN" + PROVINCIAL_NUMBER = "PROVINCIAL_NUMBER" + VAT = "VAT" + ACN = "ACN" + ABN = "ABN" + BRN = "BRN" + SIREN = "SIREN" + SIRET = "SIRET" + NZBN = "NZBN" + UST_IDNR = "USt-IdNr" + CIF = "CIF" + NIF = "NIF" + CNPJ = "CNPJ" + UID = "UID" + NEQ = "NEQ" + OTHER = "OTHER" + + class BusinessType(object): + PRIVATE_PROFIT = "PRIVATE_PROFIT" + PUBLIC_PROFIT = "PUBLIC_PROFIT" + SOLE_PROPRIETOR = "SOLE_PROPRIETOR" + NON_PROFIT = "NON_PROFIT" + GOVERNMENT = "GOVERNMENT" class OptInType(object): VERBAL = "VERBAL" @@ -64,7 +91,7 @@ class VettingProvider(object): :ivar business_contact_email: The email address of the contact for the business or organization using the Tollfree number. :ivar business_contact_phone: The E.164 formatted phone number of the contact for the business or organization using the Tollfree number. :ivar notification_email: The email address to receive the notification about the verification result. . - :ivar use_case_categories: The category of the use case for the Tollfree Number. List as many are applicable.. + :ivar use_case_categories: The category of the use case for the Tollfree Number. List as many as are applicable. :ivar use_case_summary: Use this to further explain how messaging is used by the business or organization. :ivar production_message_sample: An example of message content, i.e. a sample message. :ivar opt_in_image_urls: Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. @@ -80,9 +107,9 @@ class VettingProvider(object): :ivar edit_expiration: The date and time when the ability to edit a rejected verification expires. :ivar edit_allowed: If a rejected verification is allowed to be edited/resubmitted. Some rejection reasons allow editing and some do not. :ivar business_registration_number: A legally recognized business registration number - :ivar business_registration_authority: The organizational authority for business registrations + :ivar business_registration_authority: :ivar business_registration_country: Country business is registered in - :ivar business_type: The type of business, valid values are PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT, SOLE_PROPRIETOR, GOVERNMENT + :ivar business_type: :ivar business_registration_phone_number: The E.164 formatted number associated with the business. :ivar doing_business_as: Trade name, sub entity, or downstream business name of business being submitted for verification :ivar opt_in_confirmation_message: The confirmation message sent to users when they opt in to receive messages. @@ -150,9 +177,9 @@ def __init__( "production_message_sample" ) self.opt_in_image_urls: Optional[List[str]] = payload.get("opt_in_image_urls") - self.opt_in_type: Optional["TollfreeVerificationInstance.OptInType"] = ( - payload.get("opt_in_type") - ) + self.opt_in_type: Optional[ + "TollfreeVerificationInstance.OptInType" + ] = payload.get("opt_in_type") self.message_volume: Optional[str] = payload.get("message_volume") self.additional_information: Optional[str] = payload.get( "additional_information" @@ -174,13 +201,15 @@ def __init__( self.business_registration_number: Optional[str] = payload.get( "business_registration_number" ) - self.business_registration_authority: Optional[str] = payload.get( - "business_registration_authority" - ) + self.business_registration_authority: Optional[ + "TollfreeVerificationInstance.BusinessRegistrationAuthority" + ] = payload.get("business_registration_authority") self.business_registration_country: Optional[str] = payload.get( "business_registration_country" ) - self.business_type: Optional[str] = payload.get("business_type") + self.business_type: Optional[ + "TollfreeVerificationInstance.BusinessType" + ] = payload.get("business_type") self.business_registration_phone_number: Optional[str] = payload.get( "business_registration_phone_number" ) @@ -326,9 +355,13 @@ def update( business_contact_phone: Union[str, object] = values.unset, edit_reason: Union[str, object] = values.unset, business_registration_number: Union[str, object] = values.unset, - business_registration_authority: Union[str, object] = values.unset, + business_registration_authority: Union[ + "TollfreeVerificationInstance.BusinessRegistrationAuthority", object + ] = values.unset, business_registration_country: Union[str, object] = values.unset, - business_type: Union[str, object] = values.unset, + business_type: Union[ + "TollfreeVerificationInstance.BusinessType", object + ] = values.unset, business_registration_phone_number: Union[str, object] = values.unset, doing_business_as: Union[str, object] = values.unset, opt_in_confirmation_message: Union[str, object] = values.unset, @@ -348,7 +381,7 @@ def update( :param business_name: The name of the business or organization using the Tollfree number. :param business_website: The website of the business or organization using the Tollfree number. :param notification_email: The email address to receive the notification about the verification result. . - :param use_case_categories: The category of the use case for the Tollfree Number. List as many are applicable.. + :param use_case_categories: The category of the use case for the Tollfree Number. List as many as are applicable. :param use_case_summary: Use this to further explain how messaging is used by the business or organization. :param production_message_sample: An example of message content, i.e. a sample message. :param opt_in_image_urls: Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. @@ -366,10 +399,10 @@ def update( :param business_contact_email: The email address of the contact for the business or organization using the Tollfree number. :param business_contact_phone: The E.164 formatted phone number of the contact for the business or organization using the Tollfree number. :param edit_reason: Describe why the verification is being edited. If the verification was rejected because of a technical issue, such as the website being down, and the issue has been resolved this parameter should be set to something similar to 'Website fixed'. - :param business_registration_number: A legaly recognized business registration number - :param business_registration_authority: The organizational authority for business registrations + :param business_registration_number: A legally recognized business registration number + :param business_registration_authority: :param business_registration_country: Country business is registered in - :param business_type: The type of business, valid values are PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT, SOLE_PROPRIETOR, GOVERNMENT + :param business_type: :param business_registration_phone_number: The E.164 formatted number associated with the business. :param doing_business_as: Trade name, sub entity, or downstream business name of business being submitted for verification :param opt_in_confirmation_message: The confirmation message sent to users when they opt in to receive messages. @@ -447,9 +480,13 @@ async def update_async( business_contact_phone: Union[str, object] = values.unset, edit_reason: Union[str, object] = values.unset, business_registration_number: Union[str, object] = values.unset, - business_registration_authority: Union[str, object] = values.unset, + business_registration_authority: Union[ + "TollfreeVerificationInstance.BusinessRegistrationAuthority", object + ] = values.unset, business_registration_country: Union[str, object] = values.unset, - business_type: Union[str, object] = values.unset, + business_type: Union[ + "TollfreeVerificationInstance.BusinessType", object + ] = values.unset, business_registration_phone_number: Union[str, object] = values.unset, doing_business_as: Union[str, object] = values.unset, opt_in_confirmation_message: Union[str, object] = values.unset, @@ -469,7 +506,7 @@ async def update_async( :param business_name: The name of the business or organization using the Tollfree number. :param business_website: The website of the business or organization using the Tollfree number. :param notification_email: The email address to receive the notification about the verification result. . - :param use_case_categories: The category of the use case for the Tollfree Number. List as many are applicable.. + :param use_case_categories: The category of the use case for the Tollfree Number. List as many as are applicable. :param use_case_summary: Use this to further explain how messaging is used by the business or organization. :param production_message_sample: An example of message content, i.e. a sample message. :param opt_in_image_urls: Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. @@ -487,10 +524,10 @@ async def update_async( :param business_contact_email: The email address of the contact for the business or organization using the Tollfree number. :param business_contact_phone: The E.164 formatted phone number of the contact for the business or organization using the Tollfree number. :param edit_reason: Describe why the verification is being edited. If the verification was rejected because of a technical issue, such as the website being down, and the issue has been resolved this parameter should be set to something similar to 'Website fixed'. - :param business_registration_number: A legaly recognized business registration number - :param business_registration_authority: The organizational authority for business registrations + :param business_registration_number: A legally recognized business registration number + :param business_registration_authority: :param business_registration_country: Country business is registered in - :param business_type: The type of business, valid values are PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT, SOLE_PROPRIETOR, GOVERNMENT + :param business_type: :param business_registration_phone_number: The E.164 formatted number associated with the business. :param doing_business_as: Trade name, sub entity, or downstream business name of business being submitted for verification :param opt_in_confirmation_message: The confirmation message sent to users when they opt in to receive messages. @@ -568,9 +605,13 @@ def update_with_http_info( business_contact_phone: Union[str, object] = values.unset, edit_reason: Union[str, object] = values.unset, business_registration_number: Union[str, object] = values.unset, - business_registration_authority: Union[str, object] = values.unset, + business_registration_authority: Union[ + "TollfreeVerificationInstance.BusinessRegistrationAuthority", object + ] = values.unset, business_registration_country: Union[str, object] = values.unset, - business_type: Union[str, object] = values.unset, + business_type: Union[ + "TollfreeVerificationInstance.BusinessType", object + ] = values.unset, business_registration_phone_number: Union[str, object] = values.unset, doing_business_as: Union[str, object] = values.unset, opt_in_confirmation_message: Union[str, object] = values.unset, @@ -590,7 +631,7 @@ def update_with_http_info( :param business_name: The name of the business or organization using the Tollfree number. :param business_website: The website of the business or organization using the Tollfree number. :param notification_email: The email address to receive the notification about the verification result. . - :param use_case_categories: The category of the use case for the Tollfree Number. List as many are applicable.. + :param use_case_categories: The category of the use case for the Tollfree Number. List as many as are applicable. :param use_case_summary: Use this to further explain how messaging is used by the business or organization. :param production_message_sample: An example of message content, i.e. a sample message. :param opt_in_image_urls: Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. @@ -608,10 +649,10 @@ def update_with_http_info( :param business_contact_email: The email address of the contact for the business or organization using the Tollfree number. :param business_contact_phone: The E.164 formatted phone number of the contact for the business or organization using the Tollfree number. :param edit_reason: Describe why the verification is being edited. If the verification was rejected because of a technical issue, such as the website being down, and the issue has been resolved this parameter should be set to something similar to 'Website fixed'. - :param business_registration_number: A legaly recognized business registration number - :param business_registration_authority: The organizational authority for business registrations + :param business_registration_number: A legally recognized business registration number + :param business_registration_authority: :param business_registration_country: Country business is registered in - :param business_type: The type of business, valid values are PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT, SOLE_PROPRIETOR, GOVERNMENT + :param business_type: :param business_registration_phone_number: The E.164 formatted number associated with the business. :param doing_business_as: Trade name, sub entity, or downstream business name of business being submitted for verification :param opt_in_confirmation_message: The confirmation message sent to users when they opt in to receive messages. @@ -689,9 +730,13 @@ async def update_with_http_info_async( business_contact_phone: Union[str, object] = values.unset, edit_reason: Union[str, object] = values.unset, business_registration_number: Union[str, object] = values.unset, - business_registration_authority: Union[str, object] = values.unset, + business_registration_authority: Union[ + "TollfreeVerificationInstance.BusinessRegistrationAuthority", object + ] = values.unset, business_registration_country: Union[str, object] = values.unset, - business_type: Union[str, object] = values.unset, + business_type: Union[ + "TollfreeVerificationInstance.BusinessType", object + ] = values.unset, business_registration_phone_number: Union[str, object] = values.unset, doing_business_as: Union[str, object] = values.unset, opt_in_confirmation_message: Union[str, object] = values.unset, @@ -711,7 +756,7 @@ async def update_with_http_info_async( :param business_name: The name of the business or organization using the Tollfree number. :param business_website: The website of the business or organization using the Tollfree number. :param notification_email: The email address to receive the notification about the verification result. . - :param use_case_categories: The category of the use case for the Tollfree Number. List as many are applicable.. + :param use_case_categories: The category of the use case for the Tollfree Number. List as many as are applicable. :param use_case_summary: Use this to further explain how messaging is used by the business or organization. :param production_message_sample: An example of message content, i.e. a sample message. :param opt_in_image_urls: Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. @@ -729,10 +774,10 @@ async def update_with_http_info_async( :param business_contact_email: The email address of the contact for the business or organization using the Tollfree number. :param business_contact_phone: The E.164 formatted phone number of the contact for the business or organization using the Tollfree number. :param edit_reason: Describe why the verification is being edited. If the verification was rejected because of a technical issue, such as the website being down, and the issue has been resolved this parameter should be set to something similar to 'Website fixed'. - :param business_registration_number: A legaly recognized business registration number - :param business_registration_authority: The organizational authority for business registrations + :param business_registration_number: A legally recognized business registration number + :param business_registration_authority: :param business_registration_country: Country business is registered in - :param business_type: The type of business, valid values are PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT, SOLE_PROPRIETOR, GOVERNMENT + :param business_type: :param business_registration_phone_number: The E.164 formatted number associated with the business. :param doing_business_as: Trade name, sub entity, or downstream business name of business being submitted for verification :param opt_in_confirmation_message: The confirmation message sent to users when they opt in to receive messages. @@ -795,7 +840,6 @@ def __repr__(self) -> str: class TollfreeVerificationContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the TollfreeVerificationContext @@ -995,9 +1039,13 @@ def _update( business_contact_phone: Union[str, object] = values.unset, edit_reason: Union[str, object] = values.unset, business_registration_number: Union[str, object] = values.unset, - business_registration_authority: Union[str, object] = values.unset, + business_registration_authority: Union[ + "TollfreeVerificationInstance.BusinessRegistrationAuthority", object + ] = values.unset, business_registration_country: Union[str, object] = values.unset, - business_type: Union[str, object] = values.unset, + business_type: Union[ + "TollfreeVerificationInstance.BusinessType", object + ] = values.unset, business_registration_phone_number: Union[str, object] = values.unset, doing_business_as: Union[str, object] = values.unset, opt_in_confirmation_message: Union[str, object] = values.unset, @@ -1093,9 +1141,13 @@ def update( business_contact_phone: Union[str, object] = values.unset, edit_reason: Union[str, object] = values.unset, business_registration_number: Union[str, object] = values.unset, - business_registration_authority: Union[str, object] = values.unset, + business_registration_authority: Union[ + "TollfreeVerificationInstance.BusinessRegistrationAuthority", object + ] = values.unset, business_registration_country: Union[str, object] = values.unset, - business_type: Union[str, object] = values.unset, + business_type: Union[ + "TollfreeVerificationInstance.BusinessType", object + ] = values.unset, business_registration_phone_number: Union[str, object] = values.unset, doing_business_as: Union[str, object] = values.unset, opt_in_confirmation_message: Union[str, object] = values.unset, @@ -1115,7 +1167,7 @@ def update( :param business_name: The name of the business or organization using the Tollfree number. :param business_website: The website of the business or organization using the Tollfree number. :param notification_email: The email address to receive the notification about the verification result. . - :param use_case_categories: The category of the use case for the Tollfree Number. List as many are applicable.. + :param use_case_categories: The category of the use case for the Tollfree Number. List as many as are applicable. :param use_case_summary: Use this to further explain how messaging is used by the business or organization. :param production_message_sample: An example of message content, i.e. a sample message. :param opt_in_image_urls: Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. @@ -1133,10 +1185,10 @@ def update( :param business_contact_email: The email address of the contact for the business or organization using the Tollfree number. :param business_contact_phone: The E.164 formatted phone number of the contact for the business or organization using the Tollfree number. :param edit_reason: Describe why the verification is being edited. If the verification was rejected because of a technical issue, such as the website being down, and the issue has been resolved this parameter should be set to something similar to 'Website fixed'. - :param business_registration_number: A legaly recognized business registration number - :param business_registration_authority: The organizational authority for business registrations + :param business_registration_number: A legally recognized business registration number + :param business_registration_authority: :param business_registration_country: Country business is registered in - :param business_type: The type of business, valid values are PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT, SOLE_PROPRIETOR, GOVERNMENT + :param business_type: :param business_registration_phone_number: The E.164 formatted number associated with the business. :param doing_business_as: Trade name, sub entity, or downstream business name of business being submitted for verification :param opt_in_confirmation_message: The confirmation message sent to users when they opt in to receive messages. @@ -1217,9 +1269,13 @@ def update_with_http_info( business_contact_phone: Union[str, object] = values.unset, edit_reason: Union[str, object] = values.unset, business_registration_number: Union[str, object] = values.unset, - business_registration_authority: Union[str, object] = values.unset, + business_registration_authority: Union[ + "TollfreeVerificationInstance.BusinessRegistrationAuthority", object + ] = values.unset, business_registration_country: Union[str, object] = values.unset, - business_type: Union[str, object] = values.unset, + business_type: Union[ + "TollfreeVerificationInstance.BusinessType", object + ] = values.unset, business_registration_phone_number: Union[str, object] = values.unset, doing_business_as: Union[str, object] = values.unset, opt_in_confirmation_message: Union[str, object] = values.unset, @@ -1239,7 +1295,7 @@ def update_with_http_info( :param business_name: The name of the business or organization using the Tollfree number. :param business_website: The website of the business or organization using the Tollfree number. :param notification_email: The email address to receive the notification about the verification result. . - :param use_case_categories: The category of the use case for the Tollfree Number. List as many are applicable.. + :param use_case_categories: The category of the use case for the Tollfree Number. List as many as are applicable. :param use_case_summary: Use this to further explain how messaging is used by the business or organization. :param production_message_sample: An example of message content, i.e. a sample message. :param opt_in_image_urls: Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. @@ -1257,10 +1313,10 @@ def update_with_http_info( :param business_contact_email: The email address of the contact for the business or organization using the Tollfree number. :param business_contact_phone: The E.164 formatted phone number of the contact for the business or organization using the Tollfree number. :param edit_reason: Describe why the verification is being edited. If the verification was rejected because of a technical issue, such as the website being down, and the issue has been resolved this parameter should be set to something similar to 'Website fixed'. - :param business_registration_number: A legaly recognized business registration number - :param business_registration_authority: The organizational authority for business registrations + :param business_registration_number: A legally recognized business registration number + :param business_registration_authority: :param business_registration_country: Country business is registered in - :param business_type: The type of business, valid values are PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT, SOLE_PROPRIETOR, GOVERNMENT + :param business_type: :param business_registration_phone_number: The E.164 formatted number associated with the business. :param doing_business_as: Trade name, sub entity, or downstream business name of business being submitted for verification :param opt_in_confirmation_message: The confirmation message sent to users when they opt in to receive messages. @@ -1342,9 +1398,13 @@ async def _update_async( business_contact_phone: Union[str, object] = values.unset, edit_reason: Union[str, object] = values.unset, business_registration_number: Union[str, object] = values.unset, - business_registration_authority: Union[str, object] = values.unset, + business_registration_authority: Union[ + "TollfreeVerificationInstance.BusinessRegistrationAuthority", object + ] = values.unset, business_registration_country: Union[str, object] = values.unset, - business_type: Union[str, object] = values.unset, + business_type: Union[ + "TollfreeVerificationInstance.BusinessType", object + ] = values.unset, business_registration_phone_number: Union[str, object] = values.unset, doing_business_as: Union[str, object] = values.unset, opt_in_confirmation_message: Union[str, object] = values.unset, @@ -1440,9 +1500,13 @@ async def update_async( business_contact_phone: Union[str, object] = values.unset, edit_reason: Union[str, object] = values.unset, business_registration_number: Union[str, object] = values.unset, - business_registration_authority: Union[str, object] = values.unset, + business_registration_authority: Union[ + "TollfreeVerificationInstance.BusinessRegistrationAuthority", object + ] = values.unset, business_registration_country: Union[str, object] = values.unset, - business_type: Union[str, object] = values.unset, + business_type: Union[ + "TollfreeVerificationInstance.BusinessType", object + ] = values.unset, business_registration_phone_number: Union[str, object] = values.unset, doing_business_as: Union[str, object] = values.unset, opt_in_confirmation_message: Union[str, object] = values.unset, @@ -1462,7 +1526,7 @@ async def update_async( :param business_name: The name of the business or organization using the Tollfree number. :param business_website: The website of the business or organization using the Tollfree number. :param notification_email: The email address to receive the notification about the verification result. . - :param use_case_categories: The category of the use case for the Tollfree Number. List as many are applicable.. + :param use_case_categories: The category of the use case for the Tollfree Number. List as many as are applicable. :param use_case_summary: Use this to further explain how messaging is used by the business or organization. :param production_message_sample: An example of message content, i.e. a sample message. :param opt_in_image_urls: Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. @@ -1480,10 +1544,10 @@ async def update_async( :param business_contact_email: The email address of the contact for the business or organization using the Tollfree number. :param business_contact_phone: The E.164 formatted phone number of the contact for the business or organization using the Tollfree number. :param edit_reason: Describe why the verification is being edited. If the verification was rejected because of a technical issue, such as the website being down, and the issue has been resolved this parameter should be set to something similar to 'Website fixed'. - :param business_registration_number: A legaly recognized business registration number - :param business_registration_authority: The organizational authority for business registrations + :param business_registration_number: A legally recognized business registration number + :param business_registration_authority: :param business_registration_country: Country business is registered in - :param business_type: The type of business, valid values are PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT, SOLE_PROPRIETOR, GOVERNMENT + :param business_type: :param business_registration_phone_number: The E.164 formatted number associated with the business. :param doing_business_as: Trade name, sub entity, or downstream business name of business being submitted for verification :param opt_in_confirmation_message: The confirmation message sent to users when they opt in to receive messages. @@ -1564,9 +1628,13 @@ async def update_with_http_info_async( business_contact_phone: Union[str, object] = values.unset, edit_reason: Union[str, object] = values.unset, business_registration_number: Union[str, object] = values.unset, - business_registration_authority: Union[str, object] = values.unset, + business_registration_authority: Union[ + "TollfreeVerificationInstance.BusinessRegistrationAuthority", object + ] = values.unset, business_registration_country: Union[str, object] = values.unset, - business_type: Union[str, object] = values.unset, + business_type: Union[ + "TollfreeVerificationInstance.BusinessType", object + ] = values.unset, business_registration_phone_number: Union[str, object] = values.unset, doing_business_as: Union[str, object] = values.unset, opt_in_confirmation_message: Union[str, object] = values.unset, @@ -1586,7 +1654,7 @@ async def update_with_http_info_async( :param business_name: The name of the business or organization using the Tollfree number. :param business_website: The website of the business or organization using the Tollfree number. :param notification_email: The email address to receive the notification about the verification result. . - :param use_case_categories: The category of the use case for the Tollfree Number. List as many are applicable.. + :param use_case_categories: The category of the use case for the Tollfree Number. List as many as are applicable. :param use_case_summary: Use this to further explain how messaging is used by the business or organization. :param production_message_sample: An example of message content, i.e. a sample message. :param opt_in_image_urls: Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. @@ -1604,10 +1672,10 @@ async def update_with_http_info_async( :param business_contact_email: The email address of the contact for the business or organization using the Tollfree number. :param business_contact_phone: The E.164 formatted phone number of the contact for the business or organization using the Tollfree number. :param edit_reason: Describe why the verification is being edited. If the verification was rejected because of a technical issue, such as the website being down, and the issue has been resolved this parameter should be set to something similar to 'Website fixed'. - :param business_registration_number: A legaly recognized business registration number - :param business_registration_authority: The organizational authority for business registrations + :param business_registration_number: A legally recognized business registration number + :param business_registration_authority: :param business_registration_country: Country business is registered in - :param business_type: The type of business, valid values are PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT, SOLE_PROPRIETOR, GOVERNMENT + :param business_type: :param business_registration_phone_number: The E.164 formatted number associated with the business. :param doing_business_as: Trade name, sub entity, or downstream business name of business being submitted for verification :param opt_in_confirmation_message: The confirmation message sent to users when they opt in to receive messages. @@ -1674,7 +1742,6 @@ def __repr__(self) -> str: class TollfreeVerificationPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> TollfreeVerificationInstance: """ Build an instance of TollfreeVerificationInstance @@ -1693,7 +1760,6 @@ def __repr__(self) -> str: class TollfreeVerificationList(ListResource): - def __init__(self, version: Version): """ Initialize the TollfreeVerificationList @@ -1731,9 +1797,13 @@ def _create( business_contact_phone: Union[str, object] = values.unset, external_reference_id: Union[str, object] = values.unset, business_registration_number: Union[str, object] = values.unset, - business_registration_authority: Union[str, object] = values.unset, + business_registration_authority: Union[ + "TollfreeVerificationInstance.BusinessRegistrationAuthority", object + ] = values.unset, business_registration_country: Union[str, object] = values.unset, - business_type: Union[str, object] = values.unset, + business_type: Union[ + "TollfreeVerificationInstance.BusinessType", object + ] = values.unset, business_registration_phone_number: Union[str, object] = values.unset, doing_business_as: Union[str, object] = values.unset, opt_in_confirmation_message: Union[str, object] = values.unset, @@ -1831,9 +1901,13 @@ def create( business_contact_phone: Union[str, object] = values.unset, external_reference_id: Union[str, object] = values.unset, business_registration_number: Union[str, object] = values.unset, - business_registration_authority: Union[str, object] = values.unset, + business_registration_authority: Union[ + "TollfreeVerificationInstance.BusinessRegistrationAuthority", object + ] = values.unset, business_registration_country: Union[str, object] = values.unset, - business_type: Union[str, object] = values.unset, + business_type: Union[ + "TollfreeVerificationInstance.BusinessType", object + ] = values.unset, business_registration_phone_number: Union[str, object] = values.unset, doing_business_as: Union[str, object] = values.unset, opt_in_confirmation_message: Union[str, object] = values.unset, @@ -1853,7 +1927,7 @@ def create( :param business_name: The name of the business or organization using the Tollfree number. :param business_website: The website of the business or organization using the Tollfree number. :param notification_email: The email address to receive the notification about the verification result. . - :param use_case_categories: The category of the use case for the Tollfree Number. List as many are applicable.. + :param use_case_categories: The category of the use case for the Tollfree Number. List as many as are applicable. :param use_case_summary: Use this to further explain how messaging is used by the business or organization. :param production_message_sample: An example of message content, i.e. a sample message. :param opt_in_image_urls: Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. @@ -1874,9 +1948,9 @@ def create( :param business_contact_phone: The E.164 formatted phone number of the contact for the business or organization using the Tollfree number. :param external_reference_id: An optional external reference ID supplied by customer and echoed back on status retrieval. :param business_registration_number: A legally recognized business registration number. Required for all business types except SOLE_PROPRIETOR. - :param business_registration_authority: The organizational authority for business registrations. Required for all business types except SOLE_PROPRIETOR. + :param business_registration_authority: :param business_registration_country: The country where the business is registered. Required for all business types except SOLE_PROPRIETOR. - :param business_type: The type of business, valid values are PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT, SOLE_PROPRIETOR, GOVERNMENT. Required field. + :param business_type: :param business_registration_phone_number: The E.164 formatted number associated with the business. :param doing_business_as: Trade name, sub entity, or downstream business name of business being submitted for verification :param opt_in_confirmation_message: The confirmation message sent to users when they opt in to receive messages. @@ -1957,9 +2031,13 @@ def create_with_http_info( business_contact_phone: Union[str, object] = values.unset, external_reference_id: Union[str, object] = values.unset, business_registration_number: Union[str, object] = values.unset, - business_registration_authority: Union[str, object] = values.unset, + business_registration_authority: Union[ + "TollfreeVerificationInstance.BusinessRegistrationAuthority", object + ] = values.unset, business_registration_country: Union[str, object] = values.unset, - business_type: Union[str, object] = values.unset, + business_type: Union[ + "TollfreeVerificationInstance.BusinessType", object + ] = values.unset, business_registration_phone_number: Union[str, object] = values.unset, doing_business_as: Union[str, object] = values.unset, opt_in_confirmation_message: Union[str, object] = values.unset, @@ -1979,7 +2057,7 @@ def create_with_http_info( :param business_name: The name of the business or organization using the Tollfree number. :param business_website: The website of the business or organization using the Tollfree number. :param notification_email: The email address to receive the notification about the verification result. . - :param use_case_categories: The category of the use case for the Tollfree Number. List as many are applicable.. + :param use_case_categories: The category of the use case for the Tollfree Number. List as many as are applicable. :param use_case_summary: Use this to further explain how messaging is used by the business or organization. :param production_message_sample: An example of message content, i.e. a sample message. :param opt_in_image_urls: Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. @@ -2000,9 +2078,9 @@ def create_with_http_info( :param business_contact_phone: The E.164 formatted phone number of the contact for the business or organization using the Tollfree number. :param external_reference_id: An optional external reference ID supplied by customer and echoed back on status retrieval. :param business_registration_number: A legally recognized business registration number. Required for all business types except SOLE_PROPRIETOR. - :param business_registration_authority: The organizational authority for business registrations. Required for all business types except SOLE_PROPRIETOR. + :param business_registration_authority: :param business_registration_country: The country where the business is registered. Required for all business types except SOLE_PROPRIETOR. - :param business_type: The type of business, valid values are PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT, SOLE_PROPRIETOR, GOVERNMENT. Required field. + :param business_type: :param business_registration_phone_number: The E.164 formatted number associated with the business. :param doing_business_as: Trade name, sub entity, or downstream business name of business being submitted for verification :param opt_in_confirmation_message: The confirmation message sent to users when they opt in to receive messages. @@ -2084,9 +2162,13 @@ async def _create_async( business_contact_phone: Union[str, object] = values.unset, external_reference_id: Union[str, object] = values.unset, business_registration_number: Union[str, object] = values.unset, - business_registration_authority: Union[str, object] = values.unset, + business_registration_authority: Union[ + "TollfreeVerificationInstance.BusinessRegistrationAuthority", object + ] = values.unset, business_registration_country: Union[str, object] = values.unset, - business_type: Union[str, object] = values.unset, + business_type: Union[ + "TollfreeVerificationInstance.BusinessType", object + ] = values.unset, business_registration_phone_number: Union[str, object] = values.unset, doing_business_as: Union[str, object] = values.unset, opt_in_confirmation_message: Union[str, object] = values.unset, @@ -2184,9 +2266,13 @@ async def create_async( business_contact_phone: Union[str, object] = values.unset, external_reference_id: Union[str, object] = values.unset, business_registration_number: Union[str, object] = values.unset, - business_registration_authority: Union[str, object] = values.unset, + business_registration_authority: Union[ + "TollfreeVerificationInstance.BusinessRegistrationAuthority", object + ] = values.unset, business_registration_country: Union[str, object] = values.unset, - business_type: Union[str, object] = values.unset, + business_type: Union[ + "TollfreeVerificationInstance.BusinessType", object + ] = values.unset, business_registration_phone_number: Union[str, object] = values.unset, doing_business_as: Union[str, object] = values.unset, opt_in_confirmation_message: Union[str, object] = values.unset, @@ -2206,7 +2292,7 @@ async def create_async( :param business_name: The name of the business or organization using the Tollfree number. :param business_website: The website of the business or organization using the Tollfree number. :param notification_email: The email address to receive the notification about the verification result. . - :param use_case_categories: The category of the use case for the Tollfree Number. List as many are applicable.. + :param use_case_categories: The category of the use case for the Tollfree Number. List as many as are applicable. :param use_case_summary: Use this to further explain how messaging is used by the business or organization. :param production_message_sample: An example of message content, i.e. a sample message. :param opt_in_image_urls: Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. @@ -2227,9 +2313,9 @@ async def create_async( :param business_contact_phone: The E.164 formatted phone number of the contact for the business or organization using the Tollfree number. :param external_reference_id: An optional external reference ID supplied by customer and echoed back on status retrieval. :param business_registration_number: A legally recognized business registration number. Required for all business types except SOLE_PROPRIETOR. - :param business_registration_authority: The organizational authority for business registrations. Required for all business types except SOLE_PROPRIETOR. + :param business_registration_authority: :param business_registration_country: The country where the business is registered. Required for all business types except SOLE_PROPRIETOR. - :param business_type: The type of business, valid values are PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT, SOLE_PROPRIETOR, GOVERNMENT. Required field. + :param business_type: :param business_registration_phone_number: The E.164 formatted number associated with the business. :param doing_business_as: Trade name, sub entity, or downstream business name of business being submitted for verification :param opt_in_confirmation_message: The confirmation message sent to users when they opt in to receive messages. @@ -2310,9 +2396,13 @@ async def create_with_http_info_async( business_contact_phone: Union[str, object] = values.unset, external_reference_id: Union[str, object] = values.unset, business_registration_number: Union[str, object] = values.unset, - business_registration_authority: Union[str, object] = values.unset, + business_registration_authority: Union[ + "TollfreeVerificationInstance.BusinessRegistrationAuthority", object + ] = values.unset, business_registration_country: Union[str, object] = values.unset, - business_type: Union[str, object] = values.unset, + business_type: Union[ + "TollfreeVerificationInstance.BusinessType", object + ] = values.unset, business_registration_phone_number: Union[str, object] = values.unset, doing_business_as: Union[str, object] = values.unset, opt_in_confirmation_message: Union[str, object] = values.unset, @@ -2332,7 +2422,7 @@ async def create_with_http_info_async( :param business_name: The name of the business or organization using the Tollfree number. :param business_website: The website of the business or organization using the Tollfree number. :param notification_email: The email address to receive the notification about the verification result. . - :param use_case_categories: The category of the use case for the Tollfree Number. List as many are applicable.. + :param use_case_categories: The category of the use case for the Tollfree Number. List as many as are applicable. :param use_case_summary: Use this to further explain how messaging is used by the business or organization. :param production_message_sample: An example of message content, i.e. a sample message. :param opt_in_image_urls: Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. @@ -2353,9 +2443,9 @@ async def create_with_http_info_async( :param business_contact_phone: The E.164 formatted phone number of the contact for the business or organization using the Tollfree number. :param external_reference_id: An optional external reference ID supplied by customer and echoed back on status retrieval. :param business_registration_number: A legally recognized business registration number. Required for all business types except SOLE_PROPRIETOR. - :param business_registration_authority: The organizational authority for business registrations. Required for all business types except SOLE_PROPRIETOR. + :param business_registration_authority: :param business_registration_country: The country where the business is registered. Required for all business types except SOLE_PROPRIETOR. - :param business_type: The type of business, valid values are PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT, SOLE_PROPRIETOR, GOVERNMENT. Required field. + :param business_type: :param business_registration_phone_number: The E.164 formatted number associated with the business. :param doing_business_as: Trade name, sub entity, or downstream business name of business being submitted for verification :param opt_in_confirmation_message: The confirmation message sent to users when they opt in to receive messages. @@ -2928,10 +3018,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = TollfreeVerificationPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/messaging/v1/usecase.py b/twilio/rest/messaging/v1/usecase.py index 46e9bf390..0ca4684d2 100644 --- a/twilio/rest/messaging/v1/usecase.py +++ b/twilio/rest/messaging/v1/usecase.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class UsecaseInstance(InstanceResource): + """ :ivar usecases: Human readable use case details (usecase, description and purpose) of Messaging Service Use Cases. """ @@ -42,7 +44,6 @@ def __repr__(self) -> str: class UsecaseList(ListResource): - def __init__(self, version: Version): """ Initialize the UsecaseList diff --git a/twilio/rest/messaging/v2/__init__.py b/twilio/rest/messaging/v2/__init__.py index 8dd64eba5..d0a327631 100644 --- a/twilio/rest/messaging/v2/__init__.py +++ b/twilio/rest/messaging/v2/__init__.py @@ -16,12 +16,13 @@ from twilio.base.version import Version from twilio.base.domain import Domain from twilio.rest.messaging.v2.channels_sender import ChannelsSenderList +from twilio.rest.messaging.v2.channels_senders_country import ChannelsSendersCountryList from twilio.rest.messaging.v2.domain_certs import DomainCertsList +from twilio.rest.messaging.v2.test_device import TestDeviceList from twilio.rest.messaging.v2.typing_indicator import TypingIndicatorList class V2(Version): - def __init__(self, domain: Domain): """ Initialize the V2 version of Messaging @@ -30,7 +31,9 @@ def __init__(self, domain: Domain): """ super().__init__(domain, "v2") self._channels_senders: Optional[ChannelsSenderList] = None + self._channels_senders_countries: Optional[ChannelsSendersCountryList] = None self._domain_certs: Optional[DomainCertsList] = None + self._test_devices: Optional[TestDeviceList] = None self._typing_indicator: Optional[TypingIndicatorList] = None @property @@ -39,12 +42,24 @@ def channels_senders(self) -> ChannelsSenderList: self._channels_senders = ChannelsSenderList(self) return self._channels_senders + @property + def channels_senders_countries(self) -> ChannelsSendersCountryList: + if self._channels_senders_countries is None: + self._channels_senders_countries = ChannelsSendersCountryList(self) + return self._channels_senders_countries + @property def domain_certs(self) -> DomainCertsList: if self._domain_certs is None: self._domain_certs = DomainCertsList(self) return self._domain_certs + @property + def test_devices(self) -> TestDeviceList: + if self._test_devices is None: + self._test_devices = TestDeviceList(self) + return self._test_devices + @property def typing_indicator(self) -> TypingIndicatorList: if self._typing_indicator is None: diff --git a/twilio/rest/messaging/v2/channels_sender.py b/twilio/rest/messaging/v2/channels_sender.py index 7341cd656..65451ea3e 100644 --- a/twilio/rest/messaging/v2/channels_sender.py +++ b/twilio/rest/messaging/v2/channels_sender.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,7 +24,6 @@ class ChannelsSenderInstance(InstanceResource): - class MessagingV2ChannelsSenderConfiguration(object): """ :ivar waba_id: The ID of the WhatsApp Business Account (WABA) to use for this sender. @@ -33,11 +33,10 @@ class MessagingV2ChannelsSenderConfiguration(object): """ def __init__(self, payload: Dict[str, Any]): - self.waba_id: Optional[str] = payload.get("waba_id") - self.verification_method: Optional["ChannelsSenderInstance.str"] = ( - payload.get("verification_method") - ) + self.verification_method: Optional[ + "ChannelsSenderInstance.str" + ] = payload.get("verification_method") self.verification_code: Optional[str] = payload.get("verification_code") self.voice_application_sid: Optional[str] = payload.get( "voice_application_sid" @@ -69,7 +68,6 @@ class MessagingV2ChannelsSenderProfile(object): """ def __init__(self, payload: Dict[str, Any]): - self.name: Optional[str] = payload.get("name") self.about: Optional[str] = payload.get("about") self.address: Optional[str] = payload.get("address") @@ -112,7 +110,6 @@ class MessagingV2ChannelsSenderProfileGenericResponseEmails(object): """ def __init__(self, payload: Dict[str, Any]): - self.email: Optional[str] = payload.get("email") self.label: Optional[str] = payload.get("label") @@ -129,7 +126,6 @@ class MessagingV2ChannelsSenderProfileGenericResponsePhoneNumbers(object): """ def __init__(self, payload: Dict[str, Any]): - self.phone_number: Optional[str] = payload.get("phone_number") self.label: Optional[str] = payload.get("label") @@ -146,7 +142,6 @@ class MessagingV2ChannelsSenderProfileGenericResponseWebsites(object): """ def __init__(self, payload: Dict[str, Any]): - self.website: Optional[str] = payload.get("website") self.label: Optional[str] = payload.get("label") @@ -165,7 +160,6 @@ class MessagingV2ChannelsSenderRequestsCreate(object): """ def __init__(self, payload: Dict[str, Any]): - self.sender_id: Optional[str] = payload.get("sender_id") self.configuration: Optional[ ChannelsSenderList.MessagingV2ChannelsSenderConfiguration @@ -180,11 +174,9 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { "sender_id": self.sender_id, - "configuration": ( - self.configuration.to_dict() - if self.configuration is not None - else None - ), + "configuration": self.configuration.to_dict() + if self.configuration is not None + else None, "webhook": self.webhook.to_dict() if self.webhook is not None else None, "profile": self.profile.to_dict() if self.profile is not None else None, } @@ -197,7 +189,6 @@ class MessagingV2ChannelsSenderRequestsUpdate(object): """ def __init__(self, payload: Dict[str, Any]): - self.configuration: Optional[ ChannelsSenderList.MessagingV2ChannelsSenderConfiguration ] = payload.get("configuration") @@ -210,11 +201,9 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { - "configuration": ( - self.configuration.to_dict() - if self.configuration is not None - else None - ), + "configuration": self.configuration.to_dict() + if self.configuration is not None + else None, "webhook": self.webhook.to_dict() if self.webhook is not None else None, "profile": self.profile.to_dict() if self.profile is not None else None, } @@ -230,7 +219,6 @@ class MessagingV2ChannelsSenderWebhook(object): """ def __init__(self, payload: Dict[str, Any]): - self.callback_url: Optional[str] = payload.get("callback_url") self.callback_method: Optional["ChannelsSenderInstance.str"] = payload.get( "callback_method" @@ -261,7 +249,6 @@ class MessagingV2RcsCarrier(object): """ def __init__(self, payload: Dict[str, Any]): - self.name: Optional[str] = payload.get("name") self.status: Optional[MessagingV2RcsCarrierStatus] = payload.get("status") @@ -280,7 +267,6 @@ class MessagingV2RcsComplianceCountryResponse(object): """ def __init__(self, payload: Dict[str, Any]): - self.country: Optional[str] = payload.get("country") self.registration_sid: Optional[str] = payload.get("registration_sid") self.status: Optional[MessagingV2RcsCountryStatus] = payload.get("status") @@ -293,11 +279,9 @@ def to_dict(self): "": self.country, "": self.registration_sid, "": self.status.to_dict() if self.status is not None else None, - "": ( - [carriers.to_dict() for carriers in self.carriers] - if self.carriers is not None - else None - ), + "": [carriers.to_dict() for carriers in self.carriers] + if self.carriers is not None + else None, } class Status(object): @@ -525,7 +509,6 @@ def __repr__(self) -> str: class ChannelsSenderContext(InstanceContext): - class MessagingV2ChannelsSenderConfiguration(object): """ :ivar waba_id: The ID of the WhatsApp Business Account (WABA) to use for this sender. @@ -535,11 +518,10 @@ class MessagingV2ChannelsSenderConfiguration(object): """ def __init__(self, payload: Dict[str, Any]): - self.waba_id: Optional[str] = payload.get("waba_id") - self.verification_method: Optional["ChannelsSenderInstance.str"] = ( - payload.get("verification_method") - ) + self.verification_method: Optional[ + "ChannelsSenderInstance.str" + ] = payload.get("verification_method") self.verification_code: Optional[str] = payload.get("verification_code") self.voice_application_sid: Optional[str] = payload.get( "voice_application_sid" @@ -571,7 +553,6 @@ class MessagingV2ChannelsSenderProfile(object): """ def __init__(self, payload: Dict[str, Any]): - self.name: Optional[str] = payload.get("name") self.about: Optional[str] = payload.get("about") self.address: Optional[str] = payload.get("address") @@ -614,7 +595,6 @@ class MessagingV2ChannelsSenderProfileGenericResponseEmails(object): """ def __init__(self, payload: Dict[str, Any]): - self.email: Optional[str] = payload.get("email") self.label: Optional[str] = payload.get("label") @@ -631,7 +611,6 @@ class MessagingV2ChannelsSenderProfileGenericResponsePhoneNumbers(object): """ def __init__(self, payload: Dict[str, Any]): - self.phone_number: Optional[str] = payload.get("phone_number") self.label: Optional[str] = payload.get("label") @@ -648,7 +627,6 @@ class MessagingV2ChannelsSenderProfileGenericResponseWebsites(object): """ def __init__(self, payload: Dict[str, Any]): - self.website: Optional[str] = payload.get("website") self.label: Optional[str] = payload.get("label") @@ -667,7 +645,6 @@ class MessagingV2ChannelsSenderRequestsCreate(object): """ def __init__(self, payload: Dict[str, Any]): - self.sender_id: Optional[str] = payload.get("sender_id") self.configuration: Optional[ ChannelsSenderList.MessagingV2ChannelsSenderConfiguration @@ -682,11 +659,9 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { "sender_id": self.sender_id, - "configuration": ( - self.configuration.to_dict() - if self.configuration is not None - else None - ), + "configuration": self.configuration.to_dict() + if self.configuration is not None + else None, "webhook": self.webhook.to_dict() if self.webhook is not None else None, "profile": self.profile.to_dict() if self.profile is not None else None, } @@ -699,7 +674,6 @@ class MessagingV2ChannelsSenderRequestsUpdate(object): """ def __init__(self, payload: Dict[str, Any]): - self.configuration: Optional[ ChannelsSenderList.MessagingV2ChannelsSenderConfiguration ] = payload.get("configuration") @@ -712,11 +686,9 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { - "configuration": ( - self.configuration.to_dict() - if self.configuration is not None - else None - ), + "configuration": self.configuration.to_dict() + if self.configuration is not None + else None, "webhook": self.webhook.to_dict() if self.webhook is not None else None, "profile": self.profile.to_dict() if self.profile is not None else None, } @@ -732,7 +704,6 @@ class MessagingV2ChannelsSenderWebhook(object): """ def __init__(self, payload: Dict[str, Any]): - self.callback_url: Optional[str] = payload.get("callback_url") self.callback_method: Optional["ChannelsSenderInstance.str"] = payload.get( "callback_method" @@ -763,7 +734,6 @@ class MessagingV2RcsCarrier(object): """ def __init__(self, payload: Dict[str, Any]): - self.name: Optional[str] = payload.get("name") self.status: Optional[MessagingV2RcsCarrierStatus] = payload.get("status") @@ -782,7 +752,6 @@ class MessagingV2RcsComplianceCountryResponse(object): """ def __init__(self, payload: Dict[str, Any]): - self.country: Optional[str] = payload.get("country") self.registration_sid: Optional[str] = payload.get("registration_sid") self.status: Optional[MessagingV2RcsCountryStatus] = payload.get("status") @@ -795,11 +764,9 @@ def to_dict(self): "": self.country, "": self.registration_sid, "": self.status.to_dict() if self.status is not None else None, - "": ( - [carriers.to_dict() for carriers in self.carriers] - if self.carriers is not None - else None - ), + "": [carriers.to_dict() for carriers in self.carriers] + if self.carriers is not None + else None, } def __init__(self, version: Version, sid: str): @@ -1112,7 +1079,6 @@ def __repr__(self) -> str: class ChannelsSenderPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ChannelsSenderInstance: """ Build an instance of ChannelsSenderInstance @@ -1131,7 +1097,6 @@ def __repr__(self) -> str: class ChannelsSenderList(ListResource): - class MessagingV2ChannelsSenderConfiguration(object): """ :ivar waba_id: The ID of the WhatsApp Business Account (WABA) to use for this sender. @@ -1141,11 +1106,10 @@ class MessagingV2ChannelsSenderConfiguration(object): """ def __init__(self, payload: Dict[str, Any]): - self.waba_id: Optional[str] = payload.get("waba_id") - self.verification_method: Optional["ChannelsSenderInstance.str"] = ( - payload.get("verification_method") - ) + self.verification_method: Optional[ + "ChannelsSenderInstance.str" + ] = payload.get("verification_method") self.verification_code: Optional[str] = payload.get("verification_code") self.voice_application_sid: Optional[str] = payload.get( "voice_application_sid" @@ -1177,7 +1141,6 @@ class MessagingV2ChannelsSenderProfile(object): """ def __init__(self, payload: Dict[str, Any]): - self.name: Optional[str] = payload.get("name") self.about: Optional[str] = payload.get("about") self.address: Optional[str] = payload.get("address") @@ -1220,7 +1183,6 @@ class MessagingV2ChannelsSenderProfileGenericResponseEmails(object): """ def __init__(self, payload: Dict[str, Any]): - self.email: Optional[str] = payload.get("email") self.label: Optional[str] = payload.get("label") @@ -1237,7 +1199,6 @@ class MessagingV2ChannelsSenderProfileGenericResponsePhoneNumbers(object): """ def __init__(self, payload: Dict[str, Any]): - self.phone_number: Optional[str] = payload.get("phone_number") self.label: Optional[str] = payload.get("label") @@ -1254,7 +1215,6 @@ class MessagingV2ChannelsSenderProfileGenericResponseWebsites(object): """ def __init__(self, payload: Dict[str, Any]): - self.website: Optional[str] = payload.get("website") self.label: Optional[str] = payload.get("label") @@ -1273,7 +1233,6 @@ class MessagingV2ChannelsSenderRequestsCreate(object): """ def __init__(self, payload: Dict[str, Any]): - self.sender_id: Optional[str] = payload.get("sender_id") self.configuration: Optional[ ChannelsSenderList.MessagingV2ChannelsSenderConfiguration @@ -1288,11 +1247,9 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { "sender_id": self.sender_id, - "configuration": ( - self.configuration.to_dict() - if self.configuration is not None - else None - ), + "configuration": self.configuration.to_dict() + if self.configuration is not None + else None, "webhook": self.webhook.to_dict() if self.webhook is not None else None, "profile": self.profile.to_dict() if self.profile is not None else None, } @@ -1305,7 +1262,6 @@ class MessagingV2ChannelsSenderRequestsUpdate(object): """ def __init__(self, payload: Dict[str, Any]): - self.configuration: Optional[ ChannelsSenderList.MessagingV2ChannelsSenderConfiguration ] = payload.get("configuration") @@ -1318,11 +1274,9 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { - "configuration": ( - self.configuration.to_dict() - if self.configuration is not None - else None - ), + "configuration": self.configuration.to_dict() + if self.configuration is not None + else None, "webhook": self.webhook.to_dict() if self.webhook is not None else None, "profile": self.profile.to_dict() if self.profile is not None else None, } @@ -1338,7 +1292,6 @@ class MessagingV2ChannelsSenderWebhook(object): """ def __init__(self, payload: Dict[str, Any]): - self.callback_url: Optional[str] = payload.get("callback_url") self.callback_method: Optional["ChannelsSenderInstance.str"] = payload.get( "callback_method" @@ -1369,7 +1322,6 @@ class MessagingV2RcsCarrier(object): """ def __init__(self, payload: Dict[str, Any]): - self.name: Optional[str] = payload.get("name") self.status: Optional[MessagingV2RcsCarrierStatus] = payload.get("status") @@ -1388,7 +1340,6 @@ class MessagingV2RcsComplianceCountryResponse(object): """ def __init__(self, payload: Dict[str, Any]): - self.country: Optional[str] = payload.get("country") self.registration_sid: Optional[str] = payload.get("registration_sid") self.status: Optional[MessagingV2RcsCountryStatus] = payload.get("status") @@ -1401,11 +1352,9 @@ def to_dict(self): "": self.country, "": self.registration_sid, "": self.status.to_dict() if self.status is not None else None, - "": ( - [carriers.to_dict() for carriers in self.carriers] - if self.carriers is not None - else None - ), + "": [carriers.to_dict() for carriers in self.carriers] + if self.carriers is not None + else None, } def __init__(self, version: Version): @@ -1894,10 +1843,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ChannelsSenderPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/messaging/v2/channels_senders_country.py b/twilio/rest/messaging/v2/channels_senders_country.py new file mode 100644 index 000000000..55d90f793 --- /dev/null +++ b/twilio/rest/messaging/v2/channels_senders_country.py @@ -0,0 +1,488 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import values +from twilio.base.api_response import ApiResponse + +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 ChannelsSendersCountryInstance(InstanceResource): + + """ + :ivar iso_country: The ISO 3166-1 alpha-2 country code. + :ivar requires_registration_sid: Whether the carrier requires extra information for verification. If `true`, a country-level `registration_sid` is required. If `false`, a country-level `registration_sid` isn't required. + :ivar carriers: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.iso_country: Optional[str] = payload.get("iso_country") + self.requires_registration_sid: Optional[bool] = payload.get( + "requires_registration_sid" + ) + self.carriers: Optional[List[str]] = payload.get("carriers") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class ChannelsSendersCountryPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ChannelsSendersCountryInstance: + """ + Build an instance of ChannelsSendersCountryInstance + + :param payload: Payload response from the API + """ + return ChannelsSendersCountryInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class ChannelsSendersCountryList(ListResource): + def __init__(self, version: Version): + """ + Initialize the ChannelsSendersCountryList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Channels/Countries" + + def stream( + self, + channel: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[ChannelsSendersCountryInstance]: + """ + Streams ChannelsSendersCountryInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str channel: Channel, enum `RCS` only + :param limit: Upper limit for the number of records to return. stream() + guarantees to never return more than limit. Default is no limit + :param page_size: Number of records to fetch per request, when not set will use + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(channel=channel, page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + channel: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[ChannelsSendersCountryInstance]: + """ + Asynchronously streams ChannelsSendersCountryInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str channel: Channel, enum `RCS` only + :param limit: Upper limit for the number of records to return. stream() + guarantees to never return more than limit. Default is no limit + :param page_size: Number of records to fetch per request, when not set will use + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async(channel=channel, page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def stream_with_http_info( + self, + channel: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams ChannelsSendersCountryInstance and returns headers from first page + + + :param str channel: Channel, enum `RCS` only + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info( + channel=channel, page_size=limits["page_size"] + ) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + channel: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams ChannelsSendersCountryInstance and returns headers from first page + + + :param str channel: Channel, enum `RCS` only + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + channel=channel, page_size=limits["page_size"] + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + channel: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[ChannelsSendersCountryInstance]: + """ + Lists ChannelsSendersCountryInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str channel: Channel, enum `RCS` only + :param limit: Upper limit for the number of records to return. list() guarantees + never to return more than limit. Default is no limit + :param page_size: Number of records to fetch per request, when not set will use + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + channel=channel, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + channel: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[ChannelsSendersCountryInstance]: + """ + Asynchronously lists ChannelsSendersCountryInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str channel: Channel, enum `RCS` only + :param limit: Upper limit for the number of records to return. list() guarantees + never to return more than limit. Default is no limit + :param page_size: Number of records to fetch per request, when not set will use + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + channel=channel, + limit=limit, + page_size=page_size, + ) + ] + + def list_with_http_info( + self, + channel: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists ChannelsSendersCountryInstance and returns headers from first page + + + :param str channel: Channel, enum `RCS` only + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + channel=channel, + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + channel: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists ChannelsSendersCountryInstance and returns headers from first page + + + :param str channel: Channel, enum `RCS` only + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + channel=channel, + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + channel: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ChannelsSendersCountryPage: + """ + Retrieve a single page of ChannelsSendersCountryInstance records from the API. + Request is executed immediately + + :param channel: Channel, enum `RCS` only + :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 ChannelsSendersCountryInstance + """ + data = values.of( + { + "Channel": channel, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) + return ChannelsSendersCountryPage(self._version, response) + + async def page_async( + self, + channel: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ChannelsSendersCountryPage: + """ + Asynchronously retrieve a single page of ChannelsSendersCountryInstance records from the API. + Request is executed immediately + + :param channel: Channel, enum `RCS` only + :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 ChannelsSendersCountryInstance + """ + data = values.of( + { + "Channel": channel, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + return ChannelsSendersCountryPage(self._version, response) + + def page_with_http_info( + self, + channel: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :param channel: Channel, enum `RCS` only + :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: ApiResponse with ChannelsSendersCountryPage, status code, and headers + """ + data = values.of( + { + "Channel": channel, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = ChannelsSendersCountryPage(self._version, response) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + channel: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :param channel: Channel, enum `RCS` only + :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: ApiResponse with ChannelsSendersCountryPage, status code, and headers + """ + data = values.of( + { + "Channel": channel, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = ChannelsSendersCountryPage(self._version, response) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> ChannelsSendersCountryPage: + """ + Retrieve a specific page of ChannelsSendersCountryInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ChannelsSendersCountryInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return ChannelsSendersCountryPage(self._version, response) + + async def get_page_async(self, target_url: str) -> ChannelsSendersCountryPage: + """ + Asynchronously retrieve a specific page of ChannelsSendersCountryInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ChannelsSendersCountryInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return ChannelsSendersCountryPage(self._version, response) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/messaging/v2/domain_certs.py b/twilio/rest/messaging/v2/domain_certs.py index 58d6180e5..162ff5d28 100644 --- a/twilio/rest/messaging/v2/domain_certs.py +++ b/twilio/rest/messaging/v2/domain_certs.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional from twilio.base import deserialize, values @@ -23,6 +24,7 @@ class DomainCertsInstance(InstanceResource): + """ :ivar domain_sid: The unique string that we created to identify the Domain resource. :ivar date_updated: Date that this Domain was last updated. @@ -130,7 +132,6 @@ def __repr__(self) -> str: class DomainCertsContext(InstanceContext): - def __init__(self, version: Version, domain_sid: str): """ Initialize the DomainCertsContext @@ -249,7 +250,6 @@ def __repr__(self) -> str: class DomainCertsList(ListResource): - def __init__(self, version: Version): """ Initialize the DomainCertsList diff --git a/twilio/rest/messaging/v2/test_device.py b/twilio/rest/messaging/v2/test_device.py new file mode 100644 index 000000000..a0ac5167e --- /dev/null +++ b/twilio/rest/messaging/v2/test_device.py @@ -0,0 +1,374 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from typing import Any, Dict, Optional +from twilio.base import values +from twilio.base.api_response import ApiResponse +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 TestDeviceInstance(InstanceResource): + + """ + :ivar status: status of test device + :ivar phone_number: valid E.164 formatted phone number + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + sid: Optional[str] = None, + phone_number: Optional[str] = None, + ): + super().__init__(version) + + self.status: Optional[str] = payload.get("status") + self.phone_number: Optional[str] = payload.get("phone_number") + + self._solution = { + "sid": sid or self.sid, + "phone_number": phone_number or self.phone_number, + } + self._context: Optional[TestDeviceContext] = None + + @property + def _proxy(self) -> "TestDeviceContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: TestDeviceContext for this TestDeviceInstance + """ + if self._context is None: + self._context = TestDeviceContext( + self._version, + sid=self._solution["sid"], + phone_number=self._solution["phone_number"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the TestDeviceInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the TestDeviceInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the TestDeviceInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return self._proxy.delete_with_http_info() + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the TestDeviceInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return await self._proxy.delete_with_http_info_async() + + def fetch(self) -> "TestDeviceInstance": + """ + Fetch the TestDeviceInstance + + + :returns: The fetched TestDeviceInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "TestDeviceInstance": + """ + Asynchronous coroutine to fetch the TestDeviceInstance + + + :returns: The fetched TestDeviceInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the TestDeviceInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the TestDeviceInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_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 TestDeviceContext(InstanceContext): + def __init__(self, version: Version, sid: str, phone_number: str): + """ + Initialize the TestDeviceContext + + :param version: Version that contains the resource + :param sid: A 34 character string that uniquely identifies this Sender. + :param phone_number: The phone number of the test device in E.164 format. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "sid": sid, + "phone_number": phone_number, + } + self._uri = "/Channels/Senders/{sid}/TestDevices/{phone_number}".format( + **self._solution + ) + + def _delete(self) -> tuple: + """ + Internal helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + return self._version.delete_with_response_info( + method="DELETE", uri=self._uri, headers=headers + ) + + def delete(self) -> bool: + """ + Deletes the TestDeviceInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = self._delete() + return success + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the TestDeviceInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = self._delete() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + async def _delete_async(self) -> tuple: + """ + Internal async helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + return await self._version.delete_with_response_info_async( + method="DELETE", uri=self._uri, headers=headers + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the TestDeviceInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = await self._delete_async() + return success + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the TestDeviceInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = await self._delete_async() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> TestDeviceInstance: + """ + Fetch the TestDeviceInstance + + + :returns: The fetched TestDeviceInstance + """ + payload, _, _ = self._fetch() + return TestDeviceInstance( + self._version, + payload, + sid=self._solution["sid"], + phone_number=self._solution["phone_number"], + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the TestDeviceInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = TestDeviceInstance( + self._version, + payload, + sid=self._solution["sid"], + phone_number=self._solution["phone_number"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> TestDeviceInstance: + """ + Asynchronous coroutine to fetch the TestDeviceInstance + + + :returns: The fetched TestDeviceInstance + """ + payload, _, _ = await self._fetch_async() + return TestDeviceInstance( + self._version, + payload, + sid=self._solution["sid"], + phone_number=self._solution["phone_number"], + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the TestDeviceInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = TestDeviceInstance( + self._version, + payload, + sid=self._solution["sid"], + phone_number=self._solution["phone_number"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class TestDeviceList(ListResource): + def __init__(self, version: Version): + """ + Initialize the TestDeviceList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, sid: str, phone_number: str) -> TestDeviceContext: + """ + Constructs a TestDeviceContext + + :param sid: A 34 character string that uniquely identifies this Sender. + :param phone_number: The phone number of the test device in E.164 format. + """ + return TestDeviceContext(self._version, sid=sid, phone_number=phone_number) + + def __call__(self, sid: str, phone_number: str) -> TestDeviceContext: + """ + Constructs a TestDeviceContext + + :param sid: A 34 character string that uniquely identifies this Sender. + :param phone_number: The phone number of the test device in E.164 format. + """ + return TestDeviceContext(self._version, sid=sid, phone_number=phone_number) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/messaging/v2/typing_indicator.py b/twilio/rest/messaging/v2/typing_indicator.py index e27ebdfb2..84e493f25 100644 --- a/twilio/rest/messaging/v2/typing_indicator.py +++ b/twilio/rest/messaging/v2/typing_indicator.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class TypingIndicatorInstance(InstanceResource): + """ :ivar success: Indicates if the typing indicator was sent successfully. """ @@ -42,7 +44,6 @@ def __repr__(self) -> str: class TypingIndicatorList(ListResource): - def __init__(self, version: Version): """ Initialize the TypingIndicatorList diff --git a/twilio/rest/monitor/MonitorBase.py b/twilio/rest/monitor/MonitorBase.py index 4c5c6ebcd..d63580761 100644 --- a/twilio/rest/monitor/MonitorBase.py +++ b/twilio/rest/monitor/MonitorBase.py @@ -17,7 +17,6 @@ class MonitorBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Monitor Domain diff --git a/twilio/rest/monitor/v1/__init__.py b/twilio/rest/monitor/v1/__init__.py index e892612b3..fcf06738f 100644 --- a/twilio/rest/monitor/v1/__init__.py +++ b/twilio/rest/monitor/v1/__init__.py @@ -20,7 +20,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Monitor diff --git a/twilio/rest/monitor/v1/alert.py b/twilio/rest/monitor/v1/alert.py index 3c6540a9f..db74409fb 100644 --- a/twilio/rest/monitor/v1/alert.py +++ b/twilio/rest/monitor/v1/alert.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class AlertInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Alert resource. :ivar alert_text: The text of the alert. @@ -144,7 +146,6 @@ def __repr__(self) -> str: class AlertContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the AlertContext @@ -261,7 +262,6 @@ def __repr__(self) -> str: class AlertPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> AlertInstance: """ Build an instance of AlertInstance @@ -280,7 +280,6 @@ def __repr__(self) -> str: class AlertList(ListResource): - def __init__(self, version: Version): """ Initialize the AlertList @@ -737,10 +736,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AlertPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/monitor/v1/event.py b/twilio/rest/monitor/v1/event.py index b1abff1f2..b8b8398ac 100644 --- a/twilio/rest/monitor/v1/event.py +++ b/twilio/rest/monitor/v1/event.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class EventInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Event resource. :ivar actor_sid: The SID of the actor that caused the event, if available. This can be either a User ID (matching the pattern `^US[0-9a-fA-F]{32}$`) or an Account SID (matching the pattern `^AC[0-9a-fA-F]{32}$`). If the actor's SID isn't available, this field will be `null`. @@ -130,7 +132,6 @@ def __repr__(self) -> str: class EventContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the EventContext @@ -247,7 +248,6 @@ def __repr__(self) -> str: class EventPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> EventInstance: """ Build an instance of EventInstance @@ -266,7 +266,6 @@ def __repr__(self) -> str: class EventList(ListResource): - def __init__(self, version: Version): """ Initialize the EventList @@ -831,10 +830,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = EventPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/notify/NotifyBase.py b/twilio/rest/notify/NotifyBase.py index 2772ed095..d8a79bed6 100644 --- a/twilio/rest/notify/NotifyBase.py +++ b/twilio/rest/notify/NotifyBase.py @@ -17,7 +17,6 @@ class NotifyBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Notify Domain diff --git a/twilio/rest/notify/v1/__init__.py b/twilio/rest/notify/v1/__init__.py index 90cab9502..91942a4f7 100644 --- a/twilio/rest/notify/v1/__init__.py +++ b/twilio/rest/notify/v1/__init__.py @@ -20,7 +20,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Notify diff --git a/twilio/rest/notify/v1/credential.py b/twilio/rest/notify/v1/credential.py index 852e18138..1179907b2 100644 --- a/twilio/rest/notify/v1/credential.py +++ b/twilio/rest/notify/v1/credential.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class CredentialInstance(InstanceResource): - class PushService(object): GCM = "gcm" APN = "apn" @@ -282,7 +282,6 @@ def __repr__(self) -> str: class CredentialContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the CredentialContext @@ -665,7 +664,6 @@ def __repr__(self) -> str: class CredentialPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> CredentialInstance: """ Build an instance of CredentialInstance @@ -684,7 +682,6 @@ def __repr__(self) -> str: class CredentialList(ListResource): - def __init__(self, version: Version): """ Initialize the CredentialList @@ -1241,10 +1238,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CredentialPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/notify/v1/service/__init__.py b/twilio/rest/notify/v1/service/__init__.py index 8d77707bd..b59068a25 100644 --- a/twilio/rest/notify/v1/service/__init__.py +++ b/twilio/rest/notify/v1/service/__init__.py @@ -12,6 +12,7 @@ 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 @@ -23,9 +24,12 @@ from twilio.base.page import Page from twilio.rest.notify.v1.service.binding import BindingList from twilio.rest.notify.v1.service.notification import NotificationList +from twilio.rest.notify.v1.service.segment import SegmentList +from twilio.rest.notify.v1.service.user import UserList class ServiceInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Service resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. @@ -413,6 +417,20 @@ def notifications(self) -> NotificationList: """ return self._proxy.notifications + @property + def segments(self) -> SegmentList: + """ + Access the segments + """ + return self._proxy.segments + + @property + def users(self) -> UserList: + """ + Access the users + """ + return self._proxy.users + def __repr__(self) -> str: """ Provide a friendly representation @@ -424,7 +442,6 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -442,6 +459,8 @@ def __init__(self, version: Version, sid: str): self._bindings: Optional[BindingList] = None self._notifications: Optional[NotificationList] = None + self._segments: Optional[SegmentList] = None + self._users: Optional[UserList] = None def _delete(self) -> tuple: """ @@ -955,6 +974,30 @@ def notifications(self) -> NotificationList: ) return self._notifications + @property + def segments(self) -> SegmentList: + """ + Access the segments + """ + if self._segments is None: + self._segments = SegmentList( + self._version, + self._solution["sid"], + ) + return self._segments + + @property + def users(self) -> UserList: + """ + Access the users + """ + if self._users is None: + self._users = UserList( + self._version, + self._solution["sid"], + ) + return self._users + def __repr__(self) -> str: """ Provide a friendly representation @@ -966,7 +1009,6 @@ def __repr__(self) -> str: class ServicePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -985,7 +1027,6 @@ def __repr__(self) -> str: class ServiceList(ListResource): - def __init__(self, version: Version): """ Initialize the ServiceList @@ -1694,10 +1735,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ServicePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/notify/v1/service/binding.py b/twilio/rest/notify/v1/service/binding.py index f79267b5f..a75e8af0b 100644 --- a/twilio/rest/notify/v1/service/binding.py +++ b/twilio/rest/notify/v1/service/binding.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import date, datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, serialize, values @@ -24,7 +25,6 @@ class BindingInstance(InstanceResource): - class BindingType(object): APN = "apn" GCM = "gcm" @@ -185,7 +185,6 @@ def __repr__(self) -> str: class BindingContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the BindingContext @@ -376,7 +375,6 @@ def __repr__(self) -> str: class BindingPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> BindingInstance: """ Build an instance of BindingInstance @@ -397,7 +395,6 @@ def __repr__(self) -> str: class BindingList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the BindingList @@ -1117,10 +1114,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = BindingPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/notify/v1/service/notification.py b/twilio/rest/notify/v1/service/notification.py index a16ef7acf..be3b41000 100644 --- a/twilio/rest/notify/v1/service/notification.py +++ b/twilio/rest/notify/v1/service/notification.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, List, Optional, Union from twilio.base import deserialize, serialize, values @@ -23,7 +24,6 @@ class NotificationInstance(InstanceResource): - class Priority(object): HIGH = "high" LOW = "low" @@ -96,7 +96,6 @@ def __repr__(self) -> str: class NotificationList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the NotificationList diff --git a/twilio/rest/notify/v1/service/segment.py b/twilio/rest/notify/v1/service/segment.py new file mode 100644 index 000000000..14bd53f88 --- /dev/null +++ b/twilio/rest/notify/v1/service/segment.py @@ -0,0 +1,474 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Notify + 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.api_response import ApiResponse + +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 SegmentInstance(InstanceResource): + + """ + :ivar sid: + :ivar account_sid: + :ivar service_sid: + :ivar unique_name: + :ivar date_created: + :ivar date_updated: + """ + + def __init__(self, version: Version, payload: Dict[str, Any], service_sid: str): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.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._solution = { + "service_sid": service_sid, + } + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class SegmentPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SegmentInstance: + """ + Build an instance of SegmentInstance + + :param payload: Payload response from the API + """ + return SegmentInstance( + self._version, payload, service_sid=self._solution["service_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class SegmentList(ListResource): + def __init__(self, version: Version, service_sid: str): + """ + Initialize the SegmentList + + :param version: Version that contains the resource + :param service_sid: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "service_sid": service_sid, + } + self._uri = "/Services/{service_sid}/Segments".format(**self._solution) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[SegmentInstance]: + """ + Streams SegmentInstance 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[SegmentInstance]: + """ + Asynchronously streams SegmentInstance 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 stream_with_http_info( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams SegmentInstance and returns headers from first page + + + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info(page_size=limits["page_size"]) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams SegmentInstance and returns headers from first page + + + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + page_size=limits["page_size"] + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[SegmentInstance]: + """ + Lists SegmentInstance 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[SegmentInstance]: + """ + Asynchronously lists SegmentInstance 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 list_with_http_info( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists SegmentInstance and returns headers from first page + + + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists SegmentInstance and returns headers from first page + + + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> SegmentPage: + """ + Retrieve a single page of SegmentInstance 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 SegmentInstance + """ + 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 SegmentPage(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, + ) -> SegmentPage: + """ + Asynchronously retrieve a single page of SegmentInstance 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 SegmentInstance + """ + 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 SegmentPage(self._version, response, self._solution) + + def page_with_http_info( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :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: ApiResponse with SegmentPage, status code, and headers + """ + 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, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = SegmentPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :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: ApiResponse with SegmentPage, status code, and headers + """ + 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, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = SegmentPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> SegmentPage: + """ + Retrieve a specific page of SegmentInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of SegmentInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return SegmentPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> SegmentPage: + """ + Asynchronously retrieve a specific page of SegmentInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of SegmentInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return SegmentPage(self._version, response, self._solution) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/notify/v1/service/user/__init__.py b/twilio/rest/notify/v1/service/user/__init__.py new file mode 100644 index 000000000..bcd087646 --- /dev/null +++ b/twilio/rest/notify/v1/service/user/__init__.py @@ -0,0 +1,1021 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Notify + 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.api_response import ApiResponse +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.notify.v1.service.user.segment_membership import SegmentMembershipList +from twilio.rest.notify.v1.service.user.user_binding import UserBindingList + + +class UserInstance(InstanceResource): + + """ + :ivar sid: The unique string that we created to identify the User resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/notify/api/service-resource) the resource is associated with. + :ivar identity: The application-defined string that uniquely identifies the resource's User within the Service. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar segments: Deprecated. + :ivar url: The absolute URL of the User resource. + :ivar links: The absolute URLs of related resources. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + identity: Optional[str] = None, + ): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.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.segments: Optional[List[str]] = payload.get("segments") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") + + self._solution = { + "service_sid": service_sid, + "identity": identity or self.identity, + } + self._context: Optional[UserContext] = None + + @property + def _proxy(self) -> "UserContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: UserContext for this UserInstance + """ + if self._context is None: + self._context = UserContext( + self._version, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the UserInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the UserInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the UserInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return self._proxy.delete_with_http_info() + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the UserInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return await self._proxy.delete_with_http_info_async() + + def fetch(self) -> "UserInstance": + """ + Fetch the UserInstance + + + :returns: The fetched UserInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "UserInstance": + """ + Asynchronous coroutine to fetch the UserInstance + + + :returns: The fetched UserInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the UserInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the UserInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_async() + + @property + def segment_memberships(self) -> SegmentMembershipList: + """ + Access the segment_memberships + """ + return self._proxy.segment_memberships + + @property + def bindings(self) -> UserBindingList: + """ + Access the bindings + """ + return self._proxy.bindings + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class UserContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, identity: str): + """ + Initialize the UserContext + + :param version: Version that contains the resource + :param service_sid: The SID of the [Service](https://www.twilio.com/docs/notify/api/service-resource) to fetch the resource from. + :param identity: The application-defined string that uniquely identifies the resource to fetch. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "service_sid": service_sid, + "identity": identity, + } + self._uri = "/Services/{service_sid}/Users/{identity}".format(**self._solution) + + self._segment_memberships: Optional[SegmentMembershipList] = None + self._bindings: Optional[UserBindingList] = None + + def _delete(self) -> tuple: + """ + Internal helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + return self._version.delete_with_response_info( + method="DELETE", uri=self._uri, headers=headers + ) + + def delete(self) -> bool: + """ + Deletes the UserInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = self._delete() + return success + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the UserInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = self._delete() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + async def _delete_async(self) -> tuple: + """ + Internal async helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + return await self._version.delete_with_response_info_async( + method="DELETE", uri=self._uri, headers=headers + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the UserInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = await self._delete_async() + return success + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the UserInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = await self._delete_async() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> UserInstance: + """ + Fetch the UserInstance + + + :returns: The fetched UserInstance + """ + payload, _, _ = self._fetch() + return UserInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the UserInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = UserInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> UserInstance: + """ + Asynchronous coroutine to fetch the UserInstance + + + :returns: The fetched UserInstance + """ + payload, _, _ = await self._fetch_async() + return UserInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the UserInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = UserInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + @property + def segment_memberships(self) -> SegmentMembershipList: + """ + Access the segment_memberships + """ + if self._segment_memberships is None: + self._segment_memberships = SegmentMembershipList( + self._version, + self._solution["service_sid"], + self._solution["identity"], + ) + return self._segment_memberships + + @property + def bindings(self) -> UserBindingList: + """ + Access the bindings + """ + if self._bindings is None: + self._bindings = UserBindingList( + self._version, + self._solution["service_sid"], + self._solution["identity"], + ) + return self._bindings + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class UserPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> UserInstance: + """ + Build an instance of UserInstance + + :param payload: Payload response from the API + """ + return UserInstance( + self._version, payload, service_sid=self._solution["service_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class UserList(ListResource): + def __init__(self, version: Version, service_sid: str): + """ + Initialize the UserList + + :param version: Version that contains the resource + :param service_sid: The SID of the [Service](https://www.twilio.com/docs/notify/api/service-resource) to read the resource from. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "service_sid": service_sid, + } + self._uri = "/Services/{service_sid}/Users".format(**self._solution) + + def _create( + self, identity: str, segment: Union[List[str], object] = values.unset + ) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "Identity": identity, + "Segment": serialize.map(segment, lambda e: e), + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, identity: str, segment: Union[List[str], object] = values.unset + ) -> UserInstance: + """ + Create the UserInstance + + :param identity: The application-defined string that uniquely identifies the resource's User within the Service. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + :param segment: The list of segments this User belongs to. Segments can be used to select recipients of a notification. Maximum 20 Segments per User allowed. + + :returns: The created UserInstance + """ + payload, _, _ = self._create(identity=identity, segment=segment) + return UserInstance( + self._version, payload, service_sid=self._solution["service_sid"] + ) + + def create_with_http_info( + self, identity: str, segment: Union[List[str], object] = values.unset + ) -> ApiResponse: + """ + Create the UserInstance and return response metadata + + :param identity: The application-defined string that uniquely identifies the resource's User within the Service. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + :param segment: The list of segments this User belongs to. Segments can be used to select recipients of a notification. Maximum 20 Segments per User allowed. + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create(identity=identity, segment=segment) + instance = UserInstance( + self._version, payload, service_sid=self._solution["service_sid"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async( + self, identity: str, segment: Union[List[str], object] = values.unset + ) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "Identity": identity, + "Segment": serialize.map(segment, lambda e: e), + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, identity: str, segment: Union[List[str], object] = values.unset + ) -> UserInstance: + """ + Asynchronously create the UserInstance + + :param identity: The application-defined string that uniquely identifies the resource's User within the Service. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + :param segment: The list of segments this User belongs to. Segments can be used to select recipients of a notification. Maximum 20 Segments per User allowed. + + :returns: The created UserInstance + """ + payload, _, _ = await self._create_async(identity=identity, segment=segment) + return UserInstance( + self._version, payload, service_sid=self._solution["service_sid"] + ) + + async def create_with_http_info_async( + self, identity: str, segment: Union[List[str], object] = values.unset + ) -> ApiResponse: + """ + Asynchronously create the UserInstance and return response metadata + + :param identity: The application-defined string that uniquely identifies the resource's User within the Service. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + :param segment: The list of segments this User belongs to. Segments can be used to select recipients of a notification. Maximum 20 Segments per User allowed. + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + identity=identity, segment=segment + ) + instance = UserInstance( + self._version, payload, service_sid=self._solution["service_sid"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def stream( + self, + identity: Union[List[str], object] = values.unset, + segment: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[UserInstance]: + """ + Streams UserInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param List[str] identity: The application-defined string that uniquely identifies the resource to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + :param str segment: The list of segments this User belongs to. Segments can be used to select recipients of a notification. Maximum 20 Segments per User allowed. + :param limit: Upper limit for the number of records to return. stream() + guarantees to never return more than limit. Default is no limit + :param page_size: Number of records to fetch per request, when not set will use + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page( + identity=identity, segment=segment, page_size=limits["page_size"] + ) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + identity: Union[List[str], object] = values.unset, + segment: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[UserInstance]: + """ + Asynchronously streams UserInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param List[str] identity: The application-defined string that uniquely identifies the resource to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + :param str segment: The list of segments this User belongs to. Segments can be used to select recipients of a notification. Maximum 20 Segments per User allowed. + :param limit: Upper limit for the number of records to return. stream() + guarantees to never return more than limit. Default is no limit + :param page_size: Number of records to fetch per request, when not set will use + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async( + identity=identity, segment=segment, page_size=limits["page_size"] + ) + + return self._version.stream_async(page, limits["limit"]) + + def stream_with_http_info( + self, + identity: Union[List[str], object] = values.unset, + segment: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams UserInstance and returns headers from first page + + + :param List[str] identity: The application-defined string that uniquely identifies the resource to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + :param str segment: The list of segments this User belongs to. Segments can be used to select recipients of a notification. Maximum 20 Segments per User allowed. + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info( + identity=identity, segment=segment, page_size=limits["page_size"] + ) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + identity: Union[List[str], object] = values.unset, + segment: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams UserInstance and returns headers from first page + + + :param List[str] identity: The application-defined string that uniquely identifies the resource to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + :param str segment: The list of segments this User belongs to. Segments can be used to select recipients of a notification. Maximum 20 Segments per User allowed. + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + identity=identity, segment=segment, page_size=limits["page_size"] + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + identity: Union[List[str], object] = values.unset, + segment: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[UserInstance]: + """ + Lists UserInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param List[str] identity: The application-defined string that uniquely identifies the resource to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + :param str segment: The list of segments this User belongs to. Segments can be used to select recipients of a notification. Maximum 20 Segments per User allowed. + :param limit: Upper limit for the number of records to return. list() guarantees + never to return more than limit. Default is no limit + :param page_size: Number of records to fetch per request, when not set will use + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + identity=identity, + segment=segment, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + identity: Union[List[str], object] = values.unset, + segment: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[UserInstance]: + """ + Asynchronously lists UserInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param List[str] identity: The application-defined string that uniquely identifies the resource to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + :param str segment: The list of segments this User belongs to. Segments can be used to select recipients of a notification. Maximum 20 Segments per User allowed. + :param limit: Upper limit for the number of records to return. list() guarantees + never to return more than limit. Default is no limit + :param page_size: Number of records to fetch per request, when not set will use + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + identity=identity, + segment=segment, + limit=limit, + page_size=page_size, + ) + ] + + def list_with_http_info( + self, + identity: Union[List[str], object] = values.unset, + segment: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists UserInstance and returns headers from first page + + + :param List[str] identity: The application-defined string that uniquely identifies the resource to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + :param str segment: The list of segments this User belongs to. Segments can be used to select recipients of a notification. Maximum 20 Segments per User allowed. + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + identity=identity, + segment=segment, + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + identity: Union[List[str], object] = values.unset, + segment: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists UserInstance and returns headers from first page + + + :param List[str] identity: The application-defined string that uniquely identifies the resource to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + :param str segment: The list of segments this User belongs to. Segments can be used to select recipients of a notification. Maximum 20 Segments per User allowed. + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + identity=identity, + segment=segment, + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + identity: Union[List[str], object] = values.unset, + segment: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> UserPage: + """ + Retrieve a single page of UserInstance records from the API. + Request is executed immediately + + :param identity: The application-defined string that uniquely identifies the resource to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + :param segment: The list of segments this User belongs to. Segments can be used to select recipients of a notification. Maximum 20 Segments per User allowed. + :param page_token: PageToken provided by the API + :param page_number: Page Number, this value is simply for client state + :param page_size: Number of records to return, defaults to 50 + + :returns: Page of UserInstance + """ + data = values.of( + { + "Identity": serialize.map(identity, lambda e: e), + "Segment": segment, + "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 UserPage(self._version, response, self._solution) + + async def page_async( + self, + identity: Union[List[str], object] = values.unset, + segment: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> UserPage: + """ + Asynchronously retrieve a single page of UserInstance records from the API. + Request is executed immediately + + :param identity: The application-defined string that uniquely identifies the resource to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + :param segment: The list of segments this User belongs to. Segments can be used to select recipients of a notification. Maximum 20 Segments per User allowed. + :param page_token: PageToken provided by the API + :param page_number: Page Number, this value is simply for client state + :param page_size: Number of records to return, defaults to 50 + + :returns: Page of UserInstance + """ + data = values.of( + { + "Identity": serialize.map(identity, lambda e: e), + "Segment": segment, + "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 UserPage(self._version, response, self._solution) + + def page_with_http_info( + self, + identity: Union[List[str], object] = values.unset, + segment: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :param identity: The application-defined string that uniquely identifies the resource to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + :param segment: The list of segments this User belongs to. Segments can be used to select recipients of a notification. Maximum 20 Segments per User allowed. + :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: ApiResponse with UserPage, status code, and headers + """ + data = values.of( + { + "Identity": serialize.map(identity, lambda e: e), + "Segment": segment, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = UserPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + identity: Union[List[str], object] = values.unset, + segment: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :param identity: The application-defined string that uniquely identifies the resource to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + :param segment: The list of segments this User belongs to. Segments can be used to select recipients of a notification. Maximum 20 Segments per User allowed. + :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: ApiResponse with UserPage, status code, and headers + """ + data = values.of( + { + "Identity": serialize.map(identity, lambda e: e), + "Segment": segment, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = UserPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> UserPage: + """ + Retrieve a specific page of UserInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of UserInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return UserPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> UserPage: + """ + Asynchronously retrieve a specific page of UserInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of UserInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return UserPage(self._version, response, self._solution) + + def get(self, identity: str) -> UserContext: + """ + Constructs a UserContext + + :param identity: The application-defined string that uniquely identifies the resource to fetch. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + """ + return UserContext( + self._version, service_sid=self._solution["service_sid"], identity=identity + ) + + def __call__(self, identity: str) -> UserContext: + """ + Constructs a UserContext + + :param identity: The application-defined string that uniquely identifies the resource to fetch. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + """ + return UserContext( + self._version, service_sid=self._solution["service_sid"], identity=identity + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/notify/v1/service/user/segment_membership.py b/twilio/rest/notify/v1/service/user/segment_membership.py new file mode 100644 index 000000000..2dcb4f0af --- /dev/null +++ b/twilio/rest/notify/v1/service/user/segment_membership.py @@ -0,0 +1,522 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Notify + 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.api_response import ApiResponse +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 SegmentMembershipInstance(InstanceResource): + + """ + :ivar account_sid: + :ivar service_sid: + :ivar identity: + :ivar segment: + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + identity: str, + segment: Optional[str] = None, + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.identity: Optional[str] = payload.get("identity") + self.segment: Optional[str] = payload.get("segment") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "service_sid": service_sid, + "identity": identity, + "segment": segment or self.segment, + } + self._context: Optional[SegmentMembershipContext] = None + + @property + def _proxy(self) -> "SegmentMembershipContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: SegmentMembershipContext for this SegmentMembershipInstance + """ + if self._context is None: + self._context = SegmentMembershipContext( + self._version, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + segment=self._solution["segment"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the SegmentMembershipInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the SegmentMembershipInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the SegmentMembershipInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return self._proxy.delete_with_http_info() + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the SegmentMembershipInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return await self._proxy.delete_with_http_info_async() + + def fetch(self) -> "SegmentMembershipInstance": + """ + Fetch the SegmentMembershipInstance + + + :returns: The fetched SegmentMembershipInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "SegmentMembershipInstance": + """ + Asynchronous coroutine to fetch the SegmentMembershipInstance + + + :returns: The fetched SegmentMembershipInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the SegmentMembershipInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the SegmentMembershipInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_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 SegmentMembershipContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, identity: str, segment: str): + """ + Initialize the SegmentMembershipContext + + :param version: Version that contains the resource + :param service_sid: + :param identity: + :param segment: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "service_sid": service_sid, + "identity": identity, + "segment": segment, + } + self._uri = "/Services/{service_sid}/Users/{identity}/SegmentMemberships/{segment}".format( + **self._solution + ) + + def _delete(self) -> tuple: + """ + Internal helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + return self._version.delete_with_response_info( + method="DELETE", uri=self._uri, headers=headers + ) + + def delete(self) -> bool: + """ + Deletes the SegmentMembershipInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = self._delete() + return success + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the SegmentMembershipInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = self._delete() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + async def _delete_async(self) -> tuple: + """ + Internal async helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + return await self._version.delete_with_response_info_async( + method="DELETE", uri=self._uri, headers=headers + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the SegmentMembershipInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = await self._delete_async() + return success + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the SegmentMembershipInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = await self._delete_async() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> SegmentMembershipInstance: + """ + Fetch the SegmentMembershipInstance + + + :returns: The fetched SegmentMembershipInstance + """ + payload, _, _ = self._fetch() + return SegmentMembershipInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + segment=self._solution["segment"], + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the SegmentMembershipInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = SegmentMembershipInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + segment=self._solution["segment"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> SegmentMembershipInstance: + """ + Asynchronous coroutine to fetch the SegmentMembershipInstance + + + :returns: The fetched SegmentMembershipInstance + """ + payload, _, _ = await self._fetch_async() + return SegmentMembershipInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + segment=self._solution["segment"], + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the SegmentMembershipInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = SegmentMembershipInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + segment=self._solution["segment"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class SegmentMembershipList(ListResource): + def __init__(self, version: Version, service_sid: str, identity: str): + """ + Initialize the SegmentMembershipList + + :param version: Version that contains the resource + :param service_sid: + :param identity: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "service_sid": service_sid, + "identity": identity, + } + self._uri = ( + "/Services/{service_sid}/Users/{identity}/SegmentMemberships".format( + **self._solution + ) + ) + + def _create(self, segment: str) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "Segment": segment, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create(self, segment: str) -> SegmentMembershipInstance: + """ + Create the SegmentMembershipInstance + + :param segment: + + :returns: The created SegmentMembershipInstance + """ + payload, _, _ = self._create(segment=segment) + return SegmentMembershipInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + ) + + def create_with_http_info(self, segment: str) -> ApiResponse: + """ + Create the SegmentMembershipInstance and return response metadata + + :param segment: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create(segment=segment) + instance = SegmentMembershipInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async(self, segment: str) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "Segment": segment, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async(self, segment: str) -> SegmentMembershipInstance: + """ + Asynchronously create the SegmentMembershipInstance + + :param segment: + + :returns: The created SegmentMembershipInstance + """ + payload, _, _ = await self._create_async(segment=segment) + return SegmentMembershipInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + ) + + async def create_with_http_info_async(self, segment: str) -> ApiResponse: + """ + Asynchronously create the SegmentMembershipInstance and return response metadata + + :param segment: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async(segment=segment) + instance = SegmentMembershipInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def get(self, segment: str) -> SegmentMembershipContext: + """ + Constructs a SegmentMembershipContext + + :param segment: + """ + return SegmentMembershipContext( + self._version, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + segment=segment, + ) + + def __call__(self, segment: str) -> SegmentMembershipContext: + """ + Constructs a SegmentMembershipContext + + :param segment: + """ + return SegmentMembershipContext( + self._version, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + segment=segment, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/notify/v1/service/user/user_binding.py b/twilio/rest/notify/v1/service/user/user_binding.py new file mode 100644 index 000000000..503a30f30 --- /dev/null +++ b/twilio/rest/notify/v1/service/user/user_binding.py @@ -0,0 +1,1161 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Notify + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from datetime import date, datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, serialize, values +from twilio.base.api_response import ApiResponse +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 UserBindingInstance(InstanceResource): + class BindingType(object): + APN = "apn" + GCM = "gcm" + SMS = "sms" + FCM = "fcm" + FACEBOOK_MESSENGER = "facebook-messenger" + ALEXA = "alexa" + + """ + :ivar sid: + :ivar account_sid: + :ivar service_sid: + :ivar credential_sid: + :ivar date_created: + :ivar date_updated: + :ivar notification_protocol_version: + :ivar endpoint: + :ivar identity: + :ivar binding_type: + :ivar address: + :ivar tags: + :ivar url: + :ivar links: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + identity: str, + sid: Optional[str] = None, + ): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.credential_sid: Optional[str] = payload.get("credential_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.notification_protocol_version: Optional[str] = payload.get( + "notification_protocol_version" + ) + self.endpoint: Optional[str] = payload.get("endpoint") + self.identity: Optional[str] = payload.get("identity") + self.binding_type: Optional[str] = payload.get("binding_type") + self.address: Optional[str] = payload.get("address") + self.tags: Optional[List[str]] = payload.get("tags") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") + + self._solution = { + "service_sid": service_sid, + "identity": identity, + "sid": sid or self.sid, + } + self._context: Optional[UserBindingContext] = None + + @property + def _proxy(self) -> "UserBindingContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: UserBindingContext for this UserBindingInstance + """ + if self._context is None: + self._context = UserBindingContext( + self._version, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the UserBindingInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the UserBindingInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the UserBindingInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return self._proxy.delete_with_http_info() + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the UserBindingInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return await self._proxy.delete_with_http_info_async() + + def fetch(self) -> "UserBindingInstance": + """ + Fetch the UserBindingInstance + + + :returns: The fetched UserBindingInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "UserBindingInstance": + """ + Asynchronous coroutine to fetch the UserBindingInstance + + + :returns: The fetched UserBindingInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the UserBindingInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the UserBindingInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_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 UserBindingContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, identity: str, sid: str): + """ + Initialize the UserBindingContext + + :param version: Version that contains the resource + :param service_sid: + :param identity: + :param sid: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "service_sid": service_sid, + "identity": identity, + "sid": sid, + } + self._uri = "/Services/{service_sid}/Users/{identity}/Bindings/{sid}".format( + **self._solution + ) + + def _delete(self) -> tuple: + """ + Internal helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + return self._version.delete_with_response_info( + method="DELETE", uri=self._uri, headers=headers + ) + + def delete(self) -> bool: + """ + Deletes the UserBindingInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = self._delete() + return success + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the UserBindingInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = self._delete() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + async def _delete_async(self) -> tuple: + """ + Internal async helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + return await self._version.delete_with_response_info_async( + method="DELETE", uri=self._uri, headers=headers + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the UserBindingInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = await self._delete_async() + return success + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the UserBindingInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = await self._delete_async() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> UserBindingInstance: + """ + Fetch the UserBindingInstance + + + :returns: The fetched UserBindingInstance + """ + payload, _, _ = self._fetch() + return UserBindingInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + sid=self._solution["sid"], + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the UserBindingInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = UserBindingInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> UserBindingInstance: + """ + Asynchronous coroutine to fetch the UserBindingInstance + + + :returns: The fetched UserBindingInstance + """ + payload, _, _ = await self._fetch_async() + return UserBindingInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + sid=self._solution["sid"], + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the UserBindingInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = UserBindingInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class UserBindingPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> UserBindingInstance: + """ + Build an instance of UserBindingInstance + + :param payload: Payload response from the API + """ + return UserBindingInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class UserBindingList(ListResource): + def __init__(self, version: Version, service_sid: str, identity: str): + """ + Initialize the UserBindingList + + :param version: Version that contains the resource + :param service_sid: + :param identity: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "service_sid": service_sid, + "identity": identity, + } + self._uri = "/Services/{service_sid}/Users/{identity}/Bindings".format( + **self._solution + ) + + def _create( + self, + binding_type: "UserBindingInstance.BindingType", + address: str, + tag: Union[List[str], object] = values.unset, + notification_protocol_version: Union[str, object] = values.unset, + credential_sid: Union[str, object] = values.unset, + endpoint: Union[str, object] = values.unset, + ) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "BindingType": binding_type, + "Address": address, + "Tag": serialize.map(tag, lambda e: e), + "NotificationProtocolVersion": notification_protocol_version, + "CredentialSid": credential_sid, + "Endpoint": endpoint, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, + binding_type: "UserBindingInstance.BindingType", + address: str, + tag: Union[List[str], object] = values.unset, + notification_protocol_version: Union[str, object] = values.unset, + credential_sid: Union[str, object] = values.unset, + endpoint: Union[str, object] = values.unset, + ) -> UserBindingInstance: + """ + Create the UserBindingInstance + + :param binding_type: + :param address: + :param tag: + :param notification_protocol_version: + :param credential_sid: + :param endpoint: + + :returns: The created UserBindingInstance + """ + payload, _, _ = self._create( + binding_type=binding_type, + address=address, + tag=tag, + notification_protocol_version=notification_protocol_version, + credential_sid=credential_sid, + endpoint=endpoint, + ) + return UserBindingInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + ) + + def create_with_http_info( + self, + binding_type: "UserBindingInstance.BindingType", + address: str, + tag: Union[List[str], object] = values.unset, + notification_protocol_version: Union[str, object] = values.unset, + credential_sid: Union[str, object] = values.unset, + endpoint: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Create the UserBindingInstance and return response metadata + + :param binding_type: + :param address: + :param tag: + :param notification_protocol_version: + :param credential_sid: + :param endpoint: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create( + binding_type=binding_type, + address=address, + tag=tag, + notification_protocol_version=notification_protocol_version, + credential_sid=credential_sid, + endpoint=endpoint, + ) + instance = UserBindingInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async( + self, + binding_type: "UserBindingInstance.BindingType", + address: str, + tag: Union[List[str], object] = values.unset, + notification_protocol_version: Union[str, object] = values.unset, + credential_sid: Union[str, object] = values.unset, + endpoint: Union[str, object] = values.unset, + ) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "BindingType": binding_type, + "Address": address, + "Tag": serialize.map(tag, lambda e: e), + "NotificationProtocolVersion": notification_protocol_version, + "CredentialSid": credential_sid, + "Endpoint": endpoint, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, + binding_type: "UserBindingInstance.BindingType", + address: str, + tag: Union[List[str], object] = values.unset, + notification_protocol_version: Union[str, object] = values.unset, + credential_sid: Union[str, object] = values.unset, + endpoint: Union[str, object] = values.unset, + ) -> UserBindingInstance: + """ + Asynchronously create the UserBindingInstance + + :param binding_type: + :param address: + :param tag: + :param notification_protocol_version: + :param credential_sid: + :param endpoint: + + :returns: The created UserBindingInstance + """ + payload, _, _ = await self._create_async( + binding_type=binding_type, + address=address, + tag=tag, + notification_protocol_version=notification_protocol_version, + credential_sid=credential_sid, + endpoint=endpoint, + ) + return UserBindingInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + ) + + async def create_with_http_info_async( + self, + binding_type: "UserBindingInstance.BindingType", + address: str, + tag: Union[List[str], object] = values.unset, + notification_protocol_version: Union[str, object] = values.unset, + credential_sid: Union[str, object] = values.unset, + endpoint: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously create the UserBindingInstance and return response metadata + + :param binding_type: + :param address: + :param tag: + :param notification_protocol_version: + :param credential_sid: + :param endpoint: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + binding_type=binding_type, + address=address, + tag=tag, + notification_protocol_version=notification_protocol_version, + credential_sid=credential_sid, + endpoint=endpoint, + ) + instance = UserBindingInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def stream( + self, + start_date: Union[date, object] = values.unset, + end_date: Union[date, object] = values.unset, + tag: Union[List[str], object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[UserBindingInstance]: + """ + Streams UserBindingInstance 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 date start_date: + :param date end_date: + :param List[str] tag: + :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( + start_date=start_date, + end_date=end_date, + tag=tag, + page_size=limits["page_size"], + ) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + start_date: Union[date, object] = values.unset, + end_date: Union[date, object] = values.unset, + tag: Union[List[str], object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[UserBindingInstance]: + """ + Asynchronously streams UserBindingInstance 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 date start_date: + :param date end_date: + :param List[str] tag: + :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( + start_date=start_date, + end_date=end_date, + tag=tag, + page_size=limits["page_size"], + ) + + return self._version.stream_async(page, limits["limit"]) + + def stream_with_http_info( + self, + start_date: Union[date, object] = values.unset, + end_date: Union[date, object] = values.unset, + tag: Union[List[str], object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams UserBindingInstance and returns headers from first page + + + :param date start_date: + :param date end_date: + :param List[str] tag: + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info( + start_date=start_date, + end_date=end_date, + tag=tag, + page_size=limits["page_size"], + ) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + start_date: Union[date, object] = values.unset, + end_date: Union[date, object] = values.unset, + tag: Union[List[str], object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams UserBindingInstance and returns headers from first page + + + :param date start_date: + :param date end_date: + :param List[str] tag: + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + start_date=start_date, + end_date=end_date, + tag=tag, + page_size=limits["page_size"], + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + start_date: Union[date, object] = values.unset, + end_date: Union[date, object] = values.unset, + tag: Union[List[str], object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[UserBindingInstance]: + """ + Lists UserBindingInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param date start_date: + :param date end_date: + :param List[str] tag: + :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( + start_date=start_date, + end_date=end_date, + tag=tag, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + start_date: Union[date, object] = values.unset, + end_date: Union[date, object] = values.unset, + tag: Union[List[str], object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[UserBindingInstance]: + """ + Asynchronously lists UserBindingInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param date start_date: + :param date end_date: + :param List[str] tag: + :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( + start_date=start_date, + end_date=end_date, + tag=tag, + limit=limit, + page_size=page_size, + ) + ] + + def list_with_http_info( + self, + start_date: Union[date, object] = values.unset, + end_date: Union[date, object] = values.unset, + tag: Union[List[str], object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists UserBindingInstance and returns headers from first page + + + :param date start_date: + :param date end_date: + :param List[str] tag: + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + start_date=start_date, + end_date=end_date, + tag=tag, + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + start_date: Union[date, object] = values.unset, + end_date: Union[date, object] = values.unset, + tag: Union[List[str], object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists UserBindingInstance and returns headers from first page + + + :param date start_date: + :param date end_date: + :param List[str] tag: + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + start_date=start_date, + end_date=end_date, + tag=tag, + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + start_date: Union[date, object] = values.unset, + end_date: Union[date, object] = values.unset, + tag: Union[List[str], object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> UserBindingPage: + """ + Retrieve a single page of UserBindingInstance records from the API. + Request is executed immediately + + :param start_date: + :param end_date: + :param tag: + :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 UserBindingInstance + """ + data = values.of( + { + "StartDate": serialize.iso8601_date(start_date), + "EndDate": serialize.iso8601_date(end_date), + "Tag": serialize.map(tag, lambda e: e), + "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 UserBindingPage(self._version, response, self._solution) + + async def page_async( + self, + start_date: Union[date, object] = values.unset, + end_date: Union[date, object] = values.unset, + tag: Union[List[str], object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> UserBindingPage: + """ + Asynchronously retrieve a single page of UserBindingInstance records from the API. + Request is executed immediately + + :param start_date: + :param end_date: + :param tag: + :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 UserBindingInstance + """ + data = values.of( + { + "StartDate": serialize.iso8601_date(start_date), + "EndDate": serialize.iso8601_date(end_date), + "Tag": serialize.map(tag, lambda e: e), + "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 UserBindingPage(self._version, response, self._solution) + + def page_with_http_info( + self, + start_date: Union[date, object] = values.unset, + end_date: Union[date, object] = values.unset, + tag: Union[List[str], object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :param start_date: + :param end_date: + :param tag: + :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: ApiResponse with UserBindingPage, status code, and headers + """ + data = values.of( + { + "StartDate": serialize.iso8601_date(start_date), + "EndDate": serialize.iso8601_date(end_date), + "Tag": serialize.map(tag, lambda e: e), + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = UserBindingPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + start_date: Union[date, object] = values.unset, + end_date: Union[date, object] = values.unset, + tag: Union[List[str], object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :param start_date: + :param end_date: + :param tag: + :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: ApiResponse with UserBindingPage, status code, and headers + """ + data = values.of( + { + "StartDate": serialize.iso8601_date(start_date), + "EndDate": serialize.iso8601_date(end_date), + "Tag": serialize.map(tag, lambda e: e), + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = UserBindingPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> UserBindingPage: + """ + Retrieve a specific page of UserBindingInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of UserBindingInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return UserBindingPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> UserBindingPage: + """ + Asynchronously retrieve a specific page of UserBindingInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of UserBindingInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return UserBindingPage(self._version, response, self._solution) + + def get(self, sid: str) -> UserBindingContext: + """ + Constructs a UserBindingContext + + :param sid: + """ + return UserBindingContext( + self._version, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + sid=sid, + ) + + def __call__(self, sid: str) -> UserBindingContext: + """ + Constructs a UserBindingContext + + :param sid: + """ + return UserBindingContext( + self._version, + service_sid=self._solution["service_sid"], + identity=self._solution["identity"], + sid=sid, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/numbers/NumbersBase.py b/twilio/rest/numbers/NumbersBase.py index d7b4b3ee8..575f9332e 100644 --- a/twilio/rest/numbers/NumbersBase.py +++ b/twilio/rest/numbers/NumbersBase.py @@ -19,7 +19,6 @@ class NumbersBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Numbers Domain diff --git a/twilio/rest/numbers/v1/__init__.py b/twilio/rest/numbers/v1/__init__.py index 51da08ad1..5fdbf0654 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -15,8 +15,11 @@ from typing import Optional from twilio.base.version import Version from twilio.base.domain import Domain +from twilio.rest.numbers.v1.a2_p_registration_detail import A2PRegistrationDetailList +from twilio.rest.numbers.v1.authorization_document import AuthorizationDocumentList from twilio.rest.numbers.v1.bulk_eligibility import BulkEligibilityList from twilio.rest.numbers.v1.eligibility import EligibilityList +from twilio.rest.numbers.v1.hosted_number_order import HostedNumberOrderList from twilio.rest.numbers.v1.porting_all_port_in import PortingAllPortInList from twilio.rest.numbers.v1.porting_port_in import PortingPortInList from twilio.rest.numbers.v1.porting_port_in_phone_number import ( @@ -36,7 +39,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Numbers @@ -44,13 +46,16 @@ def __init__(self, domain: Domain): :param domain: The Twilio.numbers domain """ super().__init__(domain, "v1") + self._a2_p_registration_details: Optional[A2PRegistrationDetailList] = None + self._authorization_documents: Optional[AuthorizationDocumentList] = None self._bulk_eligibilities: Optional[BulkEligibilityList] = None self._eligibilities: Optional[EligibilityList] = None + self._hosted_number_orders: Optional[HostedNumberOrderList] = None self._porting_all_port_ins: Optional[PortingAllPortInList] = None self._porting_port_ins: Optional[PortingPortInList] = None - self._porting_port_in_phone_number: Optional[PortingPortInPhoneNumberList] = ( - None - ) + self._porting_port_in_phone_number: Optional[ + PortingPortInPhoneNumberList + ] = None self._porting_portabilities: Optional[PortingPortabilityList] = None self._porting_webhook_configurations: Optional[ PortingWebhookConfigurationList @@ -63,6 +68,18 @@ def __init__(self, domain: Domain): ] = None self._webhook: Optional[WebhookList] = None + @property + def a2_p_registration_details(self) -> A2PRegistrationDetailList: + if self._a2_p_registration_details is None: + self._a2_p_registration_details = A2PRegistrationDetailList(self) + return self._a2_p_registration_details + + @property + def authorization_documents(self) -> AuthorizationDocumentList: + if self._authorization_documents is None: + self._authorization_documents = AuthorizationDocumentList(self) + return self._authorization_documents + @property def bulk_eligibilities(self) -> BulkEligibilityList: if self._bulk_eligibilities is None: @@ -75,6 +92,12 @@ def eligibilities(self) -> EligibilityList: self._eligibilities = EligibilityList(self) return self._eligibilities + @property + def hosted_number_orders(self) -> HostedNumberOrderList: + if self._hosted_number_orders is None: + self._hosted_number_orders = HostedNumberOrderList(self) + return self._hosted_number_orders + @property def porting_all_port_ins(self) -> PortingAllPortInList: if self._porting_all_port_ins is None: diff --git a/twilio/rest/numbers/v1/a2_p_registration_detail.py b/twilio/rest/numbers/v1/a2_p_registration_detail.py new file mode 100644 index 000000000..0261ebacd --- /dev/null +++ b/twilio/rest/numbers/v1/a2_p_registration_detail.py @@ -0,0 +1,745 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Numbers + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.api_response import ApiResponse +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 A2PRegistrationDetailInstance(InstanceResource): + + """ + :ivar account_sid: Account Sid that the phone number belongs to in Twilio. This is only returned for phone numbers that already exist in Twilio’s inventory and belong to your account or sub account. + :ivar phone_number_sid: Phone Number SID for the requested phone number resource + :ivar phone_number: + :ivar external_phone_number_status: + :ivar campaign_sid: Campaign Sid associated with the phone number + :ivar messaging_service_sid: Messaging Service Sid that the number is associated with + :ivar external_campaign_id: The identifier for a campaign in the registrar. Typically, this is the TCR Campaign Id. + :ivar last_updated: The date and time when the A2P registration details were last updated + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + phone_number_sid: Optional[str] = None, + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("accountSid") + self.phone_number_sid: Optional[str] = payload.get("phoneNumberSid") + self.phone_number: Optional[str] = payload.get("phoneNumber") + self.external_phone_number_status: Optional[str] = payload.get( + "externalPhoneNumberStatus" + ) + self.campaign_sid: Optional[str] = payload.get("campaignSid") + self.messaging_service_sid: Optional[str] = payload.get("messagingServiceSid") + self.external_campaign_id: Optional[str] = payload.get("externalCampaignId") + self.last_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("lastUpdated") + ) + + self._solution = { + "phone_number_sid": phone_number_sid or self.phone_number_sid, + } + self._context: Optional[A2PRegistrationDetailContext] = None + + @property + def _proxy(self) -> "A2PRegistrationDetailContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: A2PRegistrationDetailContext for this A2PRegistrationDetailInstance + """ + if self._context is None: + self._context = A2PRegistrationDetailContext( + self._version, + phone_number_sid=self._solution["phone_number_sid"], + ) + return self._context + + def fetch(self) -> "A2PRegistrationDetailInstance": + """ + Fetch the A2PRegistrationDetailInstance + + + :returns: The fetched A2PRegistrationDetailInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "A2PRegistrationDetailInstance": + """ + Asynchronous coroutine to fetch the A2PRegistrationDetailInstance + + + :returns: The fetched A2PRegistrationDetailInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the A2PRegistrationDetailInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the A2PRegistrationDetailInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_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 A2PRegistrationDetailContext(InstanceContext): + def __init__(self, version: Version, phone_number_sid: str): + """ + Initialize the A2PRegistrationDetailContext + + :param version: Version that contains the resource + :param phone_number_sid: The SID of the phone number to fetch A2P registration details for + """ + super().__init__(version) + + # Path Solution + self._solution = { + "phone_number_sid": phone_number_sid, + } + self._uri = "/Numbers/{phone_number_sid}/A2pRegistrationDetails".format( + **self._solution + ) + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> A2PRegistrationDetailInstance: + """ + Fetch the A2PRegistrationDetailInstance + + + :returns: The fetched A2PRegistrationDetailInstance + """ + payload, _, _ = self._fetch() + return A2PRegistrationDetailInstance( + self._version, + payload, + phone_number_sid=self._solution["phone_number_sid"], + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the A2PRegistrationDetailInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = A2PRegistrationDetailInstance( + self._version, + payload, + phone_number_sid=self._solution["phone_number_sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> A2PRegistrationDetailInstance: + """ + Asynchronous coroutine to fetch the A2PRegistrationDetailInstance + + + :returns: The fetched A2PRegistrationDetailInstance + """ + payload, _, _ = await self._fetch_async() + return A2PRegistrationDetailInstance( + self._version, + payload, + phone_number_sid=self._solution["phone_number_sid"], + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the A2PRegistrationDetailInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = A2PRegistrationDetailInstance( + self._version, + payload, + phone_number_sid=self._solution["phone_number_sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class A2PRegistrationDetailPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> A2PRegistrationDetailInstance: + """ + Build an instance of A2PRegistrationDetailInstance + + :param payload: Payload response from the API + """ + return A2PRegistrationDetailInstance( + self._version, payload, campaign_sid=self._solution["campaign_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class A2PRegistrationDetailList(ListResource): + def __init__(self, version: Version, campaign_sid: str): + """ + Initialize the A2PRegistrationDetailList + + :param version: Version that contains the resource + :param campaign_sid: The SID of the Campaign to list A2P registration details for + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "campaign_sid": campaign_sid, + } + self._uri = "/Campaigns/{campaign_sid}/A2pRegistrationDetails".format( + **self._solution + ) + + def stream( + self, + status: Union[str, object] = values.unset, + next_token: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[A2PRegistrationDetailInstance]: + """ + Streams A2PRegistrationDetailInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str status: The status for which A2P Registration Details must be returned + :param str next_token: Token for pagination to retrieve the next page of results + :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( + status=status, next_token=next_token, page_size=limits["page_size"] + ) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + status: Union[str, object] = values.unset, + next_token: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[A2PRegistrationDetailInstance]: + """ + Asynchronously streams A2PRegistrationDetailInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str status: The status for which A2P Registration Details must be returned + :param str next_token: Token for pagination to retrieve the next page of results + :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( + status=status, next_token=next_token, page_size=limits["page_size"] + ) + + return self._version.stream_async(page, limits["limit"]) + + def stream_with_http_info( + self, + status: Union[str, object] = values.unset, + next_token: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams A2PRegistrationDetailInstance and returns headers from first page + + + :param str status: The status for which A2P Registration Details must be returned + :param str next_token: Token for pagination to retrieve the next page of results + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info( + status=status, next_token=next_token, page_size=limits["page_size"] + ) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + status: Union[str, object] = values.unset, + next_token: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams A2PRegistrationDetailInstance and returns headers from first page + + + :param str status: The status for which A2P Registration Details must be returned + :param str next_token: Token for pagination to retrieve the next page of results + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + status=status, next_token=next_token, page_size=limits["page_size"] + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + status: Union[str, object] = values.unset, + next_token: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[A2PRegistrationDetailInstance]: + """ + Lists A2PRegistrationDetailInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str status: The status for which A2P Registration Details must be returned + :param str next_token: Token for pagination to retrieve the next page of results + :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( + status=status, + next_token=next_token, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + status: Union[str, object] = values.unset, + next_token: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[A2PRegistrationDetailInstance]: + """ + Asynchronously lists A2PRegistrationDetailInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str status: The status for which A2P Registration Details must be returned + :param str next_token: Token for pagination to retrieve the next page of results + :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( + status=status, + next_token=next_token, + limit=limit, + page_size=page_size, + ) + ] + + def list_with_http_info( + self, + status: Union[str, object] = values.unset, + next_token: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists A2PRegistrationDetailInstance and returns headers from first page + + + :param str status: The status for which A2P Registration Details must be returned + :param str next_token: Token for pagination to retrieve the next page of results + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + status=status, + next_token=next_token, + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + status: Union[str, object] = values.unset, + next_token: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists A2PRegistrationDetailInstance and returns headers from first page + + + :param str status: The status for which A2P Registration Details must be returned + :param str next_token: Token for pagination to retrieve the next page of results + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + status=status, + next_token=next_token, + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + status: Union[str, object] = values.unset, + next_token: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> A2PRegistrationDetailPage: + """ + Retrieve a single page of A2PRegistrationDetailInstance records from the API. + Request is executed immediately + + :param status: The status for which A2P Registration Details must be returned + :param next_token: Token for pagination to retrieve the next page of results + :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 A2PRegistrationDetailInstance + """ + data = values.of( + { + "status": status, + "nextToken": next_token, + "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 A2PRegistrationDetailPage(self._version, response, self._solution) + + async def page_async( + self, + status: Union[str, object] = values.unset, + next_token: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> A2PRegistrationDetailPage: + """ + Asynchronously retrieve a single page of A2PRegistrationDetailInstance records from the API. + Request is executed immediately + + :param status: The status for which A2P Registration Details must be returned + :param next_token: Token for pagination to retrieve the next page of results + :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 A2PRegistrationDetailInstance + """ + data = values.of( + { + "status": status, + "nextToken": next_token, + "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 A2PRegistrationDetailPage(self._version, response, self._solution) + + def page_with_http_info( + self, + status: Union[str, object] = values.unset, + next_token: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :param status: The status for which A2P Registration Details must be returned + :param next_token: Token for pagination to retrieve the next page of results + :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: ApiResponse with A2PRegistrationDetailPage, status code, and headers + """ + data = values.of( + { + "status": status, + "nextToken": next_token, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = A2PRegistrationDetailPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + status: Union[str, object] = values.unset, + next_token: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :param status: The status for which A2P Registration Details must be returned + :param next_token: Token for pagination to retrieve the next page of results + :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: ApiResponse with A2PRegistrationDetailPage, status code, and headers + """ + data = values.of( + { + "status": status, + "nextToken": next_token, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = A2PRegistrationDetailPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> A2PRegistrationDetailPage: + """ + Retrieve a specific page of A2PRegistrationDetailInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of A2PRegistrationDetailInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return A2PRegistrationDetailPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> A2PRegistrationDetailPage: + """ + Asynchronously retrieve a specific page of A2PRegistrationDetailInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of A2PRegistrationDetailInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return A2PRegistrationDetailPage(self._version, response, self._solution) + + def get(self, phone_number_sid: str) -> A2PRegistrationDetailContext: + """ + Constructs a A2PRegistrationDetailContext + + :param phone_number_sid: The SID of the phone number to fetch A2P registration details for + """ + return A2PRegistrationDetailContext( + self._version, phone_number_sid=phone_number_sid + ) + + def __call__(self, phone_number_sid: str) -> A2PRegistrationDetailContext: + """ + Constructs a A2PRegistrationDetailContext + + :param phone_number_sid: The SID of the phone number to fetch A2P registration details for + """ + return A2PRegistrationDetailContext( + self._version, phone_number_sid=phone_number_sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/numbers/v1/authorization_document/__init__.py b/twilio/rest/numbers/v1/authorization_document/__init__.py new file mode 100644 index 000000000..e73b648ee --- /dev/null +++ b/twilio/rest/numbers/v1/authorization_document/__init__.py @@ -0,0 +1,1369 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Numbers + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, serialize, values +from twilio.base.api_response import ApiResponse +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.numbers.v1.authorization_document.dependent_order import ( + DependentOrderList, +) + + +class AuthorizationDocumentInstance(InstanceResource): + class Status(object): + OPENED = "opened" + SIGNING = "signing" + SIGNED = "signed" + CANCELED = "canceled" + FAILED = "failed" + + """ + :ivar address_sid: The SID of the [Address](https://www.twilio.com/docs/usage/api/address) resource that is associated with the AuthorizationDocument resource. + :ivar cc_emails: The email addresses that the authorization document will be copied to. + :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 email: The email address that the authorization document will be sent to for signing. + :ivar links: A list of the URLs to the HostedNumberOrder resources that the authorization document will authorize for hosting phone number capabilities on our platform. + :ivar sid: The unique string that we created to identify the AuthorizationDocument resource. + :ivar status: + :ivar url: The absolute URL of the AuthorizationDocument resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): + super().__init__(version) + + self.address_sid: Optional[str] = payload.get("address_sid") + self.cc_emails: Optional[List[str]] = payload.get("cc_emails") + 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.email: Optional[str] = payload.get("email") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.sid: Optional[str] = payload.get("sid") + self.status: Optional["AuthorizationDocumentInstance.Status"] = payload.get( + "status" + ) + self.url: Optional[str] = payload.get("url") + + self._solution = { + "sid": sid or self.sid, + } + self._context: Optional[AuthorizationDocumentContext] = None + + @property + def _proxy(self) -> "AuthorizationDocumentContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: AuthorizationDocumentContext for this AuthorizationDocumentInstance + """ + if self._context is None: + self._context = AuthorizationDocumentContext( + self._version, + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the AuthorizationDocumentInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the AuthorizationDocumentInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the AuthorizationDocumentInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return self._proxy.delete_with_http_info() + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the AuthorizationDocumentInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return await self._proxy.delete_with_http_info_async() + + def fetch(self) -> "AuthorizationDocumentInstance": + """ + Fetch the AuthorizationDocumentInstance + + + :returns: The fetched AuthorizationDocumentInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "AuthorizationDocumentInstance": + """ + Asynchronous coroutine to fetch the AuthorizationDocumentInstance + + + :returns: The fetched AuthorizationDocumentInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the AuthorizationDocumentInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the AuthorizationDocumentInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_async() + + def update( + self, + address_sid: Union[str, object] = values.unset, + cc_emails: Union[List[str], object] = values.unset, + email: Union[str, object] = values.unset, + hosted_number_order_sids: Union[List[str], object] = values.unset, + status: Union["AuthorizationDocumentInstance.Status", object] = values.unset, + ) -> "AuthorizationDocumentInstance": + """ + Update the AuthorizationDocumentInstance + + :param address_sid: The SID of the [Address](https://www.twilio.com/docs/usage/api/address) resource that is associated with the AuthorizationDocument to update. + :param cc_emails: The email addresses that the new authorization document should be copied to. This parameter takes only one email address. To provide more than one email address, repeat this parameter for each address. + :param email: The email address that the authorization document should be sent to for signing. + :param hosted_number_order_sids: The HostedNumberOrder SIDs that the authorization document will authorize for hosting phone number capabilities on our platform. + :param status: + + :returns: The updated AuthorizationDocumentInstance + """ + return self._proxy.update( + address_sid=address_sid, + cc_emails=cc_emails, + email=email, + hosted_number_order_sids=hosted_number_order_sids, + status=status, + ) + + async def update_async( + self, + address_sid: Union[str, object] = values.unset, + cc_emails: Union[List[str], object] = values.unset, + email: Union[str, object] = values.unset, + hosted_number_order_sids: Union[List[str], object] = values.unset, + status: Union["AuthorizationDocumentInstance.Status", object] = values.unset, + ) -> "AuthorizationDocumentInstance": + """ + Asynchronous coroutine to update the AuthorizationDocumentInstance + + :param address_sid: The SID of the [Address](https://www.twilio.com/docs/usage/api/address) resource that is associated with the AuthorizationDocument to update. + :param cc_emails: The email addresses that the new authorization document should be copied to. This parameter takes only one email address. To provide more than one email address, repeat this parameter for each address. + :param email: The email address that the authorization document should be sent to for signing. + :param hosted_number_order_sids: The HostedNumberOrder SIDs that the authorization document will authorize for hosting phone number capabilities on our platform. + :param status: + + :returns: The updated AuthorizationDocumentInstance + """ + return await self._proxy.update_async( + address_sid=address_sid, + cc_emails=cc_emails, + email=email, + hosted_number_order_sids=hosted_number_order_sids, + status=status, + ) + + def update_with_http_info( + self, + address_sid: Union[str, object] = values.unset, + cc_emails: Union[List[str], object] = values.unset, + email: Union[str, object] = values.unset, + hosted_number_order_sids: Union[List[str], object] = values.unset, + status: Union["AuthorizationDocumentInstance.Status", object] = values.unset, + ) -> ApiResponse: + """ + Update the AuthorizationDocumentInstance with HTTP info + + :param address_sid: The SID of the [Address](https://www.twilio.com/docs/usage/api/address) resource that is associated with the AuthorizationDocument to update. + :param cc_emails: The email addresses that the new authorization document should be copied to. This parameter takes only one email address. To provide more than one email address, repeat this parameter for each address. + :param email: The email address that the authorization document should be sent to for signing. + :param hosted_number_order_sids: The HostedNumberOrder SIDs that the authorization document will authorize for hosting phone number capabilities on our platform. + :param status: + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.update_with_http_info( + address_sid=address_sid, + cc_emails=cc_emails, + email=email, + hosted_number_order_sids=hosted_number_order_sids, + status=status, + ) + + async def update_with_http_info_async( + self, + address_sid: Union[str, object] = values.unset, + cc_emails: Union[List[str], object] = values.unset, + email: Union[str, object] = values.unset, + hosted_number_order_sids: Union[List[str], object] = values.unset, + status: Union["AuthorizationDocumentInstance.Status", object] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to update the AuthorizationDocumentInstance with HTTP info + + :param address_sid: The SID of the [Address](https://www.twilio.com/docs/usage/api/address) resource that is associated with the AuthorizationDocument to update. + :param cc_emails: The email addresses that the new authorization document should be copied to. This parameter takes only one email address. To provide more than one email address, repeat this parameter for each address. + :param email: The email address that the authorization document should be sent to for signing. + :param hosted_number_order_sids: The HostedNumberOrder SIDs that the authorization document will authorize for hosting phone number capabilities on our platform. + :param status: + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.update_with_http_info_async( + address_sid=address_sid, + cc_emails=cc_emails, + email=email, + hosted_number_order_sids=hosted_number_order_sids, + status=status, + ) + + @property + def dependent_orders(self) -> DependentOrderList: + """ + Access the dependent_orders + """ + return self._proxy.dependent_orders + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class AuthorizationDocumentContext(InstanceContext): + def __init__(self, version: Version, sid: str): + """ + Initialize the AuthorizationDocumentContext + + :param version: Version that contains the resource + :param sid: The SID of the AuthorizationDocument resource to update. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "sid": sid, + } + self._uri = "/HostedNumber/AuthorizationDocuments/{sid}".format( + **self._solution + ) + + self._dependent_orders: Optional[DependentOrderList] = None + + def _delete(self) -> tuple: + """ + Internal helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + return self._version.delete_with_response_info( + method="DELETE", uri=self._uri, headers=headers + ) + + def delete(self) -> bool: + """ + Deletes the AuthorizationDocumentInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = self._delete() + return success + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the AuthorizationDocumentInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = self._delete() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + async def _delete_async(self) -> tuple: + """ + Internal async helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + return await self._version.delete_with_response_info_async( + method="DELETE", uri=self._uri, headers=headers + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the AuthorizationDocumentInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = await self._delete_async() + return success + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the AuthorizationDocumentInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = await self._delete_async() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> AuthorizationDocumentInstance: + """ + Fetch the AuthorizationDocumentInstance + + + :returns: The fetched AuthorizationDocumentInstance + """ + payload, _, _ = self._fetch() + return AuthorizationDocumentInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the AuthorizationDocumentInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = AuthorizationDocumentInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> AuthorizationDocumentInstance: + """ + Asynchronous coroutine to fetch the AuthorizationDocumentInstance + + + :returns: The fetched AuthorizationDocumentInstance + """ + payload, _, _ = await self._fetch_async() + return AuthorizationDocumentInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the AuthorizationDocumentInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = AuthorizationDocumentInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def _update( + self, + address_sid: Union[str, object] = values.unset, + cc_emails: Union[List[str], object] = values.unset, + email: Union[str, object] = values.unset, + hosted_number_order_sids: Union[List[str], object] = values.unset, + status: Union["AuthorizationDocumentInstance.Status", object] = values.unset, + ) -> tuple: + """ + Internal helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "AddressSid": address_sid, + "CcEmails": serialize.map(cc_emails, lambda e: e), + "Email": email, + "HostedNumberOrderSids": serialize.map( + hosted_number_order_sids, lambda e: e + ), + "Status": status, + } + ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return self._version.update_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def update( + self, + address_sid: Union[str, object] = values.unset, + cc_emails: Union[List[str], object] = values.unset, + email: Union[str, object] = values.unset, + hosted_number_order_sids: Union[List[str], object] = values.unset, + status: Union["AuthorizationDocumentInstance.Status", object] = values.unset, + ) -> AuthorizationDocumentInstance: + """ + Update the AuthorizationDocumentInstance + + :param address_sid: The SID of the [Address](https://www.twilio.com/docs/usage/api/address) resource that is associated with the AuthorizationDocument to update. + :param cc_emails: The email addresses that the new authorization document should be copied to. This parameter takes only one email address. To provide more than one email address, repeat this parameter for each address. + :param email: The email address that the authorization document should be sent to for signing. + :param hosted_number_order_sids: The HostedNumberOrder SIDs that the authorization document will authorize for hosting phone number capabilities on our platform. + :param status: + + :returns: The updated AuthorizationDocumentInstance + """ + payload, _, _ = self._update( + address_sid=address_sid, + cc_emails=cc_emails, + email=email, + hosted_number_order_sids=hosted_number_order_sids, + status=status, + ) + return AuthorizationDocumentInstance( + self._version, payload, sid=self._solution["sid"] + ) + + def update_with_http_info( + self, + address_sid: Union[str, object] = values.unset, + cc_emails: Union[List[str], object] = values.unset, + email: Union[str, object] = values.unset, + hosted_number_order_sids: Union[List[str], object] = values.unset, + status: Union["AuthorizationDocumentInstance.Status", object] = values.unset, + ) -> ApiResponse: + """ + Update the AuthorizationDocumentInstance and return response metadata + + :param address_sid: The SID of the [Address](https://www.twilio.com/docs/usage/api/address) resource that is associated with the AuthorizationDocument to update. + :param cc_emails: The email addresses that the new authorization document should be copied to. This parameter takes only one email address. To provide more than one email address, repeat this parameter for each address. + :param email: The email address that the authorization document should be sent to for signing. + :param hosted_number_order_sids: The HostedNumberOrder SIDs that the authorization document will authorize for hosting phone number capabilities on our platform. + :param status: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._update( + address_sid=address_sid, + cc_emails=cc_emails, + email=email, + hosted_number_order_sids=hosted_number_order_sids, + status=status, + ) + instance = AuthorizationDocumentInstance( + self._version, payload, sid=self._solution["sid"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _update_async( + self, + address_sid: Union[str, object] = values.unset, + cc_emails: Union[List[str], object] = values.unset, + email: Union[str, object] = values.unset, + hosted_number_order_sids: Union[List[str], object] = values.unset, + status: Union["AuthorizationDocumentInstance.Status", object] = values.unset, + ) -> tuple: + """ + Internal async helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "AddressSid": address_sid, + "CcEmails": serialize.map(cc_emails, lambda e: e), + "Email": email, + "HostedNumberOrderSids": serialize.map( + hosted_number_order_sids, lambda e: e + ), + "Status": status, + } + ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return await self._version.update_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def update_async( + self, + address_sid: Union[str, object] = values.unset, + cc_emails: Union[List[str], object] = values.unset, + email: Union[str, object] = values.unset, + hosted_number_order_sids: Union[List[str], object] = values.unset, + status: Union["AuthorizationDocumentInstance.Status", object] = values.unset, + ) -> AuthorizationDocumentInstance: + """ + Asynchronous coroutine to update the AuthorizationDocumentInstance + + :param address_sid: The SID of the [Address](https://www.twilio.com/docs/usage/api/address) resource that is associated with the AuthorizationDocument to update. + :param cc_emails: The email addresses that the new authorization document should be copied to. This parameter takes only one email address. To provide more than one email address, repeat this parameter for each address. + :param email: The email address that the authorization document should be sent to for signing. + :param hosted_number_order_sids: The HostedNumberOrder SIDs that the authorization document will authorize for hosting phone number capabilities on our platform. + :param status: + + :returns: The updated AuthorizationDocumentInstance + """ + payload, _, _ = await self._update_async( + address_sid=address_sid, + cc_emails=cc_emails, + email=email, + hosted_number_order_sids=hosted_number_order_sids, + status=status, + ) + return AuthorizationDocumentInstance( + self._version, payload, sid=self._solution["sid"] + ) + + async def update_with_http_info_async( + self, + address_sid: Union[str, object] = values.unset, + cc_emails: Union[List[str], object] = values.unset, + email: Union[str, object] = values.unset, + hosted_number_order_sids: Union[List[str], object] = values.unset, + status: Union["AuthorizationDocumentInstance.Status", object] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to update the AuthorizationDocumentInstance and return response metadata + + :param address_sid: The SID of the [Address](https://www.twilio.com/docs/usage/api/address) resource that is associated with the AuthorizationDocument to update. + :param cc_emails: The email addresses that the new authorization document should be copied to. This parameter takes only one email address. To provide more than one email address, repeat this parameter for each address. + :param email: The email address that the authorization document should be sent to for signing. + :param hosted_number_order_sids: The HostedNumberOrder SIDs that the authorization document will authorize for hosting phone number capabilities on our platform. + :param status: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._update_async( + address_sid=address_sid, + cc_emails=cc_emails, + email=email, + hosted_number_order_sids=hosted_number_order_sids, + status=status, + ) + instance = AuthorizationDocumentInstance( + self._version, payload, sid=self._solution["sid"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + @property + def dependent_orders(self) -> DependentOrderList: + """ + Access the dependent_orders + """ + if self._dependent_orders is None: + self._dependent_orders = DependentOrderList( + self._version, + self._solution["sid"], + ) + return self._dependent_orders + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class AuthorizationDocumentPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> AuthorizationDocumentInstance: + """ + Build an instance of AuthorizationDocumentInstance + + :param payload: Payload response from the API + """ + return AuthorizationDocumentInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class AuthorizationDocumentList(ListResource): + def __init__(self, version: Version): + """ + Initialize the AuthorizationDocumentList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/HostedNumber/AuthorizationDocuments" + + def _create( + self, + address_sid: str, + contact_phone_number: str, + contact_title: str, + email: str, + hosted_number_order_sids: List[str], + cc_emails: Union[List[str], object] = values.unset, + ) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "AddressSid": address_sid, + "ContactPhoneNumber": contact_phone_number, + "ContactTitle": contact_title, + "Email": email, + "HostedNumberOrderSids": serialize.map( + hosted_number_order_sids, lambda e: e + ), + "CcEmails": serialize.map(cc_emails, lambda e: e), + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, + address_sid: str, + contact_phone_number: str, + contact_title: str, + email: str, + hosted_number_order_sids: List[str], + cc_emails: Union[List[str], object] = values.unset, + ) -> AuthorizationDocumentInstance: + """ + Create the AuthorizationDocumentInstance + + :param address_sid: The SID of the [Address](https://www.twilio.com/docs/usage/api/address) resource that is associated with the AuthorizationDocument resource to update. + :param contact_phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number of the person who will sign the new authorization document. + :param contact_title: The formal title of the person who will sign the authorization document. For example, `Mr`, `Product Manager`, or `Marketing Director`. + :param email: The email address that the new authorization document should be sent to for signing. + :param hosted_number_order_sids: The HostedNumberOrder SIDs that the new authorization document will authorize for hosting phone number capabilities on our platform. + :param cc_emails: The email addresses that the new authorization document should be copied to. This parameter takes only one email address. To provide more than one email address, repeat this parameter for each address. + + :returns: The created AuthorizationDocumentInstance + """ + payload, _, _ = self._create( + address_sid=address_sid, + contact_phone_number=contact_phone_number, + contact_title=contact_title, + email=email, + hosted_number_order_sids=hosted_number_order_sids, + cc_emails=cc_emails, + ) + return AuthorizationDocumentInstance(self._version, payload) + + def create_with_http_info( + self, + address_sid: str, + contact_phone_number: str, + contact_title: str, + email: str, + hosted_number_order_sids: List[str], + cc_emails: Union[List[str], object] = values.unset, + ) -> ApiResponse: + """ + Create the AuthorizationDocumentInstance and return response metadata + + :param address_sid: The SID of the [Address](https://www.twilio.com/docs/usage/api/address) resource that is associated with the AuthorizationDocument resource to update. + :param contact_phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number of the person who will sign the new authorization document. + :param contact_title: The formal title of the person who will sign the authorization document. For example, `Mr`, `Product Manager`, or `Marketing Director`. + :param email: The email address that the new authorization document should be sent to for signing. + :param hosted_number_order_sids: The HostedNumberOrder SIDs that the new authorization document will authorize for hosting phone number capabilities on our platform. + :param cc_emails: The email addresses that the new authorization document should be copied to. This parameter takes only one email address. To provide more than one email address, repeat this parameter for each address. + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create( + address_sid=address_sid, + contact_phone_number=contact_phone_number, + contact_title=contact_title, + email=email, + hosted_number_order_sids=hosted_number_order_sids, + cc_emails=cc_emails, + ) + instance = AuthorizationDocumentInstance(self._version, payload) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async( + self, + address_sid: str, + contact_phone_number: str, + contact_title: str, + email: str, + hosted_number_order_sids: List[str], + cc_emails: Union[List[str], object] = values.unset, + ) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "AddressSid": address_sid, + "ContactPhoneNumber": contact_phone_number, + "ContactTitle": contact_title, + "Email": email, + "HostedNumberOrderSids": serialize.map( + hosted_number_order_sids, lambda e: e + ), + "CcEmails": serialize.map(cc_emails, lambda e: e), + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, + address_sid: str, + contact_phone_number: str, + contact_title: str, + email: str, + hosted_number_order_sids: List[str], + cc_emails: Union[List[str], object] = values.unset, + ) -> AuthorizationDocumentInstance: + """ + Asynchronously create the AuthorizationDocumentInstance + + :param address_sid: The SID of the [Address](https://www.twilio.com/docs/usage/api/address) resource that is associated with the AuthorizationDocument resource to update. + :param contact_phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number of the person who will sign the new authorization document. + :param contact_title: The formal title of the person who will sign the authorization document. For example, `Mr`, `Product Manager`, or `Marketing Director`. + :param email: The email address that the new authorization document should be sent to for signing. + :param hosted_number_order_sids: The HostedNumberOrder SIDs that the new authorization document will authorize for hosting phone number capabilities on our platform. + :param cc_emails: The email addresses that the new authorization document should be copied to. This parameter takes only one email address. To provide more than one email address, repeat this parameter for each address. + + :returns: The created AuthorizationDocumentInstance + """ + payload, _, _ = await self._create_async( + address_sid=address_sid, + contact_phone_number=contact_phone_number, + contact_title=contact_title, + email=email, + hosted_number_order_sids=hosted_number_order_sids, + cc_emails=cc_emails, + ) + return AuthorizationDocumentInstance(self._version, payload) + + async def create_with_http_info_async( + self, + address_sid: str, + contact_phone_number: str, + contact_title: str, + email: str, + hosted_number_order_sids: List[str], + cc_emails: Union[List[str], object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously create the AuthorizationDocumentInstance and return response metadata + + :param address_sid: The SID of the [Address](https://www.twilio.com/docs/usage/api/address) resource that is associated with the AuthorizationDocument resource to update. + :param contact_phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number of the person who will sign the new authorization document. + :param contact_title: The formal title of the person who will sign the authorization document. For example, `Mr`, `Product Manager`, or `Marketing Director`. + :param email: The email address that the new authorization document should be sent to for signing. + :param hosted_number_order_sids: The HostedNumberOrder SIDs that the new authorization document will authorize for hosting phone number capabilities on our platform. + :param cc_emails: The email addresses that the new authorization document should be copied to. This parameter takes only one email address. To provide more than one email address, repeat this parameter for each address. + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + address_sid=address_sid, + contact_phone_number=contact_phone_number, + contact_title=contact_title, + email=email, + hosted_number_order_sids=hosted_number_order_sids, + cc_emails=cc_emails, + ) + instance = AuthorizationDocumentInstance(self._version, payload) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def stream( + self, + email: Union[str, object] = values.unset, + status: Union["AuthorizationDocumentInstance.Status", object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[AuthorizationDocumentInstance]: + """ + Streams AuthorizationDocumentInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str email: The email address of the AuthorizationDocument resources to read. + :param "AuthorizationDocumentInstance.Status" status: The status of the AuthorizationDocument resources to read. Can be: `opened`, `signing`, `signed`, `canceled`, or `failed`. + :param limit: Upper limit for the number of records to return. stream() + guarantees to never return more than limit. Default is no limit + :param page_size: Number of records to fetch per request, when not set will use + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(email=email, status=status, page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + email: Union[str, object] = values.unset, + status: Union["AuthorizationDocumentInstance.Status", object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[AuthorizationDocumentInstance]: + """ + Asynchronously streams AuthorizationDocumentInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str email: The email address of the AuthorizationDocument resources to read. + :param "AuthorizationDocumentInstance.Status" status: The status of the AuthorizationDocument resources to read. Can be: `opened`, `signing`, `signed`, `canceled`, or `failed`. + :param limit: Upper limit for the number of records to return. stream() + guarantees to never return more than limit. Default is no limit + :param page_size: Number of records to fetch per request, when not set will use + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async( + email=email, status=status, page_size=limits["page_size"] + ) + + return self._version.stream_async(page, limits["limit"]) + + def stream_with_http_info( + self, + email: Union[str, object] = values.unset, + status: Union["AuthorizationDocumentInstance.Status", object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams AuthorizationDocumentInstance and returns headers from first page + + + :param str email: The email address of the AuthorizationDocument resources to read. + :param "AuthorizationDocumentInstance.Status" status: The status of the AuthorizationDocument resources to read. Can be: `opened`, `signing`, `signed`, `canceled`, or `failed`. + :param limit: Upper limit for the number of records to return. stream() + guarantees to never return more than limit. Default is no limit + :param page_size: Number of records to fetch per request, when not set will use + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info( + email=email, status=status, page_size=limits["page_size"] + ) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + email: Union[str, object] = values.unset, + status: Union["AuthorizationDocumentInstance.Status", object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams AuthorizationDocumentInstance and returns headers from first page + + + :param str email: The email address of the AuthorizationDocument resources to read. + :param "AuthorizationDocumentInstance.Status" status: The status of the AuthorizationDocument resources to read. Can be: `opened`, `signing`, `signed`, `canceled`, or `failed`. + :param limit: Upper limit for the number of records to return. stream() + guarantees to never return more than limit. Default is no limit + :param page_size: Number of records to fetch per request, when not set will use + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + email=email, status=status, page_size=limits["page_size"] + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + email: Union[str, object] = values.unset, + status: Union["AuthorizationDocumentInstance.Status", object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[AuthorizationDocumentInstance]: + """ + Lists AuthorizationDocumentInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str email: The email address of the AuthorizationDocument resources to read. + :param "AuthorizationDocumentInstance.Status" status: The status of the AuthorizationDocument resources to read. Can be: `opened`, `signing`, `signed`, `canceled`, or `failed`. + :param limit: Upper limit for the number of records to return. list() guarantees + never to return more than limit. Default is no limit + :param page_size: Number of records to fetch per request, when not set will use + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + email=email, + status=status, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + email: Union[str, object] = values.unset, + status: Union["AuthorizationDocumentInstance.Status", object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[AuthorizationDocumentInstance]: + """ + Asynchronously lists AuthorizationDocumentInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str email: The email address of the AuthorizationDocument resources to read. + :param "AuthorizationDocumentInstance.Status" status: The status of the AuthorizationDocument resources to read. Can be: `opened`, `signing`, `signed`, `canceled`, or `failed`. + :param limit: Upper limit for the number of records to return. list() guarantees + never to return more than limit. Default is no limit + :param page_size: Number of records to fetch per request, when not set will use + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + email=email, + status=status, + limit=limit, + page_size=page_size, + ) + ] + + def list_with_http_info( + self, + email: Union[str, object] = values.unset, + status: Union["AuthorizationDocumentInstance.Status", object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists AuthorizationDocumentInstance and returns headers from first page + + + :param str email: The email address of the AuthorizationDocument resources to read. + :param "AuthorizationDocumentInstance.Status" status: The status of the AuthorizationDocument resources to read. Can be: `opened`, `signing`, `signed`, `canceled`, or `failed`. + :param limit: Upper limit for the number of records to return. list() guarantees + never to return more than limit. Default is no limit + :param page_size: Number of records to fetch per request, when not set will use + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + email=email, + status=status, + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + email: Union[str, object] = values.unset, + status: Union["AuthorizationDocumentInstance.Status", object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists AuthorizationDocumentInstance and returns headers from first page + + + :param str email: The email address of the AuthorizationDocument resources to read. + :param "AuthorizationDocumentInstance.Status" status: The status of the AuthorizationDocument resources to read. Can be: `opened`, `signing`, `signed`, `canceled`, or `failed`. + :param limit: Upper limit for the number of records to return. list() guarantees + never to return more than limit. Default is no limit + :param page_size: Number of records to fetch per request, when not set will use + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + email=email, + status=status, + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + email: Union[str, object] = values.unset, + status: Union["AuthorizationDocumentInstance.Status", object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> AuthorizationDocumentPage: + """ + Retrieve a single page of AuthorizationDocumentInstance records from the API. + Request is executed immediately + + :param email: The email address of the AuthorizationDocument resources to read. + :param status: The status of the AuthorizationDocument resources to read. Can be: `opened`, `signing`, `signed`, `canceled`, or `failed`. + :param page_token: PageToken provided by the API + :param page_number: Page Number, this value is simply for client state + :param page_size: Number of records to return, defaults to 50 + + :returns: Page of AuthorizationDocumentInstance + """ + data = values.of( + { + "Email": email, + "Status": status, + "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 AuthorizationDocumentPage(self._version, response) + + async def page_async( + self, + email: Union[str, object] = values.unset, + status: Union["AuthorizationDocumentInstance.Status", object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> AuthorizationDocumentPage: + """ + Asynchronously retrieve a single page of AuthorizationDocumentInstance records from the API. + Request is executed immediately + + :param email: The email address of the AuthorizationDocument resources to read. + :param status: The status of the AuthorizationDocument resources to read. Can be: `opened`, `signing`, `signed`, `canceled`, or `failed`. + :param page_token: PageToken provided by the API + :param page_number: Page Number, this value is simply for client state + :param page_size: Number of records to return, defaults to 50 + + :returns: Page of AuthorizationDocumentInstance + """ + data = values.of( + { + "Email": email, + "Status": status, + "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 AuthorizationDocumentPage(self._version, response) + + def page_with_http_info( + self, + email: Union[str, object] = values.unset, + status: Union["AuthorizationDocumentInstance.Status", object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :param email: The email address of the AuthorizationDocument resources to read. + :param status: The status of the AuthorizationDocument resources to read. Can be: `opened`, `signing`, `signed`, `canceled`, or `failed`. + :param page_token: PageToken provided by the API + :param page_number: Page Number, this value is simply for client state + :param page_size: Number of records to return, defaults to 50 + + :returns: ApiResponse with AuthorizationDocumentPage, status code, and headers + """ + data = values.of( + { + "Email": email, + "Status": status, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = AuthorizationDocumentPage(self._version, response) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + email: Union[str, object] = values.unset, + status: Union["AuthorizationDocumentInstance.Status", object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :param email: The email address of the AuthorizationDocument resources to read. + :param status: The status of the AuthorizationDocument resources to read. Can be: `opened`, `signing`, `signed`, `canceled`, or `failed`. + :param page_token: PageToken provided by the API + :param page_number: Page Number, this value is simply for client state + :param page_size: Number of records to return, defaults to 50 + + :returns: ApiResponse with AuthorizationDocumentPage, status code, and headers + """ + data = values.of( + { + "Email": email, + "Status": status, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = AuthorizationDocumentPage(self._version, response) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> AuthorizationDocumentPage: + """ + Retrieve a specific page of AuthorizationDocumentInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of AuthorizationDocumentInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return AuthorizationDocumentPage(self._version, response) + + async def get_page_async(self, target_url: str) -> AuthorizationDocumentPage: + """ + Asynchronously retrieve a specific page of AuthorizationDocumentInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of AuthorizationDocumentInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return AuthorizationDocumentPage(self._version, response) + + def get(self, sid: str) -> AuthorizationDocumentContext: + """ + Constructs a AuthorizationDocumentContext + + :param sid: The SID of the AuthorizationDocument resource to update. + """ + return AuthorizationDocumentContext(self._version, sid=sid) + + def __call__(self, sid: str) -> AuthorizationDocumentContext: + """ + Constructs a AuthorizationDocumentContext + + :param sid: The SID of the AuthorizationDocument resource to update. + """ + return AuthorizationDocumentContext(self._version, sid=sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/numbers/v1/authorization_document/dependent_order.py b/twilio/rest/numbers/v1/authorization_document/dependent_order.py new file mode 100644 index 000000000..1414d6da9 --- /dev/null +++ b/twilio/rest/numbers/v1/authorization_document/dependent_order.py @@ -0,0 +1,685 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Numbers + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.api_response import ApiResponse + +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 DependentOrderInstance(InstanceResource): + class Status(object): + TWILIO_PROCESSING = "twilio-processing" + RECEIVED = "received" + PENDING_VERIFICATION = "pending-verification" + VERIFIED = "verified" + PENDING_LOA = "pending-loa" + CARRIER_PROCESSING = "carrier-processing" + TESTING = "testing" + COMPLETED = "completed" + FAILED = "failed" + ACTION_REQUIRED = "action-required" + + class VerificationType(object): + PHONE_CALL = "phone-call" + PHONE_BILL = "phone-bill" + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the DependentOrder resource. + :ivar authorization_document_sid: The SID of the AuthorizationDocument resource associated with the hosted number order. + :ivar capabilities: + :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 failure_reason: The message that explains why the hosted number order `status` became `action-required`. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource created by the hosted number order. + :ivar phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number hosted by the hosted number order. + :ivar sid: The unique string that we created to identify the DependentOrder resource. + :ivar status: + :ivar verification_attempts: The number of attempts made to verify ownership via a call for the hosted phone number. + :ivar verification_call_delay: The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + :ivar verification_call_extension: The numerical extension to dial when making the ownership verification call. + :ivar verification_call_sids: The Call SIDs that identify the calls placed to verify ownership. + :ivar verification_code: The digits the user must pass in the ownership verification call. + :ivar verification_document_sid: The SID of the identity document resource that represents the document used to verify ownership of the number to be hosted. + :ivar verification_type: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], signing_document_sid: str + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.authorization_document_sid: Optional[str] = payload.get( + "authorization_document_sid" + ) + self.capabilities: Optional[str] = payload.get("capabilities") + 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.failure_reason: Optional[str] = payload.get("failure_reason") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.incoming_phone_number_sid: Optional[str] = payload.get( + "incoming_phone_number_sid" + ) + self.phone_number: Optional[str] = payload.get("phone_number") + self.sid: Optional[str] = payload.get("sid") + self.status: Optional["DependentOrderInstance.Status"] = payload.get("status") + self.verification_attempts: Optional[int] = deserialize.integer( + payload.get("verification_attempts") + ) + self.verification_call_delay: Optional[int] = deserialize.integer( + payload.get("verification_call_delay") + ) + self.verification_call_extension: Optional[str] = payload.get( + "verification_call_extension" + ) + self.verification_call_sids: Optional[List[str]] = payload.get( + "verification_call_sids" + ) + self.verification_code: Optional[str] = payload.get("verification_code") + self.verification_document_sid: Optional[str] = payload.get( + "verification_document_sid" + ) + self.verification_type: Optional[ + "DependentOrderInstance.VerificationType" + ] = payload.get("verification_type") + + self._solution = { + "signing_document_sid": signing_document_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 DependentOrderPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> DependentOrderInstance: + """ + Build an instance of DependentOrderInstance + + :param payload: Payload response from the API + """ + return DependentOrderInstance( + self._version, + payload, + signing_document_sid=self._solution["signing_document_sid"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class DependentOrderList(ListResource): + def __init__(self, version: Version, signing_document_sid: str): + """ + Initialize the DependentOrderList + + :param version: Version that contains the resource + :param signing_document_sid: The SID of the AuthorizationDocument resource that refers to the DependentOrder resources to read. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "signing_document_sid": signing_document_sid, + } + self._uri = "/HostedNumber/AuthorizationDocuments/{signing_document_sid}/DependentOrders".format( + **self._solution + ) + + def stream( + self, + friendly_name: Union[str, object] = values.unset, + incoming_phone_number_sid: Union[str, object] = values.unset, + phone_number: Union[str, object] = values.unset, + status: Union["DependentOrderInstance.Status", object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[DependentOrderInstance]: + """ + Streams DependentOrderInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str friendly_name: The string that identifies the DependentOrder resources to read. + :param str incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource of the DependentOrder resources to read. + :param str phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone numbers of the DependentOrder resources to read. + :param "DependentOrderInstance.Status" status: The status of the DependentOrder resources to read. Can be: `twilio-processing`, `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + :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( + friendly_name=friendly_name, + incoming_phone_number_sid=incoming_phone_number_sid, + phone_number=phone_number, + status=status, + page_size=limits["page_size"], + ) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + friendly_name: Union[str, object] = values.unset, + incoming_phone_number_sid: Union[str, object] = values.unset, + phone_number: Union[str, object] = values.unset, + status: Union["DependentOrderInstance.Status", object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[DependentOrderInstance]: + """ + Asynchronously streams DependentOrderInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str friendly_name: The string that identifies the DependentOrder resources to read. + :param str incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource of the DependentOrder resources to read. + :param str phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone numbers of the DependentOrder resources to read. + :param "DependentOrderInstance.Status" status: The status of the DependentOrder resources to read. Can be: `twilio-processing`, `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + :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( + friendly_name=friendly_name, + incoming_phone_number_sid=incoming_phone_number_sid, + phone_number=phone_number, + status=status, + page_size=limits["page_size"], + ) + + return self._version.stream_async(page, limits["limit"]) + + def stream_with_http_info( + self, + friendly_name: Union[str, object] = values.unset, + incoming_phone_number_sid: Union[str, object] = values.unset, + phone_number: Union[str, object] = values.unset, + status: Union["DependentOrderInstance.Status", object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams DependentOrderInstance and returns headers from first page + + + :param str friendly_name: The string that identifies the DependentOrder resources to read. + :param str incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource of the DependentOrder resources to read. + :param str phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone numbers of the DependentOrder resources to read. + :param "DependentOrderInstance.Status" status: The status of the DependentOrder resources to read. Can be: `twilio-processing`, `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info( + friendly_name=friendly_name, + incoming_phone_number_sid=incoming_phone_number_sid, + phone_number=phone_number, + status=status, + page_size=limits["page_size"], + ) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + friendly_name: Union[str, object] = values.unset, + incoming_phone_number_sid: Union[str, object] = values.unset, + phone_number: Union[str, object] = values.unset, + status: Union["DependentOrderInstance.Status", object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams DependentOrderInstance and returns headers from first page + + + :param str friendly_name: The string that identifies the DependentOrder resources to read. + :param str incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource of the DependentOrder resources to read. + :param str phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone numbers of the DependentOrder resources to read. + :param "DependentOrderInstance.Status" status: The status of the DependentOrder resources to read. Can be: `twilio-processing`, `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + friendly_name=friendly_name, + incoming_phone_number_sid=incoming_phone_number_sid, + phone_number=phone_number, + status=status, + page_size=limits["page_size"], + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + friendly_name: Union[str, object] = values.unset, + incoming_phone_number_sid: Union[str, object] = values.unset, + phone_number: Union[str, object] = values.unset, + status: Union["DependentOrderInstance.Status", object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[DependentOrderInstance]: + """ + Lists DependentOrderInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str friendly_name: The string that identifies the DependentOrder resources to read. + :param str incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource of the DependentOrder resources to read. + :param str phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone numbers of the DependentOrder resources to read. + :param "DependentOrderInstance.Status" status: The status of the DependentOrder resources to read. Can be: `twilio-processing`, `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + :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( + friendly_name=friendly_name, + incoming_phone_number_sid=incoming_phone_number_sid, + phone_number=phone_number, + status=status, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + friendly_name: Union[str, object] = values.unset, + incoming_phone_number_sid: Union[str, object] = values.unset, + phone_number: Union[str, object] = values.unset, + status: Union["DependentOrderInstance.Status", object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[DependentOrderInstance]: + """ + Asynchronously lists DependentOrderInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str friendly_name: The string that identifies the DependentOrder resources to read. + :param str incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource of the DependentOrder resources to read. + :param str phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone numbers of the DependentOrder resources to read. + :param "DependentOrderInstance.Status" status: The status of the DependentOrder resources to read. Can be: `twilio-processing`, `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + :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( + friendly_name=friendly_name, + incoming_phone_number_sid=incoming_phone_number_sid, + phone_number=phone_number, + status=status, + limit=limit, + page_size=page_size, + ) + ] + + def list_with_http_info( + self, + friendly_name: Union[str, object] = values.unset, + incoming_phone_number_sid: Union[str, object] = values.unset, + phone_number: Union[str, object] = values.unset, + status: Union["DependentOrderInstance.Status", object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists DependentOrderInstance and returns headers from first page + + + :param str friendly_name: The string that identifies the DependentOrder resources to read. + :param str incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource of the DependentOrder resources to read. + :param str phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone numbers of the DependentOrder resources to read. + :param "DependentOrderInstance.Status" status: The status of the DependentOrder resources to read. Can be: `twilio-processing`, `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + friendly_name=friendly_name, + incoming_phone_number_sid=incoming_phone_number_sid, + phone_number=phone_number, + status=status, + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + friendly_name: Union[str, object] = values.unset, + incoming_phone_number_sid: Union[str, object] = values.unset, + phone_number: Union[str, object] = values.unset, + status: Union["DependentOrderInstance.Status", object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists DependentOrderInstance and returns headers from first page + + + :param str friendly_name: The string that identifies the DependentOrder resources to read. + :param str incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource of the DependentOrder resources to read. + :param str phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone numbers of the DependentOrder resources to read. + :param "DependentOrderInstance.Status" status: The status of the DependentOrder resources to read. Can be: `twilio-processing`, `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + friendly_name=friendly_name, + incoming_phone_number_sid=incoming_phone_number_sid, + phone_number=phone_number, + status=status, + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + friendly_name: Union[str, object] = values.unset, + incoming_phone_number_sid: Union[str, object] = values.unset, + phone_number: Union[str, object] = values.unset, + status: Union["DependentOrderInstance.Status", object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> DependentOrderPage: + """ + Retrieve a single page of DependentOrderInstance records from the API. + Request is executed immediately + + :param friendly_name: The string that identifies the DependentOrder resources to read. + :param incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource of the DependentOrder resources to read. + :param phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone numbers of the DependentOrder resources to read. + :param status: The status of the DependentOrder resources to read. Can be: `twilio-processing`, `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + :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 DependentOrderInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "IncomingPhoneNumberSid": incoming_phone_number_sid, + "PhoneNumber": phone_number, + "Status": status, + "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 DependentOrderPage(self._version, response, self._solution) + + async def page_async( + self, + friendly_name: Union[str, object] = values.unset, + incoming_phone_number_sid: Union[str, object] = values.unset, + phone_number: Union[str, object] = values.unset, + status: Union["DependentOrderInstance.Status", object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> DependentOrderPage: + """ + Asynchronously retrieve a single page of DependentOrderInstance records from the API. + Request is executed immediately + + :param friendly_name: The string that identifies the DependentOrder resources to read. + :param incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource of the DependentOrder resources to read. + :param phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone numbers of the DependentOrder resources to read. + :param status: The status of the DependentOrder resources to read. Can be: `twilio-processing`, `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + :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 DependentOrderInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "IncomingPhoneNumberSid": incoming_phone_number_sid, + "PhoneNumber": phone_number, + "Status": status, + "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 DependentOrderPage(self._version, response, self._solution) + + def page_with_http_info( + self, + friendly_name: Union[str, object] = values.unset, + incoming_phone_number_sid: Union[str, object] = values.unset, + phone_number: Union[str, object] = values.unset, + status: Union["DependentOrderInstance.Status", object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :param friendly_name: The string that identifies the DependentOrder resources to read. + :param incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource of the DependentOrder resources to read. + :param phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone numbers of the DependentOrder resources to read. + :param status: The status of the DependentOrder resources to read. Can be: `twilio-processing`, `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + :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: ApiResponse with DependentOrderPage, status code, and headers + """ + data = values.of( + { + "FriendlyName": friendly_name, + "IncomingPhoneNumberSid": incoming_phone_number_sid, + "PhoneNumber": phone_number, + "Status": status, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = DependentOrderPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + friendly_name: Union[str, object] = values.unset, + incoming_phone_number_sid: Union[str, object] = values.unset, + phone_number: Union[str, object] = values.unset, + status: Union["DependentOrderInstance.Status", object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :param friendly_name: The string that identifies the DependentOrder resources to read. + :param incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource of the DependentOrder resources to read. + :param phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone numbers of the DependentOrder resources to read. + :param status: The status of the DependentOrder resources to read. Can be: `twilio-processing`, `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + :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: ApiResponse with DependentOrderPage, status code, and headers + """ + data = values.of( + { + "FriendlyName": friendly_name, + "IncomingPhoneNumberSid": incoming_phone_number_sid, + "PhoneNumber": phone_number, + "Status": status, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = DependentOrderPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> DependentOrderPage: + """ + Retrieve a specific page of DependentOrderInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of DependentOrderInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return DependentOrderPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> DependentOrderPage: + """ + Asynchronously retrieve a specific page of DependentOrderInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of DependentOrderInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return DependentOrderPage(self._version, response, self._solution) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/numbers/v1/bulk_eligibility.py b/twilio/rest/numbers/v1/bulk_eligibility.py index 4d9957167..ba3e68255 100644 --- a/twilio/rest/numbers/v1/bulk_eligibility.py +++ b/twilio/rest/numbers/v1/bulk_eligibility.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, List, Optional, Union from twilio.base import deserialize, values @@ -23,6 +24,7 @@ class BulkEligibilityInstance(InstanceResource): + """ :ivar request_id: The SID of the bulk eligibility check that you want to know about. :ivar url: This is the url of the request that you're trying to reach out to locate the resource. @@ -120,7 +122,6 @@ def __repr__(self) -> str: class BulkEligibilityContext(InstanceContext): - def __init__(self, version: Version, request_id: str): """ Initialize the BulkEligibilityContext @@ -239,7 +240,6 @@ def __repr__(self) -> str: class BulkEligibilityList(ListResource): - def __init__(self, version: Version): """ Initialize the BulkEligibilityList diff --git a/twilio/rest/numbers/v1/eligibility.py b/twilio/rest/numbers/v1/eligibility.py index 37d6f1c07..1620c9498 100644 --- a/twilio/rest/numbers/v1/eligibility.py +++ b/twilio/rest/numbers/v1/eligibility.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class EligibilityInstance(InstanceResource): + """ :ivar results: The result set that contains the eligibility check response for the requested number, each result has at least the following attributes: phone_number: The requested phone number ,hosting_account_sid: The account sid where the phone number will be hosted, date_last_checked: Datetime (ISO 8601) when the PN was last checked for eligibility, country: Phone number’s country, eligibility_status: Indicates the eligibility status of the PN (Eligible/Ineligible), eligibility_sub_status: Indicates the sub status of the eligibility , ineligibility_reason: Reason for number's ineligibility (if applicable), next_step: Suggested next step in the hosting process based on the eligibility status. """ @@ -42,7 +44,6 @@ def __repr__(self) -> str: class EligibilityList(ListResource): - def __init__(self, version: Version): """ Initialize the EligibilityList diff --git a/twilio/rest/numbers/v1/hosted_number_order.py b/twilio/rest/numbers/v1/hosted_number_order.py new file mode 100644 index 000000000..2aa4f6925 --- /dev/null +++ b/twilio/rest/numbers/v1/hosted_number_order.py @@ -0,0 +1,1666 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Numbers + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, serialize, values +from twilio.base.api_response import ApiResponse +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 HostedNumberOrderInstance(InstanceResource): + class Status(object): + TWILIO_PROCESSING = "twilio-processing" + RECEIVED = "received" + PENDING_VERIFICATION = "pending-verification" + VERIFIED = "verified" + PENDING_LOA = "pending-loa" + CARRIER_PROCESSING = "carrier-processing" + TESTING = "testing" + COMPLETED = "completed" + FAILED = "failed" + ACTION_REQUIRED = "action-required" + + class VerificationType(object): + PHONE_CALL = "phone-call" + PHONE_BILL = "phone-bill" + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the HostedNumberOrder resource. + :ivar authorization_document_sid: The SID of the AuthorizationDocument resource associated with the hosted number order. + :ivar capabilities: + :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 failure_reason: The message that explains why the hosted number order `status` became `action-required`. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource created by this hosted number order. + :ivar phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number hosted by the hosted number order. + :ivar sid: The unique string that we created to identify the HostedNumberOrder resource. + :ivar status: + :ivar url: The absolute URL of the HostedNumberOrder resource. + :ivar verification_attempts: The number of attempts made to verify ownership via a call for the hosted phone number. + :ivar verification_call_delay: The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + :ivar verification_call_extension: The numerical extension to dial when making the ownership verification call. + :ivar verification_call_sids: The Call SIDs that identify the calls placed to verify ownership. + :ivar verification_code: The digits the user must pass in the ownership verification call. + :ivar verification_document_sid: The SID of the identity document resource that represents the document used to verify ownership of the number to be hosted. + :ivar verification_type: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.authorization_document_sid: Optional[str] = payload.get( + "authorization_document_sid" + ) + self.capabilities: Optional[str] = payload.get("capabilities") + 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.failure_reason: Optional[str] = payload.get("failure_reason") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.incoming_phone_number_sid: Optional[str] = payload.get( + "incoming_phone_number_sid" + ) + self.phone_number: Optional[str] = payload.get("phone_number") + self.sid: Optional[str] = payload.get("sid") + self.status: Optional["HostedNumberOrderInstance.Status"] = payload.get( + "status" + ) + self.url: Optional[str] = payload.get("url") + self.verification_attempts: Optional[int] = deserialize.integer( + payload.get("verification_attempts") + ) + self.verification_call_delay: Optional[int] = deserialize.integer( + payload.get("verification_call_delay") + ) + self.verification_call_extension: Optional[str] = payload.get( + "verification_call_extension" + ) + self.verification_call_sids: Optional[List[str]] = payload.get( + "verification_call_sids" + ) + self.verification_code: Optional[str] = payload.get("verification_code") + self.verification_document_sid: Optional[str] = payload.get( + "verification_document_sid" + ) + self.verification_type: Optional[ + "HostedNumberOrderInstance.VerificationType" + ] = payload.get("verification_type") + + self._solution = { + "sid": sid or self.sid, + } + self._context: Optional[HostedNumberOrderContext] = None + + @property + def _proxy(self) -> "HostedNumberOrderContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: HostedNumberOrderContext for this HostedNumberOrderInstance + """ + if self._context is None: + self._context = HostedNumberOrderContext( + self._version, + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the HostedNumberOrderInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the HostedNumberOrderInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the HostedNumberOrderInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return self._proxy.delete_with_http_info() + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the HostedNumberOrderInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return await self._proxy.delete_with_http_info_async() + + def fetch(self) -> "HostedNumberOrderInstance": + """ + Fetch the HostedNumberOrderInstance + + + :returns: The fetched HostedNumberOrderInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "HostedNumberOrderInstance": + """ + Asynchronous coroutine to fetch the HostedNumberOrderInstance + + + :returns: The fetched HostedNumberOrderInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the HostedNumberOrderInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the HostedNumberOrderInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_async() + + def update( + self, + friendly_name: Union[str, object] = values.unset, + status: Union["HostedNumberOrderInstance.Status", object] = values.unset, + verification_call_delay: Union[int, object] = values.unset, + verification_call_extension: Union[str, object] = values.unset, + verification_document_sid: Union[str, object] = values.unset, + verification_type: Union[ + "HostedNumberOrderInstance.VerificationType", object + ] = values.unset, + ) -> "HostedNumberOrderInstance": + """ + Update the HostedNumberOrderInstance + + :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 128 characters long. + :param status: + :param verification_call_delay: The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + :param verification_call_extension: The numerical extension to dial when making the ownership verification call. + :param verification_document_sid: The SID of the Identity Document that represents the document for verifying ownership of the number to be hosted. Required when `verification_type` is `phone-bill`. + :param verification_type: + + :returns: The updated HostedNumberOrderInstance + """ + return self._proxy.update( + friendly_name=friendly_name, + status=status, + verification_call_delay=verification_call_delay, + verification_call_extension=verification_call_extension, + verification_document_sid=verification_document_sid, + verification_type=verification_type, + ) + + async def update_async( + self, + friendly_name: Union[str, object] = values.unset, + status: Union["HostedNumberOrderInstance.Status", object] = values.unset, + verification_call_delay: Union[int, object] = values.unset, + verification_call_extension: Union[str, object] = values.unset, + verification_document_sid: Union[str, object] = values.unset, + verification_type: Union[ + "HostedNumberOrderInstance.VerificationType", object + ] = values.unset, + ) -> "HostedNumberOrderInstance": + """ + Asynchronous coroutine to update the HostedNumberOrderInstance + + :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 128 characters long. + :param status: + :param verification_call_delay: The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + :param verification_call_extension: The numerical extension to dial when making the ownership verification call. + :param verification_document_sid: The SID of the Identity Document that represents the document for verifying ownership of the number to be hosted. Required when `verification_type` is `phone-bill`. + :param verification_type: + + :returns: The updated HostedNumberOrderInstance + """ + return await self._proxy.update_async( + friendly_name=friendly_name, + status=status, + verification_call_delay=verification_call_delay, + verification_call_extension=verification_call_extension, + verification_document_sid=verification_document_sid, + verification_type=verification_type, + ) + + def update_with_http_info( + self, + friendly_name: Union[str, object] = values.unset, + status: Union["HostedNumberOrderInstance.Status", object] = values.unset, + verification_call_delay: Union[int, object] = values.unset, + verification_call_extension: Union[str, object] = values.unset, + verification_document_sid: Union[str, object] = values.unset, + verification_type: Union[ + "HostedNumberOrderInstance.VerificationType", object + ] = values.unset, + ) -> ApiResponse: + """ + Update the HostedNumberOrderInstance with HTTP info + + :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 128 characters long. + :param status: + :param verification_call_delay: The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + :param verification_call_extension: The numerical extension to dial when making the ownership verification call. + :param verification_document_sid: The SID of the Identity Document that represents the document for verifying ownership of the number to be hosted. Required when `verification_type` is `phone-bill`. + :param verification_type: + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.update_with_http_info( + friendly_name=friendly_name, + status=status, + verification_call_delay=verification_call_delay, + verification_call_extension=verification_call_extension, + verification_document_sid=verification_document_sid, + verification_type=verification_type, + ) + + async def update_with_http_info_async( + self, + friendly_name: Union[str, object] = values.unset, + status: Union["HostedNumberOrderInstance.Status", object] = values.unset, + verification_call_delay: Union[int, object] = values.unset, + verification_call_extension: Union[str, object] = values.unset, + verification_document_sid: Union[str, object] = values.unset, + verification_type: Union[ + "HostedNumberOrderInstance.VerificationType", object + ] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to update the HostedNumberOrderInstance with HTTP info + + :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 128 characters long. + :param status: + :param verification_call_delay: The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + :param verification_call_extension: The numerical extension to dial when making the ownership verification call. + :param verification_document_sid: The SID of the Identity Document that represents the document for verifying ownership of the number to be hosted. Required when `verification_type` is `phone-bill`. + :param verification_type: + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.update_with_http_info_async( + friendly_name=friendly_name, + status=status, + verification_call_delay=verification_call_delay, + verification_call_extension=verification_call_extension, + verification_document_sid=verification_document_sid, + verification_type=verification_type, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class HostedNumberOrderContext(InstanceContext): + def __init__(self, version: Version, sid: str): + """ + Initialize the HostedNumberOrderContext + + :param version: Version that contains the resource + :param sid: The SID of the HostedNumberOrder resource to update. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "sid": sid, + } + self._uri = "/HostedNumber/Orders/{sid}".format(**self._solution) + + def _delete(self) -> tuple: + """ + Internal helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + return self._version.delete_with_response_info( + method="DELETE", uri=self._uri, headers=headers + ) + + def delete(self) -> bool: + """ + Deletes the HostedNumberOrderInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = self._delete() + return success + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the HostedNumberOrderInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = self._delete() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + async def _delete_async(self) -> tuple: + """ + Internal async helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + return await self._version.delete_with_response_info_async( + method="DELETE", uri=self._uri, headers=headers + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the HostedNumberOrderInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = await self._delete_async() + return success + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the HostedNumberOrderInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = await self._delete_async() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> HostedNumberOrderInstance: + """ + Fetch the HostedNumberOrderInstance + + + :returns: The fetched HostedNumberOrderInstance + """ + payload, _, _ = self._fetch() + return HostedNumberOrderInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the HostedNumberOrderInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = HostedNumberOrderInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> HostedNumberOrderInstance: + """ + Asynchronous coroutine to fetch the HostedNumberOrderInstance + + + :returns: The fetched HostedNumberOrderInstance + """ + payload, _, _ = await self._fetch_async() + return HostedNumberOrderInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the HostedNumberOrderInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = HostedNumberOrderInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def _update( + self, + friendly_name: Union[str, object] = values.unset, + status: Union["HostedNumberOrderInstance.Status", object] = values.unset, + verification_call_delay: Union[int, object] = values.unset, + verification_call_extension: Union[str, object] = values.unset, + verification_document_sid: Union[str, object] = values.unset, + verification_type: Union[ + "HostedNumberOrderInstance.VerificationType", object + ] = values.unset, + ) -> tuple: + """ + Internal helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "FriendlyName": friendly_name, + "Status": status, + "VerificationCallDelay": verification_call_delay, + "VerificationCallExtension": verification_call_extension, + "VerificationDocumentSid": verification_document_sid, + "VerificationType": verification_type, + } + ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return self._version.update_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def update( + self, + friendly_name: Union[str, object] = values.unset, + status: Union["HostedNumberOrderInstance.Status", object] = values.unset, + verification_call_delay: Union[int, object] = values.unset, + verification_call_extension: Union[str, object] = values.unset, + verification_document_sid: Union[str, object] = values.unset, + verification_type: Union[ + "HostedNumberOrderInstance.VerificationType", object + ] = values.unset, + ) -> HostedNumberOrderInstance: + """ + Update the HostedNumberOrderInstance + + :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 128 characters long. + :param status: + :param verification_call_delay: The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + :param verification_call_extension: The numerical extension to dial when making the ownership verification call. + :param verification_document_sid: The SID of the Identity Document that represents the document for verifying ownership of the number to be hosted. Required when `verification_type` is `phone-bill`. + :param verification_type: + + :returns: The updated HostedNumberOrderInstance + """ + payload, _, _ = self._update( + friendly_name=friendly_name, + status=status, + verification_call_delay=verification_call_delay, + verification_call_extension=verification_call_extension, + verification_document_sid=verification_document_sid, + verification_type=verification_type, + ) + return HostedNumberOrderInstance( + self._version, payload, sid=self._solution["sid"] + ) + + def update_with_http_info( + self, + friendly_name: Union[str, object] = values.unset, + status: Union["HostedNumberOrderInstance.Status", object] = values.unset, + verification_call_delay: Union[int, object] = values.unset, + verification_call_extension: Union[str, object] = values.unset, + verification_document_sid: Union[str, object] = values.unset, + verification_type: Union[ + "HostedNumberOrderInstance.VerificationType", object + ] = values.unset, + ) -> ApiResponse: + """ + Update the HostedNumberOrderInstance and return response metadata + + :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 128 characters long. + :param status: + :param verification_call_delay: The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + :param verification_call_extension: The numerical extension to dial when making the ownership verification call. + :param verification_document_sid: The SID of the Identity Document that represents the document for verifying ownership of the number to be hosted. Required when `verification_type` is `phone-bill`. + :param verification_type: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._update( + friendly_name=friendly_name, + status=status, + verification_call_delay=verification_call_delay, + verification_call_extension=verification_call_extension, + verification_document_sid=verification_document_sid, + verification_type=verification_type, + ) + instance = HostedNumberOrderInstance( + self._version, payload, sid=self._solution["sid"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _update_async( + self, + friendly_name: Union[str, object] = values.unset, + status: Union["HostedNumberOrderInstance.Status", object] = values.unset, + verification_call_delay: Union[int, object] = values.unset, + verification_call_extension: Union[str, object] = values.unset, + verification_document_sid: Union[str, object] = values.unset, + verification_type: Union[ + "HostedNumberOrderInstance.VerificationType", object + ] = values.unset, + ) -> tuple: + """ + Internal async helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "FriendlyName": friendly_name, + "Status": status, + "VerificationCallDelay": verification_call_delay, + "VerificationCallExtension": verification_call_extension, + "VerificationDocumentSid": verification_document_sid, + "VerificationType": verification_type, + } + ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return await self._version.update_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def update_async( + self, + friendly_name: Union[str, object] = values.unset, + status: Union["HostedNumberOrderInstance.Status", object] = values.unset, + verification_call_delay: Union[int, object] = values.unset, + verification_call_extension: Union[str, object] = values.unset, + verification_document_sid: Union[str, object] = values.unset, + verification_type: Union[ + "HostedNumberOrderInstance.VerificationType", object + ] = values.unset, + ) -> HostedNumberOrderInstance: + """ + Asynchronous coroutine to update the HostedNumberOrderInstance + + :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 128 characters long. + :param status: + :param verification_call_delay: The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + :param verification_call_extension: The numerical extension to dial when making the ownership verification call. + :param verification_document_sid: The SID of the Identity Document that represents the document for verifying ownership of the number to be hosted. Required when `verification_type` is `phone-bill`. + :param verification_type: + + :returns: The updated HostedNumberOrderInstance + """ + payload, _, _ = await self._update_async( + friendly_name=friendly_name, + status=status, + verification_call_delay=verification_call_delay, + verification_call_extension=verification_call_extension, + verification_document_sid=verification_document_sid, + verification_type=verification_type, + ) + return HostedNumberOrderInstance( + self._version, payload, sid=self._solution["sid"] + ) + + async def update_with_http_info_async( + self, + friendly_name: Union[str, object] = values.unset, + status: Union["HostedNumberOrderInstance.Status", object] = values.unset, + verification_call_delay: Union[int, object] = values.unset, + verification_call_extension: Union[str, object] = values.unset, + verification_document_sid: Union[str, object] = values.unset, + verification_type: Union[ + "HostedNumberOrderInstance.VerificationType", object + ] = values.unset, + ) -> ApiResponse: + """ + Asynchronous coroutine to update the HostedNumberOrderInstance and return response metadata + + :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 128 characters long. + :param status: + :param verification_call_delay: The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + :param verification_call_extension: The numerical extension to dial when making the ownership verification call. + :param verification_document_sid: The SID of the Identity Document that represents the document for verifying ownership of the number to be hosted. Required when `verification_type` is `phone-bill`. + :param verification_type: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._update_async( + friendly_name=friendly_name, + status=status, + verification_call_delay=verification_call_delay, + verification_call_extension=verification_call_extension, + verification_document_sid=verification_document_sid, + verification_type=verification_type, + ) + instance = HostedNumberOrderInstance( + self._version, payload, sid=self._solution["sid"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class HostedNumberOrderPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> HostedNumberOrderInstance: + """ + Build an instance of HostedNumberOrderInstance + + :param payload: Payload response from the API + """ + return HostedNumberOrderInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class HostedNumberOrderList(ListResource): + def __init__(self, version: Version): + """ + Initialize the HostedNumberOrderList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/HostedNumber/Orders" + + def _create( + self, + phone_number: str, + sms_capability: bool, + account_sid: Union[str, object] = values.unset, + friendly_name: Union[str, object] = values.unset, + sms_application_sid: Union[str, object] = values.unset, + sms_fallback_method: Union[str, object] = values.unset, + sms_fallback_url: Union[str, object] = values.unset, + sms_method: Union[str, object] = values.unset, + sms_url: Union[str, object] = values.unset, + status_callback_method: Union[str, object] = values.unset, + status_callback_url: Union[str, object] = values.unset, + verification_call_delay: Union[int, object] = values.unset, + verification_call_extension: Union[str, object] = values.unset, + verification_document_sid: Union[str, object] = values.unset, + verification_type: Union[ + "HostedNumberOrderInstance.VerificationType", object + ] = values.unset, + ) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "PhoneNumber": phone_number, + "SmsCapability": serialize.boolean_to_string(sms_capability), + "AccountSid": account_sid, + "FriendlyName": friendly_name, + "SmsApplicationSid": sms_application_sid, + "SmsFallbackMethod": sms_fallback_method, + "SmsFallbackUrl": sms_fallback_url, + "SmsMethod": sms_method, + "SmsUrl": sms_url, + "StatusCallbackMethod": status_callback_method, + "StatusCallbackUrl": status_callback_url, + "VerificationCallDelay": verification_call_delay, + "VerificationCallExtension": verification_call_extension, + "VerificationDocumentSid": verification_document_sid, + "VerificationType": verification_type, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, + phone_number: str, + sms_capability: bool, + account_sid: Union[str, object] = values.unset, + friendly_name: Union[str, object] = values.unset, + sms_application_sid: Union[str, object] = values.unset, + sms_fallback_method: Union[str, object] = values.unset, + sms_fallback_url: Union[str, object] = values.unset, + sms_method: Union[str, object] = values.unset, + sms_url: Union[str, object] = values.unset, + status_callback_method: Union[str, object] = values.unset, + status_callback_url: Union[str, object] = values.unset, + verification_call_delay: Union[int, object] = values.unset, + verification_call_extension: Union[str, object] = values.unset, + verification_document_sid: Union[str, object] = values.unset, + verification_type: Union[ + "HostedNumberOrderInstance.VerificationType", object + ] = values.unset, + ) -> HostedNumberOrderInstance: + """ + Create the HostedNumberOrderInstance + + :param phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number hosted by the new hosted number order. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234. + :param sms_capability: Whether the SMS capability will be hosted on our platform. Can be `true` of `false`. + :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. + :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 128 characters long. + :param sms_application_sid: The SID of the Application we should use to handle SMS messages sent to this number. If a `sms_application_sid` is present, we will ignore all of the SMS URLs and use those set on the application. + :param sms_fallback_method: The HTTP method we should use to call the `sms_fallback_url`. Can be: `POST` or `GET` and the default is `POST`. + :param sms_fallback_url: The URL we should call if there is a problem calling `sms_url` when the IncomingPhoneNumber receives an SMS message. + :param sms_method: The HTTP method we should use to call the `sms_url`. Can be: `POST` or `GET` and the default is `POST`. + :param sms_url: The URL we should call using the `sms_method` when the IncomingPhoneNumber receives an SMS message. + :param status_callback_method: The HTTP method we should use when calling `status_callback_url`. + :param status_callback_url: The URL we should call using the `status_callback_method` to send status information to your application. + :param verification_call_delay: The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + :param verification_call_extension: The numerical extension to dial when making the ownership verification call. + :param verification_document_sid: The SID of the identity document resource that represents the document used to verify ownership of the number to be hosted. + :param verification_type: + + :returns: The created HostedNumberOrderInstance + """ + payload, _, _ = self._create( + phone_number=phone_number, + sms_capability=sms_capability, + account_sid=account_sid, + friendly_name=friendly_name, + sms_application_sid=sms_application_sid, + sms_fallback_method=sms_fallback_method, + sms_fallback_url=sms_fallback_url, + sms_method=sms_method, + sms_url=sms_url, + status_callback_method=status_callback_method, + status_callback_url=status_callback_url, + verification_call_delay=verification_call_delay, + verification_call_extension=verification_call_extension, + verification_document_sid=verification_document_sid, + verification_type=verification_type, + ) + return HostedNumberOrderInstance(self._version, payload) + + def create_with_http_info( + self, + phone_number: str, + sms_capability: bool, + account_sid: Union[str, object] = values.unset, + friendly_name: Union[str, object] = values.unset, + sms_application_sid: Union[str, object] = values.unset, + sms_fallback_method: Union[str, object] = values.unset, + sms_fallback_url: Union[str, object] = values.unset, + sms_method: Union[str, object] = values.unset, + sms_url: Union[str, object] = values.unset, + status_callback_method: Union[str, object] = values.unset, + status_callback_url: Union[str, object] = values.unset, + verification_call_delay: Union[int, object] = values.unset, + verification_call_extension: Union[str, object] = values.unset, + verification_document_sid: Union[str, object] = values.unset, + verification_type: Union[ + "HostedNumberOrderInstance.VerificationType", object + ] = values.unset, + ) -> ApiResponse: + """ + Create the HostedNumberOrderInstance and return response metadata + + :param phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number hosted by the new hosted number order. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234. + :param sms_capability: Whether the SMS capability will be hosted on our platform. Can be `true` of `false`. + :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. + :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 128 characters long. + :param sms_application_sid: The SID of the Application we should use to handle SMS messages sent to this number. If a `sms_application_sid` is present, we will ignore all of the SMS URLs and use those set on the application. + :param sms_fallback_method: The HTTP method we should use to call the `sms_fallback_url`. Can be: `POST` or `GET` and the default is `POST`. + :param sms_fallback_url: The URL we should call if there is a problem calling `sms_url` when the IncomingPhoneNumber receives an SMS message. + :param sms_method: The HTTP method we should use to call the `sms_url`. Can be: `POST` or `GET` and the default is `POST`. + :param sms_url: The URL we should call using the `sms_method` when the IncomingPhoneNumber receives an SMS message. + :param status_callback_method: The HTTP method we should use when calling `status_callback_url`. + :param status_callback_url: The URL we should call using the `status_callback_method` to send status information to your application. + :param verification_call_delay: The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + :param verification_call_extension: The numerical extension to dial when making the ownership verification call. + :param verification_document_sid: The SID of the identity document resource that represents the document used to verify ownership of the number to be hosted. + :param verification_type: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create( + phone_number=phone_number, + sms_capability=sms_capability, + account_sid=account_sid, + friendly_name=friendly_name, + sms_application_sid=sms_application_sid, + sms_fallback_method=sms_fallback_method, + sms_fallback_url=sms_fallback_url, + sms_method=sms_method, + sms_url=sms_url, + status_callback_method=status_callback_method, + status_callback_url=status_callback_url, + verification_call_delay=verification_call_delay, + verification_call_extension=verification_call_extension, + verification_document_sid=verification_document_sid, + verification_type=verification_type, + ) + instance = HostedNumberOrderInstance(self._version, payload) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async( + self, + phone_number: str, + sms_capability: bool, + account_sid: Union[str, object] = values.unset, + friendly_name: Union[str, object] = values.unset, + sms_application_sid: Union[str, object] = values.unset, + sms_fallback_method: Union[str, object] = values.unset, + sms_fallback_url: Union[str, object] = values.unset, + sms_method: Union[str, object] = values.unset, + sms_url: Union[str, object] = values.unset, + status_callback_method: Union[str, object] = values.unset, + status_callback_url: Union[str, object] = values.unset, + verification_call_delay: Union[int, object] = values.unset, + verification_call_extension: Union[str, object] = values.unset, + verification_document_sid: Union[str, object] = values.unset, + verification_type: Union[ + "HostedNumberOrderInstance.VerificationType", object + ] = values.unset, + ) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "PhoneNumber": phone_number, + "SmsCapability": serialize.boolean_to_string(sms_capability), + "AccountSid": account_sid, + "FriendlyName": friendly_name, + "SmsApplicationSid": sms_application_sid, + "SmsFallbackMethod": sms_fallback_method, + "SmsFallbackUrl": sms_fallback_url, + "SmsMethod": sms_method, + "SmsUrl": sms_url, + "StatusCallbackMethod": status_callback_method, + "StatusCallbackUrl": status_callback_url, + "VerificationCallDelay": verification_call_delay, + "VerificationCallExtension": verification_call_extension, + "VerificationDocumentSid": verification_document_sid, + "VerificationType": verification_type, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, + phone_number: str, + sms_capability: bool, + account_sid: Union[str, object] = values.unset, + friendly_name: Union[str, object] = values.unset, + sms_application_sid: Union[str, object] = values.unset, + sms_fallback_method: Union[str, object] = values.unset, + sms_fallback_url: Union[str, object] = values.unset, + sms_method: Union[str, object] = values.unset, + sms_url: Union[str, object] = values.unset, + status_callback_method: Union[str, object] = values.unset, + status_callback_url: Union[str, object] = values.unset, + verification_call_delay: Union[int, object] = values.unset, + verification_call_extension: Union[str, object] = values.unset, + verification_document_sid: Union[str, object] = values.unset, + verification_type: Union[ + "HostedNumberOrderInstance.VerificationType", object + ] = values.unset, + ) -> HostedNumberOrderInstance: + """ + Asynchronously create the HostedNumberOrderInstance + + :param phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number hosted by the new hosted number order. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234. + :param sms_capability: Whether the SMS capability will be hosted on our platform. Can be `true` of `false`. + :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. + :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 128 characters long. + :param sms_application_sid: The SID of the Application we should use to handle SMS messages sent to this number. If a `sms_application_sid` is present, we will ignore all of the SMS URLs and use those set on the application. + :param sms_fallback_method: The HTTP method we should use to call the `sms_fallback_url`. Can be: `POST` or `GET` and the default is `POST`. + :param sms_fallback_url: The URL we should call if there is a problem calling `sms_url` when the IncomingPhoneNumber receives an SMS message. + :param sms_method: The HTTP method we should use to call the `sms_url`. Can be: `POST` or `GET` and the default is `POST`. + :param sms_url: The URL we should call using the `sms_method` when the IncomingPhoneNumber receives an SMS message. + :param status_callback_method: The HTTP method we should use when calling `status_callback_url`. + :param status_callback_url: The URL we should call using the `status_callback_method` to send status information to your application. + :param verification_call_delay: The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + :param verification_call_extension: The numerical extension to dial when making the ownership verification call. + :param verification_document_sid: The SID of the identity document resource that represents the document used to verify ownership of the number to be hosted. + :param verification_type: + + :returns: The created HostedNumberOrderInstance + """ + payload, _, _ = await self._create_async( + phone_number=phone_number, + sms_capability=sms_capability, + account_sid=account_sid, + friendly_name=friendly_name, + sms_application_sid=sms_application_sid, + sms_fallback_method=sms_fallback_method, + sms_fallback_url=sms_fallback_url, + sms_method=sms_method, + sms_url=sms_url, + status_callback_method=status_callback_method, + status_callback_url=status_callback_url, + verification_call_delay=verification_call_delay, + verification_call_extension=verification_call_extension, + verification_document_sid=verification_document_sid, + verification_type=verification_type, + ) + return HostedNumberOrderInstance(self._version, payload) + + async def create_with_http_info_async( + self, + phone_number: str, + sms_capability: bool, + account_sid: Union[str, object] = values.unset, + friendly_name: Union[str, object] = values.unset, + sms_application_sid: Union[str, object] = values.unset, + sms_fallback_method: Union[str, object] = values.unset, + sms_fallback_url: Union[str, object] = values.unset, + sms_method: Union[str, object] = values.unset, + sms_url: Union[str, object] = values.unset, + status_callback_method: Union[str, object] = values.unset, + status_callback_url: Union[str, object] = values.unset, + verification_call_delay: Union[int, object] = values.unset, + verification_call_extension: Union[str, object] = values.unset, + verification_document_sid: Union[str, object] = values.unset, + verification_type: Union[ + "HostedNumberOrderInstance.VerificationType", object + ] = values.unset, + ) -> ApiResponse: + """ + Asynchronously create the HostedNumberOrderInstance and return response metadata + + :param phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number hosted by the new hosted number order. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234. + :param sms_capability: Whether the SMS capability will be hosted on our platform. Can be `true` of `false`. + :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. + :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 128 characters long. + :param sms_application_sid: The SID of the Application we should use to handle SMS messages sent to this number. If a `sms_application_sid` is present, we will ignore all of the SMS URLs and use those set on the application. + :param sms_fallback_method: The HTTP method we should use to call the `sms_fallback_url`. Can be: `POST` or `GET` and the default is `POST`. + :param sms_fallback_url: The URL we should call if there is a problem calling `sms_url` when the IncomingPhoneNumber receives an SMS message. + :param sms_method: The HTTP method we should use to call the `sms_url`. Can be: `POST` or `GET` and the default is `POST`. + :param sms_url: The URL we should call using the `sms_method` when the IncomingPhoneNumber receives an SMS message. + :param status_callback_method: The HTTP method we should use when calling `status_callback_url`. + :param status_callback_url: The URL we should call using the `status_callback_method` to send status information to your application. + :param verification_call_delay: The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + :param verification_call_extension: The numerical extension to dial when making the ownership verification call. + :param verification_document_sid: The SID of the identity document resource that represents the document used to verify ownership of the number to be hosted. + :param verification_type: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + phone_number=phone_number, + sms_capability=sms_capability, + account_sid=account_sid, + friendly_name=friendly_name, + sms_application_sid=sms_application_sid, + sms_fallback_method=sms_fallback_method, + sms_fallback_url=sms_fallback_url, + sms_method=sms_method, + sms_url=sms_url, + status_callback_method=status_callback_method, + status_callback_url=status_callback_url, + verification_call_delay=verification_call_delay, + verification_call_extension=verification_call_extension, + verification_document_sid=verification_document_sid, + verification_type=verification_type, + ) + instance = HostedNumberOrderInstance(self._version, payload) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def stream( + self, + friendly_name: Union[str, object] = values.unset, + incoming_phone_number_sid: Union[str, object] = values.unset, + phone_number: Union[str, object] = values.unset, + status: Union["HostedNumberOrderInstance.Status", object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[HostedNumberOrderInstance]: + """ + Streams HostedNumberOrderInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str friendly_name: The string that identifies the HostedNumberOrder resources to read. + :param str incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource created by this HostedNumberOrder. + :param str phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone numbers of the HostedNumberOrder resources to read. + :param "HostedNumberOrderInstance.Status" status: The status of the resources to read. Can be: `twilio-processing`, `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + :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( + friendly_name=friendly_name, + incoming_phone_number_sid=incoming_phone_number_sid, + phone_number=phone_number, + status=status, + page_size=limits["page_size"], + ) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + friendly_name: Union[str, object] = values.unset, + incoming_phone_number_sid: Union[str, object] = values.unset, + phone_number: Union[str, object] = values.unset, + status: Union["HostedNumberOrderInstance.Status", object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[HostedNumberOrderInstance]: + """ + Asynchronously streams HostedNumberOrderInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str friendly_name: The string that identifies the HostedNumberOrder resources to read. + :param str incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource created by this HostedNumberOrder. + :param str phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone numbers of the HostedNumberOrder resources to read. + :param "HostedNumberOrderInstance.Status" status: The status of the resources to read. Can be: `twilio-processing`, `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + :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( + friendly_name=friendly_name, + incoming_phone_number_sid=incoming_phone_number_sid, + phone_number=phone_number, + status=status, + page_size=limits["page_size"], + ) + + return self._version.stream_async(page, limits["limit"]) + + def stream_with_http_info( + self, + friendly_name: Union[str, object] = values.unset, + incoming_phone_number_sid: Union[str, object] = values.unset, + phone_number: Union[str, object] = values.unset, + status: Union["HostedNumberOrderInstance.Status", object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams HostedNumberOrderInstance and returns headers from first page + + + :param str friendly_name: The string that identifies the HostedNumberOrder resources to read. + :param str incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource created by this HostedNumberOrder. + :param str phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone numbers of the HostedNumberOrder resources to read. + :param "HostedNumberOrderInstance.Status" status: The status of the resources to read. Can be: `twilio-processing`, `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info( + friendly_name=friendly_name, + incoming_phone_number_sid=incoming_phone_number_sid, + phone_number=phone_number, + status=status, + page_size=limits["page_size"], + ) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + friendly_name: Union[str, object] = values.unset, + incoming_phone_number_sid: Union[str, object] = values.unset, + phone_number: Union[str, object] = values.unset, + status: Union["HostedNumberOrderInstance.Status", object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams HostedNumberOrderInstance and returns headers from first page + + + :param str friendly_name: The string that identifies the HostedNumberOrder resources to read. + :param str incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource created by this HostedNumberOrder. + :param str phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone numbers of the HostedNumberOrder resources to read. + :param "HostedNumberOrderInstance.Status" status: The status of the resources to read. Can be: `twilio-processing`, `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + friendly_name=friendly_name, + incoming_phone_number_sid=incoming_phone_number_sid, + phone_number=phone_number, + status=status, + page_size=limits["page_size"], + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + friendly_name: Union[str, object] = values.unset, + incoming_phone_number_sid: Union[str, object] = values.unset, + phone_number: Union[str, object] = values.unset, + status: Union["HostedNumberOrderInstance.Status", object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[HostedNumberOrderInstance]: + """ + Lists HostedNumberOrderInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str friendly_name: The string that identifies the HostedNumberOrder resources to read. + :param str incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource created by this HostedNumberOrder. + :param str phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone numbers of the HostedNumberOrder resources to read. + :param "HostedNumberOrderInstance.Status" status: The status of the resources to read. Can be: `twilio-processing`, `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + :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( + friendly_name=friendly_name, + incoming_phone_number_sid=incoming_phone_number_sid, + phone_number=phone_number, + status=status, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + friendly_name: Union[str, object] = values.unset, + incoming_phone_number_sid: Union[str, object] = values.unset, + phone_number: Union[str, object] = values.unset, + status: Union["HostedNumberOrderInstance.Status", object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[HostedNumberOrderInstance]: + """ + Asynchronously lists HostedNumberOrderInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str friendly_name: The string that identifies the HostedNumberOrder resources to read. + :param str incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource created by this HostedNumberOrder. + :param str phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone numbers of the HostedNumberOrder resources to read. + :param "HostedNumberOrderInstance.Status" status: The status of the resources to read. Can be: `twilio-processing`, `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + :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( + friendly_name=friendly_name, + incoming_phone_number_sid=incoming_phone_number_sid, + phone_number=phone_number, + status=status, + limit=limit, + page_size=page_size, + ) + ] + + def list_with_http_info( + self, + friendly_name: Union[str, object] = values.unset, + incoming_phone_number_sid: Union[str, object] = values.unset, + phone_number: Union[str, object] = values.unset, + status: Union["HostedNumberOrderInstance.Status", object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists HostedNumberOrderInstance and returns headers from first page + + + :param str friendly_name: The string that identifies the HostedNumberOrder resources to read. + :param str incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource created by this HostedNumberOrder. + :param str phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone numbers of the HostedNumberOrder resources to read. + :param "HostedNumberOrderInstance.Status" status: The status of the resources to read. Can be: `twilio-processing`, `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + friendly_name=friendly_name, + incoming_phone_number_sid=incoming_phone_number_sid, + phone_number=phone_number, + status=status, + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + friendly_name: Union[str, object] = values.unset, + incoming_phone_number_sid: Union[str, object] = values.unset, + phone_number: Union[str, object] = values.unset, + status: Union["HostedNumberOrderInstance.Status", object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists HostedNumberOrderInstance and returns headers from first page + + + :param str friendly_name: The string that identifies the HostedNumberOrder resources to read. + :param str incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource created by this HostedNumberOrder. + :param str phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone numbers of the HostedNumberOrder resources to read. + :param "HostedNumberOrderInstance.Status" status: The status of the resources to read. Can be: `twilio-processing`, `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + friendly_name=friendly_name, + incoming_phone_number_sid=incoming_phone_number_sid, + phone_number=phone_number, + status=status, + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + friendly_name: Union[str, object] = values.unset, + incoming_phone_number_sid: Union[str, object] = values.unset, + phone_number: Union[str, object] = values.unset, + status: Union["HostedNumberOrderInstance.Status", object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> HostedNumberOrderPage: + """ + Retrieve a single page of HostedNumberOrderInstance records from the API. + Request is executed immediately + + :param friendly_name: The string that identifies the HostedNumberOrder resources to read. + :param incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource created by this HostedNumberOrder. + :param phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone numbers of the HostedNumberOrder resources to read. + :param status: The status of the resources to read. Can be: `twilio-processing`, `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + :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 HostedNumberOrderInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "IncomingPhoneNumberSid": incoming_phone_number_sid, + "PhoneNumber": phone_number, + "Status": status, + "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 HostedNumberOrderPage(self._version, response) + + async def page_async( + self, + friendly_name: Union[str, object] = values.unset, + incoming_phone_number_sid: Union[str, object] = values.unset, + phone_number: Union[str, object] = values.unset, + status: Union["HostedNumberOrderInstance.Status", object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> HostedNumberOrderPage: + """ + Asynchronously retrieve a single page of HostedNumberOrderInstance records from the API. + Request is executed immediately + + :param friendly_name: The string that identifies the HostedNumberOrder resources to read. + :param incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource created by this HostedNumberOrder. + :param phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone numbers of the HostedNumberOrder resources to read. + :param status: The status of the resources to read. Can be: `twilio-processing`, `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + :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 HostedNumberOrderInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "IncomingPhoneNumberSid": incoming_phone_number_sid, + "PhoneNumber": phone_number, + "Status": status, + "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 HostedNumberOrderPage(self._version, response) + + def page_with_http_info( + self, + friendly_name: Union[str, object] = values.unset, + incoming_phone_number_sid: Union[str, object] = values.unset, + phone_number: Union[str, object] = values.unset, + status: Union["HostedNumberOrderInstance.Status", object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :param friendly_name: The string that identifies the HostedNumberOrder resources to read. + :param incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource created by this HostedNumberOrder. + :param phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone numbers of the HostedNumberOrder resources to read. + :param status: The status of the resources to read. Can be: `twilio-processing`, `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + :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: ApiResponse with HostedNumberOrderPage, status code, and headers + """ + data = values.of( + { + "FriendlyName": friendly_name, + "IncomingPhoneNumberSid": incoming_phone_number_sid, + "PhoneNumber": phone_number, + "Status": status, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = HostedNumberOrderPage(self._version, response) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + friendly_name: Union[str, object] = values.unset, + incoming_phone_number_sid: Union[str, object] = values.unset, + phone_number: Union[str, object] = values.unset, + status: Union["HostedNumberOrderInstance.Status", object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :param friendly_name: The string that identifies the HostedNumberOrder resources to read. + :param incoming_phone_number_sid: The SID of the IncomingPhoneNumber resource created by this HostedNumberOrder. + :param phone_number: The [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone numbers of the HostedNumberOrder resources to read. + :param status: The status of the resources to read. Can be: `twilio-processing`, `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + :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: ApiResponse with HostedNumberOrderPage, status code, and headers + """ + data = values.of( + { + "FriendlyName": friendly_name, + "IncomingPhoneNumberSid": incoming_phone_number_sid, + "PhoneNumber": phone_number, + "Status": status, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = HostedNumberOrderPage(self._version, response) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> HostedNumberOrderPage: + """ + Retrieve a specific page of HostedNumberOrderInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of HostedNumberOrderInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return HostedNumberOrderPage(self._version, response) + + async def get_page_async(self, target_url: str) -> HostedNumberOrderPage: + """ + Asynchronously retrieve a specific page of HostedNumberOrderInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of HostedNumberOrderInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return HostedNumberOrderPage(self._version, response) + + def get(self, sid: str) -> HostedNumberOrderContext: + """ + Constructs a HostedNumberOrderContext + + :param sid: The SID of the HostedNumberOrder resource to update. + """ + return HostedNumberOrderContext(self._version, sid=sid) + + def __call__(self, sid: str) -> HostedNumberOrderContext: + """ + Constructs a HostedNumberOrderContext + + :param sid: The SID of the HostedNumberOrder resource to update. + """ + return HostedNumberOrderContext(self._version, sid=sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/numbers/v1/porting_all_port_in.py b/twilio/rest/numbers/v1/porting_all_port_in.py index c4a36d8a9..c1edcaede 100644 --- a/twilio/rest/numbers/v1/porting_all_port_in.py +++ b/twilio/rest/numbers/v1/porting_all_port_in.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import deserialize, values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class PortingAllPortInInstance(InstanceResource): + """ :ivar port_in_request_sid: The SID of the Port-in request :ivar port_in_request_status: Status of the Port In Request @@ -61,7 +63,6 @@ def __repr__(self) -> str: class PortingAllPortInPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> PortingAllPortInInstance: """ Build an instance of PortingAllPortInInstance @@ -80,7 +81,6 @@ def __repr__(self) -> str: class PortingAllPortInList(ListResource): - def __init__(self, version: Version): """ Initialize the PortingAllPortInList @@ -645,10 +645,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = PortingAllPortInPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/numbers/v1/porting_port_in.py b/twilio/rest/numbers/v1/porting_port_in.py index db9b35422..1f76b0e6b 100644 --- a/twilio/rest/numbers/v1/porting_port_in.py +++ b/twilio/rest/numbers/v1/porting_port_in.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import date, datetime from typing import Any, Dict, List, Optional from twilio.base import deserialize, values @@ -23,7 +24,6 @@ class PortingPortInInstance(InstanceResource): - class NumbersV1PortingAddress(object): """ :ivar street: The street address, ex: 101 Spear St @@ -35,7 +35,6 @@ class NumbersV1PortingAddress(object): """ def __init__(self, payload: Dict[str, Any]): - self.street: Optional[str] = payload.get("street") self.street_2: Optional[str] = payload.get("street_2") self.city: Optional[str] = payload.get("city") @@ -70,16 +69,15 @@ class NumbersV1PortingLosingCarrierInformation(object): """ def __init__(self, payload: Dict[str, Any]): - self.customer_name: Optional[str] = payload.get("customer_name") self.account_number: Optional[str] = payload.get("account_number") self.account_telephone_number: Optional[str] = payload.get( "account_telephone_number" ) self.address_sid: Optional[str] = payload.get("address_sid") - self.address: Optional[PortingPortInList.NumbersV1PortingAddress] = ( - payload.get("address") - ) + self.address: Optional[ + PortingPortInList.NumbersV1PortingAddress + ] = payload.get("address") self.authorized_representative: Optional[str] = payload.get( "authorized_representative" ) @@ -128,7 +126,6 @@ class NumbersV1PortingPortInCreate(object): """ def __init__(self, payload: Dict[str, Any]): - self.account_sid: Optional[str] = payload.get("account_sid") self.documents: Optional[List[str]] = payload.get("documents") self.phone_numbers: Optional[ @@ -161,16 +158,14 @@ def to_dict(self): return { "account_sid": self.account_sid, "documents": self.documents, - "phone_numbers": ( - [phone_numbers.to_dict() for phone_numbers in self.phone_numbers] - if self.phone_numbers is not None - else None - ), - "losing_carrier_information": ( - self.losing_carrier_information.to_dict() - if self.losing_carrier_information is not None - else None - ), + "phone_numbers": [ + phone_numbers.to_dict() for phone_numbers in self.phone_numbers + ] + if self.phone_numbers is not None + else None, + "losing_carrier_information": self.losing_carrier_information.to_dict() + if self.losing_carrier_information is not None + else None, "notification_emails": self.notification_emails, "target_port_in_date": self.target_port_in_date, "target_port_in_time_range_start": self.target_port_in_time_range_start, @@ -187,7 +182,6 @@ class NumbersV1PortingPortInCreatePhoneNumbers(object): """ def __init__(self, payload: Dict[str, Any]): - self.phone_number: Optional[str] = payload.get("phone_number") self.pin: Optional[str] = payload.get("pin") @@ -370,7 +364,6 @@ def __repr__(self) -> str: class PortingPortInContext(InstanceContext): - class NumbersV1PortingAddress(object): """ :ivar street: The street address, ex: 101 Spear St @@ -382,7 +375,6 @@ class NumbersV1PortingAddress(object): """ def __init__(self, payload: Dict[str, Any]): - self.street: Optional[str] = payload.get("street") self.street_2: Optional[str] = payload.get("street_2") self.city: Optional[str] = payload.get("city") @@ -417,16 +409,15 @@ class NumbersV1PortingLosingCarrierInformation(object): """ def __init__(self, payload: Dict[str, Any]): - self.customer_name: Optional[str] = payload.get("customer_name") self.account_number: Optional[str] = payload.get("account_number") self.account_telephone_number: Optional[str] = payload.get( "account_telephone_number" ) self.address_sid: Optional[str] = payload.get("address_sid") - self.address: Optional[PortingPortInList.NumbersV1PortingAddress] = ( - payload.get("address") - ) + self.address: Optional[ + PortingPortInList.NumbersV1PortingAddress + ] = payload.get("address") self.authorized_representative: Optional[str] = payload.get( "authorized_representative" ) @@ -475,7 +466,6 @@ class NumbersV1PortingPortInCreate(object): """ def __init__(self, payload: Dict[str, Any]): - self.account_sid: Optional[str] = payload.get("account_sid") self.documents: Optional[List[str]] = payload.get("documents") self.phone_numbers: Optional[ @@ -508,16 +498,14 @@ def to_dict(self): return { "account_sid": self.account_sid, "documents": self.documents, - "phone_numbers": ( - [phone_numbers.to_dict() for phone_numbers in self.phone_numbers] - if self.phone_numbers is not None - else None - ), - "losing_carrier_information": ( - self.losing_carrier_information.to_dict() - if self.losing_carrier_information is not None - else None - ), + "phone_numbers": [ + phone_numbers.to_dict() for phone_numbers in self.phone_numbers + ] + if self.phone_numbers is not None + else None, + "losing_carrier_information": self.losing_carrier_information.to_dict() + if self.losing_carrier_information is not None + else None, "notification_emails": self.notification_emails, "target_port_in_date": self.target_port_in_date, "target_port_in_time_range_start": self.target_port_in_time_range_start, @@ -534,7 +522,6 @@ class NumbersV1PortingPortInCreatePhoneNumbers(object): """ def __init__(self, payload: Dict[str, Any]): - self.phone_number: Optional[str] = payload.get("phone_number") self.pin: Optional[str] = payload.get("pin") @@ -728,7 +715,6 @@ def __repr__(self) -> str: class PortingPortInList(ListResource): - class NumbersV1PortingAddress(object): """ :ivar street: The street address, ex: 101 Spear St @@ -740,7 +726,6 @@ class NumbersV1PortingAddress(object): """ def __init__(self, payload: Dict[str, Any]): - self.street: Optional[str] = payload.get("street") self.street_2: Optional[str] = payload.get("street_2") self.city: Optional[str] = payload.get("city") @@ -775,16 +760,15 @@ class NumbersV1PortingLosingCarrierInformation(object): """ def __init__(self, payload: Dict[str, Any]): - self.customer_name: Optional[str] = payload.get("customer_name") self.account_number: Optional[str] = payload.get("account_number") self.account_telephone_number: Optional[str] = payload.get( "account_telephone_number" ) self.address_sid: Optional[str] = payload.get("address_sid") - self.address: Optional[PortingPortInList.NumbersV1PortingAddress] = ( - payload.get("address") - ) + self.address: Optional[ + PortingPortInList.NumbersV1PortingAddress + ] = payload.get("address") self.authorized_representative: Optional[str] = payload.get( "authorized_representative" ) @@ -833,7 +817,6 @@ class NumbersV1PortingPortInCreate(object): """ def __init__(self, payload: Dict[str, Any]): - self.account_sid: Optional[str] = payload.get("account_sid") self.documents: Optional[List[str]] = payload.get("documents") self.phone_numbers: Optional[ @@ -866,16 +849,14 @@ def to_dict(self): return { "account_sid": self.account_sid, "documents": self.documents, - "phone_numbers": ( - [phone_numbers.to_dict() for phone_numbers in self.phone_numbers] - if self.phone_numbers is not None - else None - ), - "losing_carrier_information": ( - self.losing_carrier_information.to_dict() - if self.losing_carrier_information is not None - else None - ), + "phone_numbers": [ + phone_numbers.to_dict() for phone_numbers in self.phone_numbers + ] + if self.phone_numbers is not None + else None, + "losing_carrier_information": self.losing_carrier_information.to_dict() + if self.losing_carrier_information is not None + else None, "notification_emails": self.notification_emails, "target_port_in_date": self.target_port_in_date, "target_port_in_time_range_start": self.target_port_in_time_range_start, @@ -892,7 +873,6 @@ class NumbersV1PortingPortInCreatePhoneNumbers(object): """ def __init__(self, payload: Dict[str, Any]): - self.phone_number: Optional[str] = payload.get("phone_number") self.pin: Optional[str] = payload.get("pin") diff --git a/twilio/rest/numbers/v1/porting_port_in_phone_number.py b/twilio/rest/numbers/v1/porting_port_in_phone_number.py index 0dc9a031f..36701c34f 100644 --- a/twilio/rest/numbers/v1/porting_port_in_phone_number.py +++ b/twilio/rest/numbers/v1/porting_port_in_phone_number.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional from twilio.base import deserialize, values @@ -23,6 +24,7 @@ class PortingPortInPhoneNumberInstance(InstanceResource): + """ :ivar port_in_request_sid: The unique identifier for the port in request that this phone number is associated with. :ivar phone_number_sid: The unique identifier for this phone number associated with this port in request. @@ -195,7 +197,6 @@ def __repr__(self) -> str: class PortingPortInPhoneNumberContext(InstanceContext): - def __init__( self, version: Version, port_in_request_sid: str, phone_number_sid: str ): @@ -390,7 +391,6 @@ def __repr__(self) -> str: class PortingPortInPhoneNumberList(ListResource): - def __init__(self, version: Version): """ Initialize the PortingPortInPhoneNumberList diff --git a/twilio/rest/numbers/v1/porting_portability.py b/twilio/rest/numbers/v1/porting_portability.py index bccbda78b..5ee33d0af 100644 --- a/twilio/rest/numbers/v1/porting_portability.py +++ b/twilio/rest/numbers/v1/porting_portability.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import deserialize, values from twilio.base.api_response import ApiResponse @@ -22,7 +23,6 @@ class PortingPortabilityInstance(InstanceResource): - class NumberType(object): LOCAL = "LOCAL" UNKNOWN = "UNKNOWN" @@ -59,9 +59,9 @@ def __init__( self.not_portable_reason_code: Optional[int] = deserialize.integer( payload.get("not_portable_reason_code") ) - self.number_type: Optional["PortingPortabilityInstance.NumberType"] = ( - payload.get("number_type") - ) + self.number_type: Optional[ + "PortingPortabilityInstance.NumberType" + ] = payload.get("number_type") self.country: Optional[str] = payload.get("country") self.url: Optional[str] = payload.get("url") @@ -168,7 +168,6 @@ def __repr__(self) -> str: class PortingPortabilityContext(InstanceContext): - def __init__(self, version: Version, phone_number: str): """ Initialize the PortingPortabilityContext @@ -341,7 +340,6 @@ def __repr__(self) -> str: class PortingPortabilityList(ListResource): - def __init__(self, version: Version): """ Initialize the PortingPortabilityList diff --git a/twilio/rest/numbers/v1/porting_webhook_configuration.py b/twilio/rest/numbers/v1/porting_webhook_configuration.py index 4769c6ae7..9c8ff3358 100644 --- a/twilio/rest/numbers/v1/porting_webhook_configuration.py +++ b/twilio/rest/numbers/v1/porting_webhook_configuration.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class PortingWebhookConfigurationInstance(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 @@ -48,7 +50,6 @@ def __repr__(self) -> str: class PortingWebhookConfigurationList(ListResource): - def __init__(self, version: Version): """ Initialize the PortingWebhookConfigurationList diff --git a/twilio/rest/numbers/v1/porting_webhook_configuration_delete.py b/twilio/rest/numbers/v1/porting_webhook_configuration_delete.py index e724498b0..48daa1ebc 100644 --- a/twilio/rest/numbers/v1/porting_webhook_configuration_delete.py +++ b/twilio/rest/numbers/v1/porting_webhook_configuration_delete.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from twilio.base import values from twilio.base.api_response import ApiResponse from twilio.base.instance_context import InstanceContext @@ -21,7 +22,6 @@ class PortingWebhookConfigurationDeleteContext(InstanceContext): - def __init__( self, version: Version, @@ -124,7 +124,6 @@ def __repr__(self) -> str: class PortingWebhookConfigurationDeleteList(ListResource): - def __init__(self, version: Version): """ Initialize the PortingWebhookConfigurationDeleteList diff --git a/twilio/rest/numbers/v1/signing_request_configuration.py b/twilio/rest/numbers/v1/signing_request_configuration.py index 2fb863025..c62af8680 100644 --- a/twilio/rest/numbers/v1/signing_request_configuration.py +++ b/twilio/rest/numbers/v1/signing_request_configuration.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class SigningRequestConfigurationInstance(InstanceResource): + """ :ivar logo_sid: The SID of the document that includes the logo that will appear in the LOA. To upload documents follow the following guide: https://www.twilio.com/docs/phone-numbers/regulatory/getting-started/create-new-bundle-public-rest-apis#supporting-document-create :ivar friendly_name: This is the string that you assigned as a friendly name for describing the creation of the configuration. @@ -57,7 +59,6 @@ def __repr__(self) -> str: class SigningRequestConfigurationPage(Page): - def get_instance( self, payload: Dict[str, Any] ) -> SigningRequestConfigurationInstance: @@ -78,7 +79,6 @@ def __repr__(self) -> str: class SigningRequestConfigurationList(ListResource): - def __init__(self, version: Version): """ Initialize the SigningRequestConfigurationList @@ -583,10 +583,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SigningRequestConfigurationPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/numbers/v1/webhook.py b/twilio/rest/numbers/v1/webhook.py index c5c9783f7..50acb5c1c 100644 --- a/twilio/rest/numbers/v1/webhook.py +++ b/twilio/rest/numbers/v1/webhook.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, List, Optional from twilio.base import deserialize, values @@ -23,6 +24,7 @@ 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 @@ -39,12 +41,12 @@ def __init__(self, version: Version, payload: Dict[str, Any]): self.port_in_target_url: Optional[str] = payload.get("port_in_target_url") self.port_out_target_url: Optional[str] = payload.get("port_out_target_url") self.notifications_of: Optional[List[str]] = payload.get("notifications_of") - self.port_in_target_date_created: Optional[datetime] = ( - deserialize.iso8601_datetime(payload.get("port_in_target_date_created")) - ) - self.port_out_target_date_created: Optional[datetime] = ( - deserialize.iso8601_datetime(payload.get("port_out_target_date_created")) - ) + self.port_in_target_date_created: Optional[ + datetime + ] = deserialize.iso8601_datetime(payload.get("port_in_target_date_created")) + self.port_out_target_date_created: Optional[ + datetime + ] = deserialize.iso8601_datetime(payload.get("port_out_target_date_created")) def __repr__(self) -> str: """ @@ -57,7 +59,6 @@ def __repr__(self) -> str: class WebhookList(ListResource): - def __init__(self, version: Version): """ Initialize the WebhookList diff --git a/twilio/rest/numbers/v2/__init__.py b/twilio/rest/numbers/v2/__init__.py index e4f306025..9bd20c42b 100644 --- a/twilio/rest/numbers/v2/__init__.py +++ b/twilio/rest/numbers/v2/__init__.py @@ -24,7 +24,6 @@ class V2(Version): - def __init__(self, domain: Domain): """ Initialize the V2 version of Numbers diff --git a/twilio/rest/numbers/v2/application.py b/twilio/rest/numbers/v2/application.py index af1ec1714..b318b2b50 100644 --- a/twilio/rest/numbers/v2/application.py +++ b/twilio/rest/numbers/v2/application.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,7 +24,6 @@ class ApplicationInstance(InstanceResource): - class CreateShortCodeApplicationRequest(object): """ :ivar friendly_name: The friendly name for the short code application. @@ -33,7 +33,6 @@ class CreateShortCodeApplicationRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.friendly_name: Optional[str] = payload.get("friendly_name") self.iso_country: Optional[str] = payload.get("iso_country") self.business_information: Optional[ @@ -47,11 +46,9 @@ def to_dict(self): return { "friendly_name": self.friendly_name, "iso_country": self.iso_country, - "business_information": ( - self.business_information.to_dict() - if self.business_information is not None - else None - ), + "business_information": self.business_information.to_dict() + if self.business_information is not None + else None, "setup": self.setup.to_dict() if self.setup is not None else None, } @@ -61,7 +58,6 @@ class CreateShortCodeApplicationRequestBusinessInformation(object): """ def __init__(self, payload: Dict[str, Any]): - self.customer_facing_profile: Optional[str] = payload.get( "customer_facing_profile" ) @@ -77,7 +73,6 @@ class CreateShortCodeApplicationRequestSetup(object): """ def __init__(self, payload: Dict[str, Any]): - self.charges_apply: Optional[bool] = payload.get("charges_apply") def to_dict(self): @@ -175,7 +170,6 @@ def __repr__(self) -> str: class ApplicationContext(InstanceContext): - class CreateShortCodeApplicationRequest(object): """ :ivar friendly_name: The friendly name for the short code application. @@ -185,7 +179,6 @@ class CreateShortCodeApplicationRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.friendly_name: Optional[str] = payload.get("friendly_name") self.iso_country: Optional[str] = payload.get("iso_country") self.business_information: Optional[ @@ -199,11 +192,9 @@ def to_dict(self): return { "friendly_name": self.friendly_name, "iso_country": self.iso_country, - "business_information": ( - self.business_information.to_dict() - if self.business_information is not None - else None - ), + "business_information": self.business_information.to_dict() + if self.business_information is not None + else None, "setup": self.setup.to_dict() if self.setup is not None else None, } @@ -213,7 +204,6 @@ class CreateShortCodeApplicationRequestBusinessInformation(object): """ def __init__(self, payload: Dict[str, Any]): - self.customer_facing_profile: Optional[str] = payload.get( "customer_facing_profile" ) @@ -229,7 +219,6 @@ class CreateShortCodeApplicationRequestSetup(object): """ def __init__(self, payload: Dict[str, Any]): - self.charges_apply: Optional[bool] = payload.get("charges_apply") def to_dict(self): @@ -353,7 +342,6 @@ def __repr__(self) -> str: class ApplicationPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ApplicationInstance: """ Build an instance of ApplicationInstance @@ -372,7 +360,6 @@ def __repr__(self) -> str: class ApplicationList(ListResource): - class CreateShortCodeApplicationRequest(object): """ :ivar friendly_name: The friendly name for the short code application. @@ -382,7 +369,6 @@ class CreateShortCodeApplicationRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.friendly_name: Optional[str] = payload.get("friendly_name") self.iso_country: Optional[str] = payload.get("iso_country") self.business_information: Optional[ @@ -396,11 +382,9 @@ def to_dict(self): return { "friendly_name": self.friendly_name, "iso_country": self.iso_country, - "business_information": ( - self.business_information.to_dict() - if self.business_information is not None - else None - ), + "business_information": self.business_information.to_dict() + if self.business_information is not None + else None, "setup": self.setup.to_dict() if self.setup is not None else None, } @@ -410,7 +394,6 @@ class CreateShortCodeApplicationRequestBusinessInformation(object): """ def __init__(self, payload: Dict[str, Any]): - self.customer_facing_profile: Optional[str] = payload.get( "customer_facing_profile" ) @@ -426,7 +409,6 @@ class CreateShortCodeApplicationRequestSetup(object): """ def __init__(self, payload: Dict[str, Any]): - self.charges_apply: Optional[bool] = payload.get("charges_apply") def to_dict(self): @@ -880,10 +862,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ApplicationPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/numbers/v2/authorization_document/__init__.py b/twilio/rest/numbers/v2/authorization_document/__init__.py index a60d8606d..357450cf9 100644 --- a/twilio/rest/numbers/v2/authorization_document/__init__.py +++ b/twilio/rest/numbers/v2/authorization_document/__init__.py @@ -12,6 +12,7 @@ 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 @@ -27,7 +28,6 @@ class AuthorizationDocumentInstance(InstanceResource): - class Status(object): OPENED = "opened" SIGNING = "signing" @@ -178,7 +178,6 @@ def __repr__(self) -> str: class AuthorizationDocumentContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the AuthorizationDocumentContext @@ -381,7 +380,6 @@ def __repr__(self) -> str: class AuthorizationDocumentPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> AuthorizationDocumentInstance: """ Build an instance of AuthorizationDocumentInstance @@ -400,7 +398,6 @@ def __repr__(self) -> str: class AuthorizationDocumentList(ListResource): - def __init__(self, version: Version): """ Initialize the AuthorizationDocumentList @@ -1013,10 +1010,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AuthorizationDocumentPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/numbers/v2/authorization_document/dependent_hosted_number_order.py b/twilio/rest/numbers/v2/authorization_document/dependent_hosted_number_order.py index 0ce86860f..5d2b4df38 100644 --- a/twilio/rest/numbers/v2/authorization_document/dependent_hosted_number_order.py +++ b/twilio/rest/numbers/v2/authorization_document/dependent_hosted_number_order.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class DependentHostedNumberOrderInstance(InstanceResource): - class Status(object): RECEIVED = "received" VERIFIED = "verified" @@ -74,9 +74,9 @@ def __init__( self.phone_number: Optional[str] = payload.get("phone_number") self.capabilities: Optional[str] = payload.get("capabilities") self.friendly_name: Optional[str] = payload.get("friendly_name") - self.status: Optional["DependentHostedNumberOrderInstance.Status"] = ( - payload.get("status") - ) + self.status: Optional[ + "DependentHostedNumberOrderInstance.Status" + ] = payload.get("status") self.failure_reason: Optional[str] = payload.get("failure_reason") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") @@ -106,7 +106,6 @@ def __repr__(self) -> str: class DependentHostedNumberOrderPage(Page): - def get_instance( self, payload: Dict[str, Any] ) -> DependentHostedNumberOrderInstance: @@ -131,7 +130,6 @@ def __repr__(self) -> str: class DependentHostedNumberOrderList(ListResource): - def __init__(self, version: Version, signing_document_sid: str): """ Initialize the DependentHostedNumberOrderList @@ -655,10 +653,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = DependentHostedNumberOrderPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/numbers/v2/bulk_hosted_number_order.py b/twilio/rest/numbers/v2/bulk_hosted_number_order.py index 7b874ac24..9beb6c538 100644 --- a/twilio/rest/numbers/v2/bulk_hosted_number_order.py +++ b/twilio/rest/numbers/v2/bulk_hosted_number_order.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, List, Optional, Union from twilio.base import deserialize, values @@ -23,7 +24,6 @@ class BulkHostedNumberOrderInstance(InstanceResource): - class RequestStatus(object): QUEUED = "QUEUED" IN_PROGRESS = "IN_PROGRESS" @@ -50,9 +50,9 @@ def __init__( super().__init__(version) self.bulk_hosting_sid: Optional[str] = payload.get("bulk_hosting_sid") - self.request_status: Optional["BulkHostedNumberOrderInstance.RequestStatus"] = ( - payload.get("request_status") - ) + self.request_status: Optional[ + "BulkHostedNumberOrderInstance.RequestStatus" + ] = payload.get("request_status") self.friendly_name: Optional[str] = payload.get("friendly_name") self.notification_email: Optional[str] = payload.get("notification_email") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( @@ -154,7 +154,6 @@ def __repr__(self) -> str: class BulkHostedNumberOrderContext(InstanceContext): - def __init__(self, version: Version, bulk_hosting_sid: str): """ Initialize the BulkHostedNumberOrderContext @@ -301,7 +300,6 @@ def __repr__(self) -> str: class BulkHostedNumberOrderList(ListResource): - def __init__(self, version: Version): """ Initialize the BulkHostedNumberOrderList diff --git a/twilio/rest/numbers/v2/bundle_clone.py b/twilio/rest/numbers/v2/bundle_clone.py index ab0d91228..bb4962b62 100644 --- a/twilio/rest/numbers/v2/bundle_clone.py +++ b/twilio/rest/numbers/v2/bundle_clone.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, serialize, values @@ -23,7 +24,6 @@ class BundleCloneInstance(InstanceResource): - class Status(object): DRAFT = "draft" PENDING_REVIEW = "pending-review" @@ -187,7 +187,6 @@ def __repr__(self) -> str: class BundleCloneContext(InstanceContext): - def __init__(self, version: Version, bundle_sid: str): """ Initialize the BundleCloneContext @@ -374,7 +373,6 @@ def __repr__(self) -> str: class BundleCloneList(ListResource): - def __init__(self, version: Version): """ Initialize the BundleCloneList diff --git a/twilio/rest/numbers/v2/hosted_number_order.py b/twilio/rest/numbers/v2/hosted_number_order.py index 6d93cb03b..4deb969c3 100644 --- a/twilio/rest/numbers/v2/hosted_number_order.py +++ b/twilio/rest/numbers/v2/hosted_number_order.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class HostedNumberOrderInstance(InstanceResource): - class Status(object): TWILIO_PROCESSING = "twilio-processing" RECEIVED = "received" @@ -306,7 +306,6 @@ def __repr__(self) -> str: class HostedNumberOrderContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the HostedNumberOrderContext @@ -649,7 +648,6 @@ def __repr__(self) -> str: class HostedNumberOrderPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> HostedNumberOrderInstance: """ Build an instance of HostedNumberOrderInstance @@ -668,7 +666,6 @@ def __repr__(self) -> str: class HostedNumberOrderList(ListResource): - def __init__(self, version: Version): """ Initialize the HostedNumberOrderList @@ -1555,10 +1552,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = HostedNumberOrderPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/numbers/v2/regulatory_compliance/__init__.py b/twilio/rest/numbers/v2/regulatory_compliance/__init__.py index 189117d85..9afca8a97 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/__init__.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/__init__.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Optional @@ -31,7 +32,6 @@ class RegulatoryComplianceList(ListResource): - def __init__(self, version: Version): """ Initialize the RegulatoryComplianceList diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py index d0eee38df..902c90571 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py @@ -12,6 +12,7 @@ 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 @@ -36,7 +37,6 @@ class BundleInstance(InstanceResource): - class EndUserType(object): INDIVIDUAL = "individual" BUSINESS = "business" @@ -323,7 +323,6 @@ def __repr__(self) -> str: class BundleContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the BundleContext @@ -727,7 +726,6 @@ def __repr__(self) -> str: class BundlePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> BundleInstance: """ Build an instance of BundleInstance @@ -746,7 +744,6 @@ def __repr__(self) -> str: class BundleList(ListResource): - def __init__(self, version: Version): """ Initialize the BundleList @@ -1793,10 +1790,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = BundlePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.py index 672d83312..7b30bc641 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class BundleCopyInstance(InstanceResource): - class Status(object): DRAFT = "draft" PENDING_REVIEW = "pending-review" @@ -81,7 +81,6 @@ def __repr__(self) -> str: class BundleCopyPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> BundleCopyInstance: """ Build an instance of BundleCopyInstance @@ -102,7 +101,6 @@ def __repr__(self) -> str: class BundleCopyList(ListResource): - def __init__(self, version: Version, bundle_sid: str): """ Initialize the BundleCopyList @@ -564,10 +562,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = BundleCopyPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py index 40c63a31c..7bb1384a0 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class EvaluationInstance(InstanceResource): - class Status(object): COMPLIANT = "compliant" NONCOMPLIANT = "noncompliant" @@ -129,7 +129,6 @@ def __repr__(self) -> str: class EvaluationContext(InstanceContext): - def __init__(self, version: Version, bundle_sid: str, sid: str): """ Initialize the EvaluationContext @@ -256,7 +255,6 @@ def __repr__(self) -> str: class EvaluationPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> EvaluationInstance: """ Build an instance of EvaluationInstance @@ -277,7 +275,6 @@ def __repr__(self) -> str: class EvaluationList(ListResource): - def __init__(self, version: Version, bundle_sid: str): """ Initialize the EvaluationList @@ -709,10 +706,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = EvaluationPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.py index d25c8c8ff..214063de5 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class ItemAssignmentInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Item Assignment resource. :ivar bundle_sid: The unique string that we created to identify the Bundle resource. @@ -156,7 +158,6 @@ def __repr__(self) -> str: class ItemAssignmentContext(InstanceContext): - def __init__(self, version: Version, bundle_sid: str, sid: str): """ Initialize the ItemAssignmentContext @@ -351,7 +352,6 @@ def __repr__(self) -> str: class ItemAssignmentPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ItemAssignmentInstance: """ Build an instance of ItemAssignmentInstance @@ -372,7 +372,6 @@ def __repr__(self) -> str: class ItemAssignmentList(ListResource): - def __init__(self, version: Version, bundle_sid: str): """ Initialize the ItemAssignmentList @@ -822,10 +821,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ItemAssignmentPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/replace_items.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/replace_items.py index cb9c9a46d..beab02364 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/replace_items.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/replace_items.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional from twilio.base import deserialize, values @@ -23,7 +24,6 @@ class ReplaceItemsInstance(InstanceResource): - class Status(object): DRAFT = "draft" PENDING_REVIEW = "pending-review" @@ -80,7 +80,6 @@ def __repr__(self) -> str: class ReplaceItemsList(ListResource): - def __init__(self, version: Version, bundle_sid: str): """ Initialize the ReplaceItemsList diff --git a/twilio/rest/numbers/v2/regulatory_compliance/end_user.py b/twilio/rest/numbers/v2/regulatory_compliance/end_user.py index 1652fe59e..5ab1ada8a 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/end_user.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/end_user.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class EndUserInstance(InstanceResource): - class Type(object): INDIVIDUAL = "individual" BUSINESS = "business" @@ -233,7 +233,6 @@ def __repr__(self) -> str: class EndUserContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the EndUserContext @@ -546,7 +545,6 @@ def __repr__(self) -> str: class EndUserPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> EndUserInstance: """ Build an instance of EndUserInstance @@ -565,7 +563,6 @@ def __repr__(self) -> str: class EndUserList(ListResource): - def __init__(self, version: Version): """ Initialize the EndUserList @@ -1050,10 +1047,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = EndUserPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/numbers/v2/regulatory_compliance/end_user_type.py b/twilio/rest/numbers/v2/regulatory_compliance/end_user_type.py index 75cc121f9..8fe9fe95c 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/end_user_type.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/end_user_type.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class EndUserTypeInstance(InstanceResource): + """ :ivar sid: The unique string that identifies the End-User Type resource. :ivar friendly_name: A human-readable description that is assigned to describe the End-User Type resource. Examples can include first name, last name, email, business name, etc @@ -109,7 +111,6 @@ def __repr__(self) -> str: class EndUserTypeContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the EndUserTypeContext @@ -226,7 +227,6 @@ def __repr__(self) -> str: class EndUserTypePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> EndUserTypeInstance: """ Build an instance of EndUserTypeInstance @@ -245,7 +245,6 @@ def __repr__(self) -> str: class EndUserTypeList(ListResource): - def __init__(self, version: Version): """ Initialize the EndUserTypeList @@ -588,10 +587,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = EndUserTypePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/numbers/v2/regulatory_compliance/regulation.py b/twilio/rest/numbers/v2/regulatory_compliance/regulation.py index ee17aacb5..4e580e970 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/regulation.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/regulation.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -23,7 +24,6 @@ class RegulationInstance(InstanceResource): - class EndUserType(object): INDIVIDUAL = "individual" BUSINESS = "business" @@ -140,7 +140,6 @@ def __repr__(self) -> str: class RegulationContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the RegulationContext @@ -287,7 +286,6 @@ def __repr__(self) -> str: class RegulationPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> RegulationInstance: """ Build an instance of RegulationInstance @@ -306,7 +304,6 @@ def __repr__(self) -> str: class RegulationList(ListResource): - def __init__(self, version: Version): """ Initialize the RegulationList @@ -799,10 +796,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = RegulationPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py index 684522d51..ac15c2a21 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class SupportingDocumentInstance(InstanceResource): - class Status(object): DRAFT = "draft" PENDING_REVIEW = "pending-review" @@ -247,7 +247,6 @@ def __repr__(self) -> str: class SupportingDocumentContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the SupportingDocumentContext @@ -570,7 +569,6 @@ def __repr__(self) -> str: class SupportingDocumentPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SupportingDocumentInstance: """ Build an instance of SupportingDocumentInstance @@ -589,7 +587,6 @@ def __repr__(self) -> str: class SupportingDocumentList(ListResource): - def __init__(self, version: Version): """ Initialize the SupportingDocumentList @@ -1074,10 +1071,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SupportingDocumentPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document_type.py b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document_type.py index fb1b49439..0e65d2ce8 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document_type.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document_type.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class SupportingDocumentTypeInstance(InstanceResource): + """ :ivar sid: The unique string that identifies the Supporting Document Type resource. :ivar friendly_name: A human-readable description of the Supporting Document Type resource. @@ -109,7 +111,6 @@ def __repr__(self) -> str: class SupportingDocumentTypeContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the SupportingDocumentTypeContext @@ -228,7 +229,6 @@ def __repr__(self) -> str: class SupportingDocumentTypePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SupportingDocumentTypeInstance: """ Build an instance of SupportingDocumentTypeInstance @@ -247,7 +247,6 @@ def __repr__(self) -> str: class SupportingDocumentTypeList(ListResource): - def __init__(self, version: Version): """ Initialize the SupportingDocumentTypeList @@ -590,10 +589,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SupportingDocumentTypePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/numbers/v3/__init__.py b/twilio/rest/numbers/v3/__init__.py index 9826e176f..fde332760 100644 --- a/twilio/rest/numbers/v3/__init__.py +++ b/twilio/rest/numbers/v3/__init__.py @@ -19,7 +19,6 @@ class V3(Version): - def __init__(self, domain: Domain): """ Initialize the V3 version of Numbers diff --git a/twilio/rest/numbers/v3/hosted_number_order.py b/twilio/rest/numbers/v3/hosted_number_order.py index 3c18a4433..70642a185 100644 --- a/twilio/rest/numbers/v3/hosted_number_order.py +++ b/twilio/rest/numbers/v3/hosted_number_order.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, List, Optional, Union from twilio.base import deserialize, serialize, values @@ -23,7 +24,6 @@ class HostedNumberOrderInstance(InstanceResource): - class Status(object): TWILIO_PROCESSING = "twilio-processing" RECEIVED = "received" @@ -120,7 +120,6 @@ def __repr__(self) -> str: class HostedNumberOrderList(ListResource): - def __init__(self, version: Version): """ Initialize the HostedNumberOrderList diff --git a/twilio/rest/oauth/OauthBase.py b/twilio/rest/oauth/OauthBase.py index b26f45996..3a57d00b8 100644 --- a/twilio/rest/oauth/OauthBase.py +++ b/twilio/rest/oauth/OauthBase.py @@ -18,7 +18,6 @@ class OauthBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Oauth Domain diff --git a/twilio/rest/oauth/__init__.py b/twilio/rest/oauth/__init__.py index 586cf6b4d..58c064927 100644 --- a/twilio/rest/oauth/__init__.py +++ b/twilio/rest/oauth/__init__.py @@ -5,7 +5,6 @@ class Oauth(OauthBase): - @property def token(self) -> TokenList: warn( diff --git a/twilio/rest/oauth/v1/__init__.py b/twilio/rest/oauth/v1/__init__.py index e05c7de52..dc7b652da 100644 --- a/twilio/rest/oauth/v1/__init__.py +++ b/twilio/rest/oauth/v1/__init__.py @@ -20,7 +20,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Oauth diff --git a/twilio/rest/oauth/v1/authorize.py b/twilio/rest/oauth/v1/authorize.py index 69ff398da..87a73b891 100644 --- a/twilio/rest/oauth/v1/authorize.py +++ b/twilio/rest/oauth/v1/authorize.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class AuthorizeInstance(InstanceResource): + """ :ivar redirect_to: The callback URL """ @@ -42,7 +44,6 @@ def __repr__(self) -> str: class AuthorizeList(ListResource): - def __init__(self, version: Version): """ Initialize the AuthorizeList diff --git a/twilio/rest/oauth/v1/token.py b/twilio/rest/oauth/v1/token.py index ebf53dc52..116838897 100644 --- a/twilio/rest/oauth/v1/token.py +++ b/twilio/rest/oauth/v1/token.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class TokenInstance(InstanceResource): + """ :ivar access_token: Token which carries the necessary information to access a Twilio resource directly. :ivar refresh_token: Token which carries the information necessary to get a new access token. @@ -50,7 +52,6 @@ def __repr__(self) -> str: class TokenList(ListResource): - def __init__(self, version: Version): """ Initialize the TokenList diff --git a/twilio/rest/oauth/v2/__init__.py b/twilio/rest/oauth/v2/__init__.py index c061f851c..c0e272350 100644 --- a/twilio/rest/oauth/v2/__init__.py +++ b/twilio/rest/oauth/v2/__init__.py @@ -20,7 +20,6 @@ class V2(Version): - def __init__(self, domain: Domain): """ Initialize the V2 version of Oauth diff --git a/twilio/rest/oauth/v2/authorize.py b/twilio/rest/oauth/v2/authorize.py index 53841e718..d41b87e30 100644 --- a/twilio/rest/oauth/v2/authorize.py +++ b/twilio/rest/oauth/v2/authorize.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class AuthorizeInstance(InstanceResource): + """ :ivar redirect_to: The callback URL """ @@ -42,7 +44,6 @@ def __repr__(self) -> str: class AuthorizeList(ListResource): - def __init__(self, version: Version): """ Initialize the AuthorizeList diff --git a/twilio/rest/oauth/v2/token.py b/twilio/rest/oauth/v2/token.py index 3550e4b50..24153ce2e 100644 --- a/twilio/rest/oauth/v2/token.py +++ b/twilio/rest/oauth/v2/token.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class TokenInstance(InstanceResource): + """ :ivar access_token: Token which carries the necessary information to access a Twilio resource directly. :ivar refresh_token: Token which carries the information necessary to get a new access token. @@ -50,7 +52,6 @@ def __repr__(self) -> str: class TokenList(ListResource): - def __init__(self, version: Version): """ Initialize the TokenList diff --git a/twilio/rest/preview/PreviewBase.py b/twilio/rest/preview/PreviewBase.py index dd8317b4c..d95647985 100644 --- a/twilio/rest/preview/PreviewBase.py +++ b/twilio/rest/preview/PreviewBase.py @@ -19,7 +19,6 @@ class PreviewBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Preview Domain diff --git a/twilio/rest/preview/__init__.py b/twilio/rest/preview/__init__.py index c4658c62e..46e4ab243 100644 --- a/twilio/rest/preview/__init__.py +++ b/twilio/rest/preview/__init__.py @@ -13,7 +13,6 @@ class Preview(PreviewBase): - @property def authorization_documents(self) -> AuthorizationDocumentList: warn( diff --git a/twilio/rest/preview/hosted_numbers/__init__.py b/twilio/rest/preview/hosted_numbers/__init__.py index 7b3a767ee..fd4616042 100644 --- a/twilio/rest/preview/hosted_numbers/__init__.py +++ b/twilio/rest/preview/hosted_numbers/__init__.py @@ -22,7 +22,6 @@ class HostedNumbers(Version): - def __init__(self, domain: Domain): """ Initialize the HostedNumbers version of Preview diff --git a/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py b/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py index b8ef5fc85..7b2091a94 100644 --- a/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py +++ b/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py @@ -27,7 +27,6 @@ class AuthorizationDocumentInstance(InstanceResource): - class Status(object): OPENED = "opened" SIGNING = "signing" @@ -276,7 +275,6 @@ def __repr__(self) -> str: class AuthorizationDocumentContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the AuthorizationDocumentContext @@ -637,7 +635,6 @@ def __repr__(self) -> str: class AuthorizationDocumentPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> AuthorizationDocumentInstance: """ Build an instance of AuthorizationDocumentInstance @@ -656,7 +653,6 @@ def __repr__(self) -> str: class AuthorizationDocumentList(ListResource): - def __init__(self, version: Version): """ Initialize the AuthorizationDocumentList @@ -1269,10 +1265,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AuthorizationDocumentPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.py b/twilio/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.py index 77da60fea..85eddf698 100644 --- a/twilio/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.py +++ b/twilio/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.py @@ -24,7 +24,6 @@ class DependentHostedNumberOrderInstance(InstanceResource): - class Status(object): TWILIO_PROCESSING = "twilio-processing" RECEIVED = "received" @@ -82,9 +81,9 @@ def __init__( self.capabilities: Optional[str] = payload.get("capabilities") self.friendly_name: Optional[str] = payload.get("friendly_name") self.unique_name: Optional[str] = payload.get("unique_name") - self.status: Optional["DependentHostedNumberOrderInstance.Status"] = ( - payload.get("status") - ) + self.status: Optional[ + "DependentHostedNumberOrderInstance.Status" + ] = payload.get("status") self.failure_reason: Optional[str] = payload.get("failure_reason") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") @@ -127,7 +126,6 @@ def __repr__(self) -> str: class DependentHostedNumberOrderPage(Page): - def get_instance( self, payload: Dict[str, Any] ) -> DependentHostedNumberOrderInstance: @@ -152,7 +150,6 @@ def __repr__(self) -> str: class DependentHostedNumberOrderList(ListResource): - def __init__(self, version: Version, signing_document_sid: str): """ Initialize the DependentHostedNumberOrderList @@ -712,10 +709,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = DependentHostedNumberOrderPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/preview/hosted_numbers/hosted_number_order.py b/twilio/rest/preview/hosted_numbers/hosted_number_order.py index f3a23ad49..e0f59a566 100644 --- a/twilio/rest/preview/hosted_numbers/hosted_number_order.py +++ b/twilio/rest/preview/hosted_numbers/hosted_number_order.py @@ -24,7 +24,6 @@ class HostedNumberOrderInstance(InstanceResource): - class Status(object): TWILIO_PROCESSING = "twilio-processing" RECEIVED = "received" @@ -393,7 +392,6 @@ def __repr__(self) -> str: class HostedNumberOrderContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the HostedNumberOrderContext @@ -862,7 +860,6 @@ def __repr__(self) -> str: class HostedNumberOrderPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> HostedNumberOrderInstance: """ Build an instance of HostedNumberOrderInstance @@ -881,7 +878,6 @@ def __repr__(self) -> str: class HostedNumberOrderList(ListResource): - def __init__(self, version: Version): """ Initialize the HostedNumberOrderList @@ -1796,10 +1792,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = HostedNumberOrderPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/preview/marketplace/__init__.py b/twilio/rest/preview/marketplace/__init__.py index fcc99a411..d12d3ab0a 100644 --- a/twilio/rest/preview/marketplace/__init__.py +++ b/twilio/rest/preview/marketplace/__init__.py @@ -20,7 +20,6 @@ class Marketplace(Version): - def __init__(self, domain: Domain): """ Initialize the Marketplace version of Preview diff --git a/twilio/rest/preview/marketplace/available_add_on/__init__.py b/twilio/rest/preview/marketplace/available_add_on/__init__.py index 4af003883..529e89069 100644 --- a/twilio/rest/preview/marketplace/available_add_on/__init__.py +++ b/twilio/rest/preview/marketplace/available_add_on/__init__.py @@ -125,7 +125,6 @@ def __repr__(self) -> str: class AvailableAddOnContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the AvailableAddOnContext @@ -256,7 +255,6 @@ def __repr__(self) -> str: class AvailableAddOnPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> AvailableAddOnInstance: """ Build an instance of AvailableAddOnInstance @@ -275,7 +273,6 @@ def __repr__(self) -> str: class AvailableAddOnList(ListResource): - def __init__(self, version: Version): """ Initialize the AvailableAddOnList @@ -618,10 +615,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AvailableAddOnPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/preview/marketplace/available_add_on/available_add_on_extension.py b/twilio/rest/preview/marketplace/available_add_on/available_add_on_extension.py index c62963997..f8876184d 100644 --- a/twilio/rest/preview/marketplace/available_add_on/available_add_on_extension.py +++ b/twilio/rest/preview/marketplace/available_add_on/available_add_on_extension.py @@ -119,7 +119,6 @@ def __repr__(self) -> str: class AvailableAddOnExtensionContext(InstanceContext): - def __init__(self, version: Version, available_add_on_sid: str, sid: str): """ Initialize the AvailableAddOnExtensionContext @@ -246,7 +245,6 @@ def __repr__(self) -> str: class AvailableAddOnExtensionPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> AvailableAddOnExtensionInstance: """ Build an instance of AvailableAddOnExtensionInstance @@ -269,7 +267,6 @@ def __repr__(self) -> str: class AvailableAddOnExtensionList(ListResource): - def __init__(self, version: Version, available_add_on_sid: str): """ Initialize the AvailableAddOnExtensionList @@ -619,10 +616,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AvailableAddOnExtensionPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/preview/marketplace/installed_add_on/__init__.py b/twilio/rest/preview/marketplace/installed_add_on/__init__.py index d1649e28c..71ebbdefd 100644 --- a/twilio/rest/preview/marketplace/installed_add_on/__init__.py +++ b/twilio/rest/preview/marketplace/installed_add_on/__init__.py @@ -242,7 +242,6 @@ def __repr__(self) -> str: class InstalledAddOnContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the InstalledAddOnContext @@ -575,7 +574,6 @@ def __repr__(self) -> str: class InstalledAddOnPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> InstalledAddOnInstance: """ Build an instance of InstalledAddOnInstance @@ -594,7 +592,6 @@ def __repr__(self) -> str: class InstalledAddOnList(ListResource): - def __init__(self, version: Version): """ Initialize the InstalledAddOnList @@ -1107,10 +1104,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = InstalledAddOnPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/preview/marketplace/installed_add_on/installed_add_on_extension.py b/twilio/rest/preview/marketplace/installed_add_on/installed_add_on_extension.py index 192949789..acf9cb2dd 100644 --- a/twilio/rest/preview/marketplace/installed_add_on/installed_add_on_extension.py +++ b/twilio/rest/preview/marketplace/installed_add_on/installed_add_on_extension.py @@ -169,7 +169,6 @@ def __repr__(self) -> str: class InstalledAddOnExtensionContext(InstanceContext): - def __init__(self, version: Version, installed_add_on_sid: str, sid: str): """ Initialize the InstalledAddOnExtensionContext @@ -408,7 +407,6 @@ def __repr__(self) -> str: class InstalledAddOnExtensionPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> InstalledAddOnExtensionInstance: """ Build an instance of InstalledAddOnExtensionInstance @@ -431,7 +429,6 @@ def __repr__(self) -> str: class InstalledAddOnExtensionList(ListResource): - def __init__(self, version: Version, installed_add_on_sid: str): """ Initialize the InstalledAddOnExtensionList @@ -781,10 +778,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = InstalledAddOnExtensionPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/preview/wireless/__init__.py b/twilio/rest/preview/wireless/__init__.py index 85ed4fb54..24f2ea0f0 100644 --- a/twilio/rest/preview/wireless/__init__.py +++ b/twilio/rest/preview/wireless/__init__.py @@ -21,7 +21,6 @@ class Wireless(Version): - def __init__(self, domain: Domain): """ Initialize the Wireless version of Preview diff --git a/twilio/rest/preview/wireless/command.py b/twilio/rest/preview/wireless/command.py index 6a30d4188..c822ad193 100644 --- a/twilio/rest/preview/wireless/command.py +++ b/twilio/rest/preview/wireless/command.py @@ -126,7 +126,6 @@ def __repr__(self) -> str: class CommandContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the CommandContext @@ -243,7 +242,6 @@ def __repr__(self) -> str: class CommandPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> CommandInstance: """ Build an instance of CommandInstance @@ -262,7 +260,6 @@ def __repr__(self) -> str: class CommandList(ListResource): - def __init__(self, version: Version): """ Initialize the CommandList @@ -969,10 +966,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CommandPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/preview/wireless/rate_plan.py b/twilio/rest/preview/wireless/rate_plan.py index 7d45be251..8b6615595 100644 --- a/twilio/rest/preview/wireless/rate_plan.py +++ b/twilio/rest/preview/wireless/rate_plan.py @@ -244,7 +244,6 @@ def __repr__(self) -> str: class RatePlanContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the RatePlanContext @@ -559,7 +558,6 @@ def __repr__(self) -> str: class RatePlanPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> RatePlanInstance: """ Build an instance of RatePlanInstance @@ -578,7 +576,6 @@ def __repr__(self) -> str: class RatePlanList(ListResource): - def __init__(self, version: Version): """ Initialize the RatePlanList @@ -1191,10 +1188,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = RatePlanPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/preview/wireless/sim/__init__.py b/twilio/rest/preview/wireless/sim/__init__.py index a91dcac0c..d9836391a 100644 --- a/twilio/rest/preview/wireless/sim/__init__.py +++ b/twilio/rest/preview/wireless/sim/__init__.py @@ -398,7 +398,6 @@ def __repr__(self) -> str: class SimContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the SimContext @@ -887,7 +886,6 @@ def __repr__(self) -> str: class SimPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SimInstance: """ Build an instance of SimInstance @@ -906,7 +904,6 @@ def __repr__(self) -> str: class SimList(ListResource): - def __init__(self, version: Version): """ Initialize the SimList @@ -1435,10 +1432,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SimPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/preview/wireless/sim/usage.py b/twilio/rest/preview/wireless/sim/usage.py index 60168e0ab..5478d25ef 100644 --- a/twilio/rest/preview/wireless/sim/usage.py +++ b/twilio/rest/preview/wireless/sim/usage.py @@ -150,7 +150,6 @@ def __repr__(self) -> str: class UsageContext(InstanceContext): - def __init__(self, version: Version, sim_sid: str): """ Initialize the UsageContext @@ -313,7 +312,6 @@ def __repr__(self) -> str: class UsageList(ListResource): - def __init__(self, version: Version, sim_sid: str): """ Initialize the UsageList diff --git a/twilio/rest/preview_iam/PreviewIamBase.py b/twilio/rest/preview_iam/PreviewIamBase.py index 22fcbe70b..e0ae83933 100644 --- a/twilio/rest/preview_iam/PreviewIamBase.py +++ b/twilio/rest/preview_iam/PreviewIamBase.py @@ -17,7 +17,6 @@ class PreviewIamBase(Domain): - def __init__(self, twilio: Client): """ Initialize the PreviewIam Domain diff --git a/twilio/rest/preview_iam/v1/__init__.py b/twilio/rest/preview_iam/v1/__init__.py index 224327779..7167617fc 100644 --- a/twilio/rest/preview_iam/v1/__init__.py +++ b/twilio/rest/preview_iam/v1/__init__.py @@ -20,7 +20,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of PreviewIam diff --git a/twilio/rest/preview_iam/v1/authorize.py b/twilio/rest/preview_iam/v1/authorize.py index e011a3d2a..5afad449a 100644 --- a/twilio/rest/preview_iam/v1/authorize.py +++ b/twilio/rest/preview_iam/v1/authorize.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class AuthorizeInstance(InstanceResource): + """ :ivar redirect_to: The callback URL """ @@ -42,7 +44,6 @@ def __repr__(self) -> str: class AuthorizeList(ListResource): - def __init__(self, version: Version): """ Initialize the AuthorizeList diff --git a/twilio/rest/preview_iam/v1/token.py b/twilio/rest/preview_iam/v1/token.py index 9a496553a..fe61662a0 100644 --- a/twilio/rest/preview_iam/v1/token.py +++ b/twilio/rest/preview_iam/v1/token.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class TokenInstance(InstanceResource): + """ :ivar access_token: Token which carries the necessary information to access a Twilio resource directly. :ivar refresh_token: Token which carries the information necessary to get a new access token. @@ -50,7 +52,6 @@ def __repr__(self) -> str: class TokenList(ListResource): - def __init__(self, version: Version): """ Initialize the TokenList diff --git a/twilio/rest/preview_iam/versionless/__init__.py b/twilio/rest/preview_iam/versionless/__init__.py index 7d6d210f1..e0f7644ac 100644 --- a/twilio/rest/preview_iam/versionless/__init__.py +++ b/twilio/rest/preview_iam/versionless/__init__.py @@ -19,7 +19,6 @@ class Versionless(Version): - def __init__(self, domain: Domain): """ Initialize the Versionless version of PreviewIam diff --git a/twilio/rest/preview_iam/versionless/organization/__init__.py b/twilio/rest/preview_iam/versionless/organization/__init__.py index ce6e70e97..ed4d5df42 100644 --- a/twilio/rest/preview_iam/versionless/organization/__init__.py +++ b/twilio/rest/preview_iam/versionless/organization/__init__.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Optional from twilio.base.instance_context import InstanceContext @@ -26,7 +27,6 @@ class OrganizationContext(InstanceContext): - def __init__(self, version: Version, organization_sid: str): """ Initialize the OrganizationContext @@ -93,7 +93,6 @@ def __repr__(self) -> str: class OrganizationList(ListResource): - def __init__(self, version: Version): """ Initialize the OrganizationList diff --git a/twilio/rest/preview_iam/versionless/organization/account.py b/twilio/rest/preview_iam/versionless/organization/account.py index 089780846..b9e73196b 100644 --- a/twilio/rest/preview_iam/versionless/organization/account.py +++ b/twilio/rest/preview_iam/versionless/organization/account.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class AccountInstance(InstanceResource): + """ :ivar account_sid: Twilio account sid :ivar friendly_name: Account friendly name @@ -118,7 +120,6 @@ def __repr__(self) -> str: class AccountContext(InstanceContext): - def __init__(self, version: Version, organization_sid: str, account_sid: str): """ Initialize the AccountContext @@ -243,7 +244,6 @@ def __repr__(self) -> str: class AccountPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> AccountInstance: """ Build an instance of AccountInstance @@ -264,7 +264,6 @@ def __repr__(self) -> str: class AccountList(ListResource): - def __init__(self, version: Version, organization_sid: str): """ Initialize the AccountList @@ -612,10 +611,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AccountPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/preview_iam/versionless/organization/role_assignment.py b/twilio/rest/preview_iam/versionless/organization/role_assignment.py index 6f5c73040..08087772f 100644 --- a/twilio/rest/preview_iam/versionless/organization/role_assignment.py +++ b/twilio/rest/preview_iam/versionless/organization/role_assignment.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,7 +24,6 @@ class RoleAssignmentInstance(InstanceResource): - class PublicApiCreateRoleAssignmentRequest(object): """ :ivar role_sid: Twilio Role Sid representing assigned role @@ -32,7 +32,6 @@ class PublicApiCreateRoleAssignmentRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.role_sid: Optional[str] = payload.get("role_sid") self.scope: Optional[str] = payload.get("scope") self.identity: Optional[str] = payload.get("identity") @@ -144,7 +143,6 @@ def __repr__(self) -> str: class RoleAssignmentContext(InstanceContext): - class PublicApiCreateRoleAssignmentRequest(object): """ :ivar role_sid: Twilio Role Sid representing assigned role @@ -153,7 +151,6 @@ class PublicApiCreateRoleAssignmentRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.role_sid: Optional[str] = payload.get("role_sid") self.scope: Optional[str] = payload.get("scope") self.identity: Optional[str] = payload.get("identity") @@ -267,7 +264,6 @@ def __repr__(self) -> str: class RoleAssignmentPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> RoleAssignmentInstance: """ Build an instance of RoleAssignmentInstance @@ -288,7 +284,6 @@ def __repr__(self) -> str: class RoleAssignmentList(ListResource): - class PublicApiCreateRoleAssignmentRequest(object): """ :ivar role_sid: Twilio Role Sid representing assigned role @@ -297,7 +292,6 @@ class PublicApiCreateRoleAssignmentRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.role_sid: Optional[str] = payload.get("role_sid") self.scope: Optional[str] = payload.get("scope") self.identity: Optional[str] = payload.get("identity") @@ -842,10 +836,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = RoleAssignmentPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/preview_iam/versionless/organization/user.py b/twilio/rest/preview_iam/versionless/organization/user.py index 8047bddfa..dd3c6d921 100644 --- a/twilio/rest/preview_iam/versionless/organization/user.py +++ b/twilio/rest/preview_iam/versionless/organization/user.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values @@ -24,7 +25,6 @@ class UserInstance(InstanceResource): - class ScimEmailAddress(object): """ :ivar primary: Indicates if this email address is the primary one @@ -33,7 +33,6 @@ class ScimEmailAddress(object): """ def __init__(self, payload: Dict[str, Any]): - self.primary: Optional[bool] = payload.get("primary") self.value: Optional[str] = payload.get("value") self.type: Optional[str] = payload.get("type") @@ -54,7 +53,6 @@ class ScimMeta(object): """ def __init__(self, payload: Dict[str, Any]): - self.resource_type: Optional[str] = payload.get("resource_type") self.created: Optional[datetime] = payload.get("created") self.last_modified: Optional[datetime] = payload.get("last_modified") @@ -75,7 +73,6 @@ class ScimName(object): """ def __init__(self, payload: Dict[str, Any]): - self.given_name: Optional[str] = payload.get("given_name") self.family_name: Optional[str] = payload.get("family_name") @@ -106,7 +103,6 @@ class ScimUser(object): """ def __init__(self, payload: Dict[str, Any]): - self.id: Optional[str] = payload.get("id") self.external_id: Optional[str] = payload.get("external_id") self.user_name: Optional[str] = payload.get("user_name") @@ -133,11 +129,9 @@ def to_dict(self): "userName": self.user_name, "displayName": self.display_name, "name": self.name.to_dict() if self.name is not None else None, - "emails": ( - [emails.to_dict() for emails in self.emails] - if self.emails is not None - else None - ), + "emails": [emails.to_dict() for emails in self.emails] + if self.emails is not None + else None, "active": self.active, "locale": self.locale, "timezone": self.timezone, @@ -364,7 +358,6 @@ def __repr__(self) -> str: class UserContext(InstanceContext): - class ScimEmailAddress(object): """ :ivar primary: Indicates if this email address is the primary one @@ -373,7 +366,6 @@ class ScimEmailAddress(object): """ def __init__(self, payload: Dict[str, Any]): - self.primary: Optional[bool] = payload.get("primary") self.value: Optional[str] = payload.get("value") self.type: Optional[str] = payload.get("type") @@ -394,7 +386,6 @@ class ScimMeta(object): """ def __init__(self, payload: Dict[str, Any]): - self.resource_type: Optional[str] = payload.get("resource_type") self.created: Optional[datetime] = payload.get("created") self.last_modified: Optional[datetime] = payload.get("last_modified") @@ -415,7 +406,6 @@ class ScimName(object): """ def __init__(self, payload: Dict[str, Any]): - self.given_name: Optional[str] = payload.get("given_name") self.family_name: Optional[str] = payload.get("family_name") @@ -446,7 +436,6 @@ class ScimUser(object): """ def __init__(self, payload: Dict[str, Any]): - self.id: Optional[str] = payload.get("id") self.external_id: Optional[str] = payload.get("external_id") self.user_name: Optional[str] = payload.get("user_name") @@ -473,11 +462,9 @@ def to_dict(self): "userName": self.user_name, "displayName": self.display_name, "name": self.name.to_dict() if self.name is not None else None, - "emails": ( - [emails.to_dict() for emails in self.emails] - if self.emails is not None - else None - ), + "emails": [emails.to_dict() for emails in self.emails] + if self.emails is not None + else None, "active": self.active, "locale": self.locale, "timezone": self.timezone, @@ -822,7 +809,6 @@ def __repr__(self) -> str: class UserPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> UserInstance: """ Build an instance of UserInstance @@ -843,7 +829,6 @@ def __repr__(self) -> str: class UserList(ListResource): - class ScimEmailAddress(object): """ :ivar primary: Indicates if this email address is the primary one @@ -852,7 +837,6 @@ class ScimEmailAddress(object): """ def __init__(self, payload: Dict[str, Any]): - self.primary: Optional[bool] = payload.get("primary") self.value: Optional[str] = payload.get("value") self.type: Optional[str] = payload.get("type") @@ -873,7 +857,6 @@ class ScimMeta(object): """ def __init__(self, payload: Dict[str, Any]): - self.resource_type: Optional[str] = payload.get("resource_type") self.created: Optional[datetime] = payload.get("created") self.last_modified: Optional[datetime] = payload.get("last_modified") @@ -894,7 +877,6 @@ class ScimName(object): """ def __init__(self, payload: Dict[str, Any]): - self.given_name: Optional[str] = payload.get("given_name") self.family_name: Optional[str] = payload.get("family_name") @@ -925,7 +907,6 @@ class ScimUser(object): """ def __init__(self, payload: Dict[str, Any]): - self.id: Optional[str] = payload.get("id") self.external_id: Optional[str] = payload.get("external_id") self.user_name: Optional[str] = payload.get("user_name") @@ -952,11 +933,9 @@ def to_dict(self): "userName": self.user_name, "displayName": self.display_name, "name": self.name.to_dict() if self.name is not None else None, - "emails": ( - [emails.to_dict() for emails in self.emails] - if self.emails is not None - else None - ), + "emails": [emails.to_dict() for emails in self.emails] + if self.emails is not None + else None, "active": self.active, "locale": self.locale, "timezone": self.timezone, @@ -1446,10 +1425,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/scim+json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = UserPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/pricing/PricingBase.py b/twilio/rest/pricing/PricingBase.py index cf624e186..35028ee35 100644 --- a/twilio/rest/pricing/PricingBase.py +++ b/twilio/rest/pricing/PricingBase.py @@ -18,7 +18,6 @@ class PricingBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Pricing Domain diff --git a/twilio/rest/pricing/v1/__init__.py b/twilio/rest/pricing/v1/__init__.py index ba8b65885..2227d163d 100644 --- a/twilio/rest/pricing/v1/__init__.py +++ b/twilio/rest/pricing/v1/__init__.py @@ -21,7 +21,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Pricing diff --git a/twilio/rest/pricing/v1/messaging/__init__.py b/twilio/rest/pricing/v1/messaging/__init__.py index df5c148b8..32230c713 100644 --- a/twilio/rest/pricing/v1/messaging/__init__.py +++ b/twilio/rest/pricing/v1/messaging/__init__.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Optional @@ -22,7 +23,6 @@ class MessagingList(ListResource): - def __init__(self, version: Version): """ Initialize the MessagingList diff --git a/twilio/rest/pricing/v1/messaging/country.py b/twilio/rest/pricing/v1/messaging/country.py index 88142b055..7c7131f63 100644 --- a/twilio/rest/pricing/v1/messaging/country.py +++ b/twilio/rest/pricing/v1/messaging/country.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class CountryInstance(InstanceResource): + """ :ivar country: The name of the country. :ivar iso_country: The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). @@ -116,7 +118,6 @@ def __repr__(self) -> str: class CountryContext(InstanceContext): - def __init__(self, version: Version, iso_country: str): """ Initialize the CountryContext @@ -233,7 +234,6 @@ def __repr__(self) -> str: class CountryPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> CountryInstance: """ Build an instance of CountryInstance @@ -252,7 +252,6 @@ def __repr__(self) -> str: class CountryList(ListResource): - def __init__(self, version: Version): """ Initialize the CountryList @@ -595,10 +594,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CountryPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/pricing/v1/phone_number/__init__.py b/twilio/rest/pricing/v1/phone_number/__init__.py index 429ce9b14..b3cfbe50e 100644 --- a/twilio/rest/pricing/v1/phone_number/__init__.py +++ b/twilio/rest/pricing/v1/phone_number/__init__.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Optional @@ -22,7 +23,6 @@ class PhoneNumberList(ListResource): - def __init__(self, version: Version): """ Initialize the PhoneNumberList diff --git a/twilio/rest/pricing/v1/phone_number/country.py b/twilio/rest/pricing/v1/phone_number/country.py index 37565cbb5..44e112188 100644 --- a/twilio/rest/pricing/v1/phone_number/country.py +++ b/twilio/rest/pricing/v1/phone_number/country.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class CountryInstance(InstanceResource): + """ :ivar country: The name of the country. :ivar iso_country: The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). @@ -114,7 +116,6 @@ def __repr__(self) -> str: class CountryContext(InstanceContext): - def __init__(self, version: Version, iso_country: str): """ Initialize the CountryContext @@ -231,7 +232,6 @@ def __repr__(self) -> str: class CountryPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> CountryInstance: """ Build an instance of CountryInstance @@ -250,7 +250,6 @@ def __repr__(self) -> str: class CountryList(ListResource): - def __init__(self, version: Version): """ Initialize the CountryList @@ -593,10 +592,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CountryPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/pricing/v1/voice/__init__.py b/twilio/rest/pricing/v1/voice/__init__.py index a801a3008..4d91f382c 100644 --- a/twilio/rest/pricing/v1/voice/__init__.py +++ b/twilio/rest/pricing/v1/voice/__init__.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Optional @@ -23,7 +24,6 @@ class VoiceList(ListResource): - def __init__(self, version: Version): """ Initialize the VoiceList diff --git a/twilio/rest/pricing/v1/voice/country.py b/twilio/rest/pricing/v1/voice/country.py index 17046ee35..027d718f2 100644 --- a/twilio/rest/pricing/v1/voice/country.py +++ b/twilio/rest/pricing/v1/voice/country.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class CountryInstance(InstanceResource): + """ :ivar country: The name of the country. :ivar iso_country: The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). @@ -118,7 +120,6 @@ def __repr__(self) -> str: class CountryContext(InstanceContext): - def __init__(self, version: Version, iso_country: str): """ Initialize the CountryContext @@ -235,7 +236,6 @@ def __repr__(self) -> str: class CountryPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> CountryInstance: """ Build an instance of CountryInstance @@ -254,7 +254,6 @@ def __repr__(self) -> str: class CountryList(ListResource): - def __init__(self, version: Version): """ Initialize the CountryList @@ -597,10 +596,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CountryPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/pricing/v1/voice/number.py b/twilio/rest/pricing/v1/voice/number.py index c0a8cd026..c00e1e1a3 100644 --- a/twilio/rest/pricing/v1/voice/number.py +++ b/twilio/rest/pricing/v1/voice/number.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class NumberInstance(InstanceResource): + """ :ivar number: The phone number. :ivar country: The name of the country. @@ -112,7 +114,6 @@ def __repr__(self) -> str: class NumberContext(InstanceContext): - def __init__(self, version: Version, number: str): """ Initialize the NumberContext @@ -229,7 +230,6 @@ def __repr__(self) -> str: class NumberList(ListResource): - def __init__(self, version: Version): """ Initialize the NumberList diff --git a/twilio/rest/pricing/v2/__init__.py b/twilio/rest/pricing/v2/__init__.py index d0fd67f73..f034595cb 100644 --- a/twilio/rest/pricing/v2/__init__.py +++ b/twilio/rest/pricing/v2/__init__.py @@ -21,7 +21,6 @@ class V2(Version): - def __init__(self, domain: Domain): """ Initialize the V2 version of Pricing diff --git a/twilio/rest/pricing/v2/country.py b/twilio/rest/pricing/v2/country.py index d1261a20f..7513d2895 100644 --- a/twilio/rest/pricing/v2/country.py +++ b/twilio/rest/pricing/v2/country.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class CountryInstance(InstanceResource): + """ :ivar country: The name of the country. :ivar iso_country: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). @@ -118,7 +120,6 @@ def __repr__(self) -> str: class CountryContext(InstanceContext): - def __init__(self, version: Version, iso_country: str): """ Initialize the CountryContext @@ -235,7 +236,6 @@ def __repr__(self) -> str: class CountryPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> CountryInstance: """ Build an instance of CountryInstance @@ -254,7 +254,6 @@ def __repr__(self) -> str: class CountryList(ListResource): - def __init__(self, version: Version): """ Initialize the CountryList @@ -597,10 +596,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CountryPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/pricing/v2/number.py b/twilio/rest/pricing/v2/number.py index 9a96ed655..9e09593a2 100644 --- a/twilio/rest/pricing/v2/number.py +++ b/twilio/rest/pricing/v2/number.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class NumberInstance(InstanceResource): + """ :ivar destination_number: The destination phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. :ivar origination_number: The origination phone number in [[E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. @@ -141,7 +143,6 @@ def __repr__(self) -> str: class NumberContext(InstanceContext): - def __init__(self, version: Version, destination_number: str): """ Initialize the NumberContext @@ -288,7 +289,6 @@ def __repr__(self) -> str: class NumberList(ListResource): - def __init__(self, version: Version): """ Initialize the NumberList diff --git a/twilio/rest/pricing/v2/voice/__init__.py b/twilio/rest/pricing/v2/voice/__init__.py index 1ebbcbb64..653946963 100644 --- a/twilio/rest/pricing/v2/voice/__init__.py +++ b/twilio/rest/pricing/v2/voice/__init__.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Optional @@ -23,7 +24,6 @@ class VoiceList(ListResource): - def __init__(self, version: Version): """ Initialize the VoiceList diff --git a/twilio/rest/pricing/v2/voice/country.py b/twilio/rest/pricing/v2/voice/country.py index 3ef7784bd..3963503b7 100644 --- a/twilio/rest/pricing/v2/voice/country.py +++ b/twilio/rest/pricing/v2/voice/country.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class CountryInstance(InstanceResource): + """ :ivar country: The name of the country. :ivar iso_country: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). @@ -118,7 +120,6 @@ def __repr__(self) -> str: class CountryContext(InstanceContext): - def __init__(self, version: Version, iso_country: str): """ Initialize the CountryContext @@ -235,7 +236,6 @@ def __repr__(self) -> str: class CountryPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> CountryInstance: """ Build an instance of CountryInstance @@ -254,7 +254,6 @@ def __repr__(self) -> str: class CountryList(ListResource): - def __init__(self, version: Version): """ Initialize the CountryList @@ -597,10 +596,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CountryPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/pricing/v2/voice/number.py b/twilio/rest/pricing/v2/voice/number.py index 5154fc41a..becaa63ec 100644 --- a/twilio/rest/pricing/v2/voice/number.py +++ b/twilio/rest/pricing/v2/voice/number.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class NumberInstance(InstanceResource): + """ :ivar destination_number: The destination phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. :ivar origination_number: The origination phone number in [[E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. @@ -139,7 +141,6 @@ def __repr__(self) -> str: class NumberContext(InstanceContext): - def __init__(self, version: Version, destination_number: str): """ Initialize the NumberContext @@ -286,7 +287,6 @@ def __repr__(self) -> str: class NumberList(ListResource): - def __init__(self, version: Version): """ Initialize the NumberList diff --git a/twilio/rest/proxy/ProxyBase.py b/twilio/rest/proxy/ProxyBase.py index da1baec17..b4d4d0e84 100644 --- a/twilio/rest/proxy/ProxyBase.py +++ b/twilio/rest/proxy/ProxyBase.py @@ -17,7 +17,6 @@ class ProxyBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Proxy Domain diff --git a/twilio/rest/proxy/v1/__init__.py b/twilio/rest/proxy/v1/__init__.py index 83737dc0f..87a58d3ff 100644 --- a/twilio/rest/proxy/v1/__init__.py +++ b/twilio/rest/proxy/v1/__init__.py @@ -19,7 +19,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Proxy diff --git a/twilio/rest/proxy/v1/service/__init__.py b/twilio/rest/proxy/v1/service/__init__.py index 55233002f..5ab961c57 100644 --- a/twilio/rest/proxy/v1/service/__init__.py +++ b/twilio/rest/proxy/v1/service/__init__.py @@ -12,6 +12,7 @@ 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 @@ -26,7 +27,6 @@ class ServiceInstance(InstanceResource): - class GeoMatchLevel(object): AREA_CODE = "area-code" OVERLAY = "overlay" @@ -357,7 +357,6 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -811,7 +810,6 @@ def __repr__(self) -> str: class ServicePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -830,7 +828,6 @@ def __repr__(self) -> str: class ServiceList(ListResource): - def __init__(self, version: Version): """ Initialize the ServiceList @@ -1415,10 +1412,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ServicePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/proxy/v1/service/phone_number.py b/twilio/rest/proxy/v1/service/phone_number.py index 5c704ef83..8fb02daff 100644 --- a/twilio/rest/proxy/v1/service/phone_number.py +++ b/twilio/rest/proxy/v1/service/phone_number.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class PhoneNumberInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the PhoneNumber resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PhoneNumber resource. @@ -226,7 +228,6 @@ def __repr__(self) -> str: class PhoneNumberContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the PhoneNumberContext @@ -543,7 +544,6 @@ def __repr__(self) -> str: class PhoneNumberPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> PhoneNumberInstance: """ Build an instance of PhoneNumberInstance @@ -564,7 +564,6 @@ def __repr__(self) -> str: class PhoneNumberList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the PhoneNumberList @@ -1062,10 +1061,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = PhoneNumberPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/proxy/v1/service/session/__init__.py b/twilio/rest/proxy/v1/service/session/__init__.py index 393750da7..db9e6f4fb 100644 --- a/twilio/rest/proxy/v1/service/session/__init__.py +++ b/twilio/rest/proxy/v1/service/session/__init__.py @@ -12,6 +12,7 @@ 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 @@ -26,7 +27,6 @@ class SessionInstance(InstanceResource): - class Mode(object): MESSAGE_ONLY = "message-only" VOICE_ONLY = "voice-only" @@ -299,7 +299,6 @@ def __repr__(self) -> str: class SessionContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the SessionContext @@ -679,7 +678,6 @@ def __repr__(self) -> str: class SessionPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SessionInstance: """ Build an instance of SessionInstance @@ -700,7 +698,6 @@ def __repr__(self) -> str: class SessionList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the SessionList @@ -1258,10 +1255,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SessionPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/proxy/v1/service/session/interaction.py b/twilio/rest/proxy/v1/service/session/interaction.py index d0ec42331..4fb57d9a6 100644 --- a/twilio/rest/proxy/v1/service/session/interaction.py +++ b/twilio/rest/proxy/v1/service/session/interaction.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class InteractionInstance(InstanceResource): - class ResourceStatus(object): ACCEPTED = "accepted" ANSWERED = "answered" @@ -95,9 +95,9 @@ def __init__( "inbound_participant_sid" ) self.inbound_resource_sid: Optional[str] = payload.get("inbound_resource_sid") - self.inbound_resource_status: Optional["InteractionInstance.ResourceStatus"] = ( - payload.get("inbound_resource_status") - ) + self.inbound_resource_status: Optional[ + "InteractionInstance.ResourceStatus" + ] = payload.get("inbound_resource_status") self.inbound_resource_type: Optional[str] = payload.get("inbound_resource_type") self.inbound_resource_url: Optional[str] = payload.get("inbound_resource_url") self.outbound_participant_sid: Optional[str] = payload.get( @@ -226,7 +226,6 @@ def __repr__(self) -> str: class InteractionContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, session_sid: str, sid: str): """ Initialize the InteractionContext @@ -427,7 +426,6 @@ def __repr__(self) -> str: class InteractionPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> InteractionInstance: """ Build an instance of InteractionInstance @@ -451,7 +449,6 @@ def __repr__(self) -> str: class InteractionList(ListResource): - def __init__(self, version: Version, service_sid: str, session_sid: str): """ Initialize the InteractionList @@ -805,10 +802,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = InteractionPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/proxy/v1/service/session/participant/__init__.py b/twilio/rest/proxy/v1/service/session/participant/__init__.py index fa84f90e3..69e15a697 100644 --- a/twilio/rest/proxy/v1/service/session/participant/__init__.py +++ b/twilio/rest/proxy/v1/service/session/participant/__init__.py @@ -12,6 +12,7 @@ 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 @@ -27,6 +28,7 @@ class ParticipantInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Participant resource. :ivar session_sid: The SID of the parent [Session](https://www.twilio.com/docs/proxy/api/session) resource. @@ -187,7 +189,6 @@ def __repr__(self) -> str: class ParticipantContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, session_sid: str, sid: str): """ Initialize the ParticipantContext @@ -404,7 +405,6 @@ def __repr__(self) -> str: class ParticipantPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ParticipantInstance: """ Build an instance of ParticipantInstance @@ -428,7 +428,6 @@ def __repr__(self) -> str: class ParticipantList(ListResource): - def __init__(self, version: Version, service_sid: str, session_sid: str): """ Initialize the ParticipantList @@ -968,10 +967,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ParticipantPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/proxy/v1/service/session/participant/message_interaction.py b/twilio/rest/proxy/v1/service/session/participant/message_interaction.py index b17a75c57..eb13341ca 100644 --- a/twilio/rest/proxy/v1/service/session/participant/message_interaction.py +++ b/twilio/rest/proxy/v1/service/session/participant/message_interaction.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class MessageInteractionInstance(InstanceResource): - class ResourceStatus(object): ACCEPTED = "accepted" ANSWERED = "answered" @@ -195,7 +195,6 @@ def __repr__(self) -> str: class MessageInteractionContext(InstanceContext): - def __init__( self, version: Version, @@ -339,7 +338,6 @@ def __repr__(self) -> str: class MessageInteractionPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> MessageInteractionInstance: """ Build an instance of MessageInteractionInstance @@ -364,7 +362,6 @@ def __repr__(self) -> str: class MessageInteractionList(ListResource): - def __init__( self, version: Version, service_sid: str, session_sid: str, participant_sid: str ): @@ -868,10 +865,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = MessageInteractionPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/routes/RoutesBase.py b/twilio/rest/routes/RoutesBase.py index a47d67f09..86a85dd3d 100644 --- a/twilio/rest/routes/RoutesBase.py +++ b/twilio/rest/routes/RoutesBase.py @@ -17,7 +17,6 @@ class RoutesBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Routes Domain diff --git a/twilio/rest/routes/v2/__init__.py b/twilio/rest/routes/v2/__init__.py index 56a140efc..b3852c1a6 100644 --- a/twilio/rest/routes/v2/__init__.py +++ b/twilio/rest/routes/v2/__init__.py @@ -21,7 +21,6 @@ class V2(Version): - def __init__(self, domain: Domain): """ Initialize the V2 version of Routes diff --git a/twilio/rest/routes/v2/phone_number.py b/twilio/rest/routes/v2/phone_number.py index 6de8c5f34..1dfb17cdf 100644 --- a/twilio/rest/routes/v2/phone_number.py +++ b/twilio/rest/routes/v2/phone_number.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, values @@ -23,6 +24,7 @@ class PhoneNumberInstance(InstanceResource): + """ :ivar phone_number: The phone number in E.164 format :ivar url: The absolute URL of the resource. @@ -194,7 +196,6 @@ def __repr__(self) -> str: class PhoneNumberContext(InstanceContext): - def __init__(self, version: Version, phone_number: str): """ Initialize the PhoneNumberContext @@ -449,7 +450,6 @@ def __repr__(self) -> str: class PhoneNumberList(ListResource): - def __init__(self, version: Version): """ Initialize the PhoneNumberList diff --git a/twilio/rest/routes/v2/sip_domain.py b/twilio/rest/routes/v2/sip_domain.py index 7bf95d40d..e54fe6a2b 100644 --- a/twilio/rest/routes/v2/sip_domain.py +++ b/twilio/rest/routes/v2/sip_domain.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, values @@ -23,6 +24,7 @@ class SipDomainInstance(InstanceResource): + """ :ivar sip_domain: :ivar url: @@ -194,7 +196,6 @@ def __repr__(self) -> str: class SipDomainContext(InstanceContext): - def __init__(self, version: Version, sip_domain: str): """ Initialize the SipDomainContext @@ -449,7 +450,6 @@ def __repr__(self) -> str: class SipDomainList(ListResource): - def __init__(self, version: Version): """ Initialize the SipDomainList diff --git a/twilio/rest/routes/v2/trunk.py b/twilio/rest/routes/v2/trunk.py index 931ad728a..0a2fa65d8 100644 --- a/twilio/rest/routes/v2/trunk.py +++ b/twilio/rest/routes/v2/trunk.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, values @@ -23,6 +24,7 @@ class TrunkInstance(InstanceResource): + """ :ivar sip_trunk_domain: The absolute URL of the SIP Trunk :ivar url: The absolute URL of the resource. @@ -194,7 +196,6 @@ def __repr__(self) -> str: class TrunkContext(InstanceContext): - def __init__(self, version: Version, sip_trunk_domain: str): """ Initialize the TrunkContext @@ -449,7 +450,6 @@ def __repr__(self) -> str: class TrunkList(ListResource): - def __init__(self, version: Version): """ Initialize the TrunkList diff --git a/twilio/rest/serverless/ServerlessBase.py b/twilio/rest/serverless/ServerlessBase.py index d6e227c0b..803c63dec 100644 --- a/twilio/rest/serverless/ServerlessBase.py +++ b/twilio/rest/serverless/ServerlessBase.py @@ -17,7 +17,6 @@ class ServerlessBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Serverless Domain diff --git a/twilio/rest/serverless/v1/__init__.py b/twilio/rest/serverless/v1/__init__.py index e494615ca..ea6b4e9db 100644 --- a/twilio/rest/serverless/v1/__init__.py +++ b/twilio/rest/serverless/v1/__init__.py @@ -19,7 +19,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Serverless diff --git a/twilio/rest/serverless/v1/service/__init__.py b/twilio/rest/serverless/v1/service/__init__.py index e439c00e4..58c5adafd 100644 --- a/twilio/rest/serverless/v1/service/__init__.py +++ b/twilio/rest/serverless/v1/service/__init__.py @@ -12,6 +12,7 @@ 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 @@ -28,6 +29,7 @@ class ServiceInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Service resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. @@ -278,7 +280,6 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -666,7 +667,6 @@ def __repr__(self) -> str: class ServicePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -685,7 +685,6 @@ def __repr__(self) -> str: class ServiceList(ListResource): - def __init__(self, version: Version): """ Initialize the ServiceList @@ -1194,10 +1193,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ServicePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/serverless/v1/service/asset/__init__.py b/twilio/rest/serverless/v1/service/asset/__init__.py index 4e5512736..a2adf7ae6 100644 --- a/twilio/rest/serverless/v1/service/asset/__init__.py +++ b/twilio/rest/serverless/v1/service/asset/__init__.py @@ -12,6 +12,7 @@ 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 @@ -25,6 +26,7 @@ class AssetInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Asset resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Asset resource. @@ -218,7 +220,6 @@ def __repr__(self) -> str: class AssetContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the AssetContext @@ -538,7 +539,6 @@ def __repr__(self) -> str: class AssetPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> AssetInstance: """ Build an instance of AssetInstance @@ -559,7 +559,6 @@ def __repr__(self) -> str: class AssetList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the AssetList @@ -1009,10 +1008,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AssetPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/serverless/v1/service/asset/asset_version.py b/twilio/rest/serverless/v1/service/asset/asset_version.py index d57b5bfb2..aafe908eb 100644 --- a/twilio/rest/serverless/v1/service/asset/asset_version.py +++ b/twilio/rest/serverless/v1/service/asset/asset_version.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class AssetVersionInstance(InstanceResource): - class Visibility(object): PUBLIC = "public" PRIVATE = "private" @@ -135,7 +135,6 @@ def __repr__(self) -> str: class AssetVersionContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, asset_sid: str, sid: str): """ Initialize the AssetVersionContext @@ -266,7 +265,6 @@ def __repr__(self) -> str: class AssetVersionPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> AssetVersionInstance: """ Build an instance of AssetVersionInstance @@ -290,7 +288,6 @@ def __repr__(self) -> str: class AssetVersionList(ListResource): - def __init__(self, version: Version, service_sid: str, asset_sid: str): """ Initialize the AssetVersionList @@ -642,10 +639,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = AssetVersionPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/serverless/v1/service/environment/__init__.py b/twilio/rest/serverless/v1/service/environment/__init__.py index c85c4b9c3..93a3677f9 100644 --- a/twilio/rest/serverless/v1/service/environment/__init__.py +++ b/twilio/rest/serverless/v1/service/environment/__init__.py @@ -12,6 +12,7 @@ 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 @@ -27,6 +28,7 @@ class EnvironmentInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Environment resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Environment resource. @@ -192,7 +194,6 @@ def __repr__(self) -> str: class EnvironmentContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the EnvironmentContext @@ -428,7 +429,6 @@ def __repr__(self) -> str: class EnvironmentPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> EnvironmentInstance: """ Build an instance of EnvironmentInstance @@ -449,7 +449,6 @@ def __repr__(self) -> str: class EnvironmentList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the EnvironmentList @@ -923,10 +922,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = EnvironmentPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/serverless/v1/service/environment/deployment.py b/twilio/rest/serverless/v1/service/environment/deployment.py index 73fb22c3b..6e3f43a67 100644 --- a/twilio/rest/serverless/v1/service/environment/deployment.py +++ b/twilio/rest/serverless/v1/service/environment/deployment.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class DeploymentInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Deployment resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Deployment resource. @@ -129,7 +131,6 @@ def __repr__(self) -> str: class DeploymentContext(InstanceContext): - def __init__( self, version: Version, service_sid: str, environment_sid: str, sid: str ): @@ -262,7 +263,6 @@ def __repr__(self) -> str: class DeploymentPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> DeploymentInstance: """ Build an instance of DeploymentInstance @@ -286,7 +286,6 @@ def __repr__(self) -> str: class DeploymentList(ListResource): - def __init__(self, version: Version, service_sid: str, environment_sid: str): """ Initialize the DeploymentList @@ -788,10 +787,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = DeploymentPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/serverless/v1/service/environment/log.py b/twilio/rest/serverless/v1/service/environment/log.py index a4d65131b..42251e8b3 100644 --- a/twilio/rest/serverless/v1/service/environment/log.py +++ b/twilio/rest/serverless/v1/service/environment/log.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class LogInstance(InstanceResource): + """ :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. @@ -135,7 +137,6 @@ def __repr__(self) -> str: class LogContext(InstanceContext): - def __init__( self, version: Version, service_sid: str, environment_sid: str, sid: str ): @@ -270,7 +271,6 @@ def __repr__(self) -> str: class LogPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> LogInstance: """ Build an instance of LogInstance @@ -294,7 +294,6 @@ def __repr__(self) -> str: class LogList(ListResource): - def __init__(self, version: Version, service_sid: str, environment_sid: str): """ Initialize the LogList @@ -762,10 +761,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = LogPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/serverless/v1/service/environment/variable.py b/twilio/rest/serverless/v1/service/environment/variable.py index 0c26f0137..df1917313 100644 --- a/twilio/rest/serverless/v1/service/environment/variable.py +++ b/twilio/rest/serverless/v1/service/environment/variable.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class VariableInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Variable resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Variable resource. @@ -239,7 +241,6 @@ def __repr__(self) -> str: class VariableContext(InstanceContext): - def __init__( self, version: Version, service_sid: str, environment_sid: str, sid: str ): @@ -586,7 +587,6 @@ def __repr__(self) -> str: class VariablePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> VariableInstance: """ Build an instance of VariableInstance @@ -610,7 +610,6 @@ def __repr__(self) -> str: class VariableList(ListResource): - def __init__(self, version: Version, service_sid: str, environment_sid: str): """ Initialize the VariableList @@ -1082,10 +1081,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = VariablePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/serverless/v1/service/function/__init__.py b/twilio/rest/serverless/v1/service/function/__init__.py index babeb6bbf..32ade0eef 100644 --- a/twilio/rest/serverless/v1/service/function/__init__.py +++ b/twilio/rest/serverless/v1/service/function/__init__.py @@ -12,6 +12,7 @@ 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 @@ -27,6 +28,7 @@ class FunctionInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Function resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Function resource. @@ -220,7 +222,6 @@ def __repr__(self) -> str: class FunctionContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the FunctionContext @@ -540,7 +541,6 @@ def __repr__(self) -> str: class FunctionPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> FunctionInstance: """ Build an instance of FunctionInstance @@ -561,7 +561,6 @@ def __repr__(self) -> str: class FunctionList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the FunctionList @@ -1011,10 +1010,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = FunctionPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/serverless/v1/service/function/function_version/__init__.py b/twilio/rest/serverless/v1/service/function/function_version/__init__.py index 6daaa65d8..9680be8d6 100644 --- a/twilio/rest/serverless/v1/service/function/function_version/__init__.py +++ b/twilio/rest/serverless/v1/service/function/function_version/__init__.py @@ -12,6 +12,7 @@ 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 @@ -27,7 +28,6 @@ class FunctionVersionInstance(InstanceResource): - class Visibility(object): PUBLIC = "public" PRIVATE = "private" @@ -147,7 +147,6 @@ def __repr__(self) -> str: class FunctionVersionContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, function_sid: str, sid: str): """ Initialize the FunctionVersionContext @@ -296,7 +295,6 @@ def __repr__(self) -> str: class FunctionVersionPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> FunctionVersionInstance: """ Build an instance of FunctionVersionInstance @@ -320,7 +318,6 @@ def __repr__(self) -> str: class FunctionVersionList(ListResource): - def __init__(self, version: Version, service_sid: str, function_sid: str): """ Initialize the FunctionVersionList @@ -672,10 +669,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = FunctionVersionPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/serverless/v1/service/function/function_version/function_version_content.py b/twilio/rest/serverless/v1/service/function/function_version/function_version_content.py index 3ca878ed8..1522dcfe9 100644 --- a/twilio/rest/serverless/v1/service/function/function_version/function_version_content.py +++ b/twilio/rest/serverless/v1/service/function/function_version/function_version_content.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class FunctionVersionContentInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Function Version resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Function Version resource. @@ -121,7 +123,6 @@ def __repr__(self) -> str: class FunctionVersionContentContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, function_sid: str, sid: str): """ Initialize the FunctionVersionContentContext @@ -252,7 +253,6 @@ def __repr__(self) -> str: class FunctionVersionContentList(ListResource): - def __init__(self, version: Version, service_sid: str, function_sid: str, sid: str): """ Initialize the FunctionVersionContentList diff --git a/twilio/rest/studio/StudioBase.py b/twilio/rest/studio/StudioBase.py index 3b218775c..e1b237422 100644 --- a/twilio/rest/studio/StudioBase.py +++ b/twilio/rest/studio/StudioBase.py @@ -18,7 +18,6 @@ class StudioBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Studio Domain diff --git a/twilio/rest/studio/v1/__init__.py b/twilio/rest/studio/v1/__init__.py index 8ab7d71b6..d5ca90bb6 100644 --- a/twilio/rest/studio/v1/__init__.py +++ b/twilio/rest/studio/v1/__init__.py @@ -19,7 +19,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Studio diff --git a/twilio/rest/studio/v1/flow/__init__.py b/twilio/rest/studio/v1/flow/__init__.py index 31187e93f..3279e0b6f 100644 --- a/twilio/rest/studio/v1/flow/__init__.py +++ b/twilio/rest/studio/v1/flow/__init__.py @@ -12,6 +12,7 @@ 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 @@ -26,7 +27,6 @@ class FlowInstance(InstanceResource): - class Status(object): DRAFT = "draft" PUBLISHED = "published" @@ -179,7 +179,6 @@ def __repr__(self) -> str: class FlowContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the FlowContext @@ -391,7 +390,6 @@ def __repr__(self) -> str: class FlowPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> FlowInstance: """ Build an instance of FlowInstance @@ -410,7 +408,6 @@ def __repr__(self) -> str: class FlowList(ListResource): - def __init__(self, version: Version): """ Initialize the FlowList @@ -753,10 +750,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = FlowPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/studio/v1/flow/engagement/__init__.py b/twilio/rest/studio/v1/flow/engagement/__init__.py index 916eb6336..1a0560d59 100644 --- a/twilio/rest/studio/v1/flow/engagement/__init__.py +++ b/twilio/rest/studio/v1/flow/engagement/__init__.py @@ -12,6 +12,7 @@ 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 @@ -28,7 +29,6 @@ class EngagementInstance(InstanceResource): - class Status(object): ACTIVE = "active" ENDED = "ended" @@ -193,7 +193,6 @@ def __repr__(self) -> str: class EngagementContext(InstanceContext): - def __init__(self, version: Version, flow_sid: str, sid: str): """ Initialize the EngagementContext @@ -413,7 +412,6 @@ def __repr__(self) -> str: class EngagementPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> EngagementInstance: """ Build an instance of EngagementInstance @@ -434,7 +432,6 @@ def __repr__(self) -> str: class EngagementList(ListResource): - def __init__(self, version: Version, flow_sid: str): """ Initialize the EngagementList @@ -912,10 +909,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = EngagementPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/studio/v1/flow/engagement/engagement_context.py b/twilio/rest/studio/v1/flow/engagement/engagement_context.py index bfb29afef..75ea7f261 100644 --- a/twilio/rest/studio/v1/flow/engagement/engagement_context.py +++ b/twilio/rest/studio/v1/flow/engagement/engagement_context.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class EngagementContextInstance(InstanceResource): + """ :ivar account_sid: The SID of the Account. :ivar context: As your flow executes, we save the state in what's called the Flow Context. Any data in the flow context can be accessed by your widgets as variables, either in configuration fields or in text areas as variable substitution. @@ -114,7 +116,6 @@ def __repr__(self) -> str: class EngagementContextContext(InstanceContext): - def __init__(self, version: Version, flow_sid: str, engagement_sid: str): """ Initialize the EngagementContextContext @@ -239,7 +240,6 @@ def __repr__(self) -> str: class EngagementContextList(ListResource): - def __init__(self, version: Version, flow_sid: str, engagement_sid: str): """ Initialize the EngagementContextList diff --git a/twilio/rest/studio/v1/flow/engagement/step/__init__.py b/twilio/rest/studio/v1/flow/engagement/step/__init__.py index a4b3c0ccb..2e0dad593 100644 --- a/twilio/rest/studio/v1/flow/engagement/step/__init__.py +++ b/twilio/rest/studio/v1/flow/engagement/step/__init__.py @@ -12,6 +12,7 @@ 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 @@ -25,6 +26,7 @@ class StepInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Step resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Step resource. @@ -149,7 +151,6 @@ def __repr__(self) -> str: class StepContext(InstanceContext): - def __init__(self, version: Version, flow_sid: str, engagement_sid: str, sid: str): """ Initialize the StepContext @@ -296,7 +297,6 @@ def __repr__(self) -> str: class StepPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> StepInstance: """ Build an instance of StepInstance @@ -320,7 +320,6 @@ def __repr__(self) -> str: class StepList(ListResource): - def __init__(self, version: Version, flow_sid: str, engagement_sid: str): """ Initialize the StepList @@ -672,10 +671,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = StepPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/studio/v1/flow/engagement/step/step_context.py b/twilio/rest/studio/v1/flow/engagement/step/step_context.py index 309bbf936..0592928a6 100644 --- a/twilio/rest/studio/v1/flow/engagement/step/step_context.py +++ b/twilio/rest/studio/v1/flow/engagement/step/step_context.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class StepContextInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the StepContext resource. :ivar context: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. @@ -119,7 +121,6 @@ def __repr__(self) -> str: class StepContextContext(InstanceContext): - def __init__( self, version: Version, flow_sid: str, engagement_sid: str, step_sid: str ): @@ -252,7 +253,6 @@ def __repr__(self) -> str: class StepContextList(ListResource): - def __init__( self, version: Version, flow_sid: str, engagement_sid: str, step_sid: str ): diff --git a/twilio/rest/studio/v1/flow/execution/__init__.py b/twilio/rest/studio/v1/flow/execution/__init__.py index dc9d81a4f..10cd2edaa 100644 --- a/twilio/rest/studio/v1/flow/execution/__init__.py +++ b/twilio/rest/studio/v1/flow/execution/__init__.py @@ -12,6 +12,7 @@ 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 @@ -26,7 +27,6 @@ class ExecutionInstance(InstanceResource): - class Status(object): ACTIVE = "active" ENDED = "ended" @@ -243,7 +243,6 @@ def __repr__(self) -> str: class ExecutionContext(InstanceContext): - def __init__(self, version: Version, flow_sid: str, sid: str): """ Initialize the ExecutionContext @@ -579,7 +578,6 @@ def __repr__(self) -> str: class ExecutionPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ExecutionInstance: """ Build an instance of ExecutionInstance @@ -600,7 +598,6 @@ def __repr__(self) -> str: class ExecutionList(ListResource): - def __init__(self, version: Version, flow_sid: str): """ Initialize the ExecutionList @@ -1156,10 +1153,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ExecutionPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/studio/v1/flow/execution/execution_context.py b/twilio/rest/studio/v1/flow/execution/execution_context.py index 126c6601b..ee445cf0c 100644 --- a/twilio/rest/studio/v1/flow/execution/execution_context.py +++ b/twilio/rest/studio/v1/flow/execution/execution_context.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class ExecutionContextInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionContext resource. :ivar context: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. @@ -114,7 +116,6 @@ def __repr__(self) -> str: class ExecutionContextContext(InstanceContext): - def __init__(self, version: Version, flow_sid: str, execution_sid: str): """ Initialize the ExecutionContextContext @@ -239,7 +240,6 @@ def __repr__(self) -> str: class ExecutionContextList(ListResource): - def __init__(self, version: Version, flow_sid: str, execution_sid: str): """ Initialize the ExecutionContextList diff --git a/twilio/rest/studio/v1/flow/execution/execution_step/__init__.py b/twilio/rest/studio/v1/flow/execution/execution_step/__init__.py index cfb2da654..14f523d26 100644 --- a/twilio/rest/studio/v1/flow/execution/execution_step/__init__.py +++ b/twilio/rest/studio/v1/flow/execution/execution_step/__init__.py @@ -12,6 +12,7 @@ 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 @@ -27,6 +28,7 @@ class ExecutionStepInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the ExecutionStep resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStep resource. @@ -151,7 +153,6 @@ def __repr__(self) -> str: class ExecutionStepContext(InstanceContext): - def __init__(self, version: Version, flow_sid: str, execution_sid: str, sid: str): """ Initialize the ExecutionStepContext @@ -298,7 +299,6 @@ def __repr__(self) -> str: class ExecutionStepPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ExecutionStepInstance: """ Build an instance of ExecutionStepInstance @@ -322,7 +322,6 @@ def __repr__(self) -> str: class ExecutionStepList(ListResource): - def __init__(self, version: Version, flow_sid: str, execution_sid: str): """ Initialize the ExecutionStepList @@ -674,10 +673,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ExecutionStepPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/studio/v1/flow/execution/execution_step/execution_step_context.py b/twilio/rest/studio/v1/flow/execution/execution_step/execution_step_context.py index f996e211b..1354c934d 100644 --- a/twilio/rest/studio/v1/flow/execution/execution_step/execution_step_context.py +++ b/twilio/rest/studio/v1/flow/execution/execution_step/execution_step_context.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class ExecutionStepContextInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStepContext resource. :ivar context: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. @@ -119,7 +121,6 @@ def __repr__(self) -> str: class ExecutionStepContextContext(InstanceContext): - def __init__( self, version: Version, flow_sid: str, execution_sid: str, step_sid: str ): @@ -252,7 +253,6 @@ def __repr__(self) -> str: class ExecutionStepContextList(ListResource): - def __init__( self, version: Version, flow_sid: str, execution_sid: str, step_sid: str ): diff --git a/twilio/rest/studio/v2/__init__.py b/twilio/rest/studio/v2/__init__.py index 83ccc8e0a..d2fd66fe9 100644 --- a/twilio/rest/studio/v2/__init__.py +++ b/twilio/rest/studio/v2/__init__.py @@ -15,12 +15,12 @@ from typing import Optional from twilio.base.version import Version from twilio.base.domain import Domain +from twilio.rest.studio.v2.application import ApplicationList from twilio.rest.studio.v2.flow import FlowList from twilio.rest.studio.v2.flow_validate import FlowValidateList class V2(Version): - def __init__(self, domain: Domain): """ Initialize the V2 version of Studio @@ -28,9 +28,16 @@ def __init__(self, domain: Domain): :param domain: The Twilio.studio domain """ super().__init__(domain, "v2") + self._application: Optional[ApplicationList] = None self._flows: Optional[FlowList] = None self._flow_validate: Optional[FlowValidateList] = None + @property + def application(self) -> ApplicationList: + if self._application is None: + self._application = ApplicationList(self) + return self._application + @property def flows(self) -> FlowList: if self._flows is None: diff --git a/twilio/rest/studio/v2/application.py b/twilio/rest/studio/v2/application.py new file mode 100644 index 000000000..1262778f4 --- /dev/null +++ b/twilio/rest/studio/v2/application.py @@ -0,0 +1,241 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Studio + 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.api_response import ApiResponse +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 ApplicationInstance(InstanceResource): + + """ + :ivar account_twiml_application: + :ivar is_created: + :ivar url: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.account_twiml_application: Optional[Dict[str, object]] = payload.get( + "account_twiml_application" + ) + self.is_created: Optional[bool] = payload.get("is_created") + self.url: Optional[str] = payload.get("url") + + self._context: Optional[ApplicationContext] = None + + @property + def _proxy(self) -> "ApplicationContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: ApplicationContext for this ApplicationInstance + """ + if self._context is None: + self._context = ApplicationContext( + self._version, + ) + return self._context + + def fetch(self) -> "ApplicationInstance": + """ + Fetch the ApplicationInstance + + + :returns: The fetched ApplicationInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "ApplicationInstance": + """ + Asynchronous coroutine to fetch the ApplicationInstance + + + :returns: The fetched ApplicationInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the ApplicationInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the ApplicationInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_async() + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class ApplicationContext(InstanceContext): + def __init__(self, version: Version): + """ + Initialize the ApplicationContext + + :param version: Version that contains the resource + """ + super().__init__(version) + + self._uri = "/Application" + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> ApplicationInstance: + """ + Fetch the ApplicationInstance + + + :returns: The fetched ApplicationInstance + """ + payload, _, _ = self._fetch() + return ApplicationInstance( + self._version, + payload, + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the ApplicationInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = ApplicationInstance( + self._version, + payload, + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> ApplicationInstance: + """ + Asynchronous coroutine to fetch the ApplicationInstance + + + :returns: The fetched ApplicationInstance + """ + payload, _, _ = await self._fetch_async() + return ApplicationInstance( + self._version, + payload, + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the ApplicationInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = ApplicationInstance( + self._version, + payload, + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class ApplicationList(ListResource): + def __init__(self, version: Version): + """ + Initialize the ApplicationList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self) -> ApplicationContext: + """ + Constructs a ApplicationContext + + """ + return ApplicationContext(self._version) + + def __call__(self) -> ApplicationContext: + """ + Constructs a ApplicationContext + + """ + return ApplicationContext(self._version) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/studio/v2/flow/__init__.py b/twilio/rest/studio/v2/flow/__init__.py index 25b26e5c3..1596cf63f 100644 --- a/twilio/rest/studio/v2/flow/__init__.py +++ b/twilio/rest/studio/v2/flow/__init__.py @@ -12,6 +12,7 @@ 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 @@ -27,7 +28,6 @@ class FlowInstance(InstanceResource): - class Status(object): DRAFT = "draft" PUBLISHED = "published" @@ -295,7 +295,6 @@ def __repr__(self) -> str: class FlowContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the FlowContext @@ -686,7 +685,6 @@ def __repr__(self) -> str: class FlowPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> FlowInstance: """ Build an instance of FlowInstance @@ -705,7 +703,6 @@ def __repr__(self) -> str: class FlowList(ListResource): - def __init__(self, version: Version): """ Initialize the FlowList @@ -1214,10 +1211,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = FlowPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/studio/v2/flow/execution/__init__.py b/twilio/rest/studio/v2/flow/execution/__init__.py index a0b984d9d..40a8ae74d 100644 --- a/twilio/rest/studio/v2/flow/execution/__init__.py +++ b/twilio/rest/studio/v2/flow/execution/__init__.py @@ -12,6 +12,7 @@ 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 @@ -26,7 +27,6 @@ class ExecutionInstance(InstanceResource): - class Status(object): ACTIVE = "active" ENDED = "ended" @@ -241,7 +241,6 @@ def __repr__(self) -> str: class ExecutionContext(InstanceContext): - def __init__(self, version: Version, flow_sid: str, sid: str): """ Initialize the ExecutionContext @@ -577,7 +576,6 @@ def __repr__(self) -> str: class ExecutionPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ExecutionInstance: """ Build an instance of ExecutionInstance @@ -598,7 +596,6 @@ def __repr__(self) -> str: class ExecutionList(ListResource): - def __init__(self, version: Version, flow_sid: str): """ Initialize the ExecutionList @@ -1154,10 +1151,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ExecutionPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/studio/v2/flow/execution/execution_context.py b/twilio/rest/studio/v2/flow/execution/execution_context.py index bc117671d..3d936599c 100644 --- a/twilio/rest/studio/v2/flow/execution/execution_context.py +++ b/twilio/rest/studio/v2/flow/execution/execution_context.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class ExecutionContextInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionContext resource. :ivar context: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. @@ -114,7 +116,6 @@ def __repr__(self) -> str: class ExecutionContextContext(InstanceContext): - def __init__(self, version: Version, flow_sid: str, execution_sid: str): """ Initialize the ExecutionContextContext @@ -239,7 +240,6 @@ def __repr__(self) -> str: class ExecutionContextList(ListResource): - def __init__(self, version: Version, flow_sid: str, execution_sid: str): """ Initialize the ExecutionContextList diff --git a/twilio/rest/studio/v2/flow/execution/execution_step/__init__.py b/twilio/rest/studio/v2/flow/execution/execution_step/__init__.py index 1dd210d67..b7aa6e847 100644 --- a/twilio/rest/studio/v2/flow/execution/execution_step/__init__.py +++ b/twilio/rest/studio/v2/flow/execution/execution_step/__init__.py @@ -12,6 +12,7 @@ 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 @@ -27,6 +28,7 @@ class ExecutionStepInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the ExecutionStep resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStep resource. @@ -151,7 +153,6 @@ def __repr__(self) -> str: class ExecutionStepContext(InstanceContext): - def __init__(self, version: Version, flow_sid: str, execution_sid: str, sid: str): """ Initialize the ExecutionStepContext @@ -298,7 +299,6 @@ def __repr__(self) -> str: class ExecutionStepPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ExecutionStepInstance: """ Build an instance of ExecutionStepInstance @@ -322,7 +322,6 @@ def __repr__(self) -> str: class ExecutionStepList(ListResource): - def __init__(self, version: Version, flow_sid: str, execution_sid: str): """ Initialize the ExecutionStepList @@ -674,10 +673,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ExecutionStepPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/studio/v2/flow/execution/execution_step/execution_step_context.py b/twilio/rest/studio/v2/flow/execution/execution_step/execution_step_context.py index 3b29da1ef..8e89e3664 100644 --- a/twilio/rest/studio/v2/flow/execution/execution_step/execution_step_context.py +++ b/twilio/rest/studio/v2/flow/execution/execution_step/execution_step_context.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class ExecutionStepContextInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStepContext resource. :ivar context: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. @@ -119,7 +121,6 @@ def __repr__(self) -> str: class ExecutionStepContextContext(InstanceContext): - def __init__( self, version: Version, flow_sid: str, execution_sid: str, step_sid: str ): @@ -252,7 +253,6 @@ def __repr__(self) -> str: class ExecutionStepContextList(ListResource): - def __init__( self, version: Version, flow_sid: str, execution_sid: str, step_sid: str ): diff --git a/twilio/rest/studio/v2/flow/flow_revision.py b/twilio/rest/studio/v2/flow/flow_revision.py index dcfc23d2e..550c0dfa5 100644 --- a/twilio/rest/studio/v2/flow/flow_revision.py +++ b/twilio/rest/studio/v2/flow/flow_revision.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class FlowRevisionInstance(InstanceResource): - class Status(object): DRAFT = "draft" PUBLISHED = "published" @@ -139,7 +139,6 @@ def __repr__(self) -> str: class FlowRevisionContext(InstanceContext): - def __init__(self, version: Version, sid: str, revision: str): """ Initialize the FlowRevisionContext @@ -262,7 +261,6 @@ def __repr__(self) -> str: class FlowRevisionPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> FlowRevisionInstance: """ Build an instance of FlowRevisionInstance @@ -281,7 +279,6 @@ def __repr__(self) -> str: class FlowRevisionList(ListResource): - def __init__(self, version: Version, sid: str): """ Initialize the FlowRevisionList @@ -629,10 +626,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = FlowRevisionPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/studio/v2/flow/flow_test_user.py b/twilio/rest/studio/v2/flow/flow_test_user.py index 53429164d..0eda405a3 100644 --- a/twilio/rest/studio/v2/flow/flow_test_user.py +++ b/twilio/rest/studio/v2/flow/flow_test_user.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class FlowTestUserInstance(InstanceResource): + """ :ivar sid: Unique identifier of the flow. :ivar test_users: List of test user identities that can test draft versions of the flow. @@ -150,7 +152,6 @@ def __repr__(self) -> str: class FlowTestUserContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the FlowTestUserContext @@ -363,7 +364,6 @@ def __repr__(self) -> str: class FlowTestUserList(ListResource): - def __init__(self, version: Version, sid: str): """ Initialize the FlowTestUserList diff --git a/twilio/rest/studio/v2/flow_validate.py b/twilio/rest/studio/v2/flow_validate.py index 390ad74ca..bcaaa4e5f 100644 --- a/twilio/rest/studio/v2/flow_validate.py +++ b/twilio/rest/studio/v2/flow_validate.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -22,7 +23,6 @@ class FlowValidateInstance(InstanceResource): - class Status(object): DRAFT = "draft" PUBLISHED = "published" @@ -47,7 +47,6 @@ def __repr__(self) -> str: class FlowValidateList(ListResource): - def __init__(self, version: Version): """ Initialize the FlowValidateList diff --git a/twilio/rest/supersim/SupersimBase.py b/twilio/rest/supersim/SupersimBase.py index dd73d1222..d85c38264 100644 --- a/twilio/rest/supersim/SupersimBase.py +++ b/twilio/rest/supersim/SupersimBase.py @@ -17,7 +17,6 @@ class SupersimBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Supersim Domain diff --git a/twilio/rest/supersim/v1/__init__.py b/twilio/rest/supersim/v1/__init__.py index 2336da261..480787bca 100644 --- a/twilio/rest/supersim/v1/__init__.py +++ b/twilio/rest/supersim/v1/__init__.py @@ -27,7 +27,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Supersim diff --git a/twilio/rest/supersim/v1/esim_profile.py b/twilio/rest/supersim/v1/esim_profile.py index c2d858e0d..cb719823f 100644 --- a/twilio/rest/supersim/v1/esim_profile.py +++ b/twilio/rest/supersim/v1/esim_profile.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class EsimProfileInstance(InstanceResource): - class Status(object): NEW = "new" RESERVING = "reserving" @@ -141,7 +141,6 @@ def __repr__(self) -> str: class EsimProfileContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the EsimProfileContext @@ -258,7 +257,6 @@ def __repr__(self) -> str: class EsimProfilePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> EsimProfileInstance: """ Build an instance of EsimProfileInstance @@ -277,7 +275,6 @@ def __repr__(self) -> str: class EsimProfileList(ListResource): - def __init__(self, version: Version): """ Initialize the EsimProfileList @@ -888,10 +885,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = EsimProfilePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/supersim/v1/fleet.py b/twilio/rest/supersim/v1/fleet.py index b390edaff..f6934fadb 100644 --- a/twilio/rest/supersim/v1/fleet.py +++ b/twilio/rest/supersim/v1/fleet.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class FleetInstance(InstanceResource): - class DataMetering(object): PAYG = "payg" @@ -274,7 +274,6 @@ def __repr__(self) -> str: class FleetContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the FleetContext @@ -605,7 +604,6 @@ def __repr__(self) -> str: class FleetPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> FleetInstance: """ Build an instance of FleetInstance @@ -624,7 +622,6 @@ def __repr__(self) -> str: class FleetList(ListResource): - def __init__(self, version: Version): """ Initialize the FleetList @@ -1251,10 +1248,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = FleetPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/supersim/v1/ip_command.py b/twilio/rest/supersim/v1/ip_command.py index 65a93815c..299d1cd07 100644 --- a/twilio/rest/supersim/v1/ip_command.py +++ b/twilio/rest/supersim/v1/ip_command.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class IpCommandInstance(InstanceResource): - class Direction(object): TO_SIM = "to_sim" FROM_SIM = "from_sim" @@ -151,7 +151,6 @@ def __repr__(self) -> str: class IpCommandContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the IpCommandContext @@ -268,7 +267,6 @@ def __repr__(self) -> str: class IpCommandPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> IpCommandInstance: """ Build an instance of IpCommandInstance @@ -287,7 +285,6 @@ def __repr__(self) -> str: class IpCommandList(ListResource): - def __init__(self, version: Version): """ Initialize the IpCommandList @@ -978,10 +975,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = IpCommandPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/supersim/v1/network.py b/twilio/rest/supersim/v1/network.py index 480e31a2d..26301bdff 100644 --- a/twilio/rest/supersim/v1/network.py +++ b/twilio/rest/supersim/v1/network.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class NetworkInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Network resource. :ivar friendly_name: A human readable identifier of this resource. @@ -109,7 +111,6 @@ def __repr__(self) -> str: class NetworkContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the NetworkContext @@ -226,7 +227,6 @@ def __repr__(self) -> str: class NetworkPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> NetworkInstance: """ Build an instance of NetworkInstance @@ -245,7 +245,6 @@ def __repr__(self) -> str: class NetworkList(ListResource): - def __init__(self, version: Version): """ Initialize the NetworkList @@ -690,10 +689,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = NetworkPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/supersim/v1/network_access_profile/__init__.py b/twilio/rest/supersim/v1/network_access_profile/__init__.py index 639e809a4..39a757cc9 100644 --- a/twilio/rest/supersim/v1/network_access_profile/__init__.py +++ b/twilio/rest/supersim/v1/network_access_profile/__init__.py @@ -12,6 +12,7 @@ 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 @@ -27,6 +28,7 @@ class NetworkAccessProfileInstance(InstanceResource): + """ :ivar sid: The unique string that identifies the Network Access Profile resource. :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. @@ -184,7 +186,6 @@ def __repr__(self) -> str: class NetworkAccessProfileContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the NetworkAccessProfileContext @@ -427,7 +428,6 @@ def __repr__(self) -> str: class NetworkAccessProfilePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> NetworkAccessProfileInstance: """ Build an instance of NetworkAccessProfileInstance @@ -446,7 +446,6 @@ def __repr__(self) -> str: class NetworkAccessProfileList(ListResource): - def __init__(self, version: Version): """ Initialize the NetworkAccessProfileList @@ -917,10 +916,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = NetworkAccessProfilePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/supersim/v1/network_access_profile/network_access_profile_network.py b/twilio/rest/supersim/v1/network_access_profile/network_access_profile_network.py index 9bdcce544..6eb196f2e 100644 --- a/twilio/rest/supersim/v1/network_access_profile/network_access_profile_network.py +++ b/twilio/rest/supersim/v1/network_access_profile/network_access_profile_network.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class NetworkAccessProfileNetworkInstance(InstanceResource): + """ :ivar sid: The unique string that identifies the Network resource. :ivar network_access_profile_sid: The unique string that identifies the Network resource's Network Access Profile resource. @@ -157,7 +159,6 @@ def __repr__(self) -> str: class NetworkAccessProfileNetworkContext(InstanceContext): - def __init__(self, version: Version, network_access_profile_sid: str, sid: str): """ Initialize the NetworkAccessProfileNetworkContext @@ -354,7 +355,6 @@ def __repr__(self) -> str: class NetworkAccessProfileNetworkPage(Page): - def get_instance( self, payload: Dict[str, Any] ) -> NetworkAccessProfileNetworkInstance: @@ -379,7 +379,6 @@ def __repr__(self) -> str: class NetworkAccessProfileNetworkList(ListResource): - def __init__(self, version: Version, network_access_profile_sid: str): """ Initialize the NetworkAccessProfileNetworkList @@ -839,10 +838,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = NetworkAccessProfileNetworkPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/supersim/v1/settings_update.py b/twilio/rest/supersim/v1/settings_update.py index 70cd5cd43..ca9ebb839 100644 --- a/twilio/rest/supersim/v1/settings_update.py +++ b/twilio/rest/supersim/v1/settings_update.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class SettingsUpdateInstance(InstanceResource): - class Status(object): SCHEDULED = "scheduled" IN_PROGRESS = "in-progress" @@ -71,7 +71,6 @@ def __repr__(self) -> str: class SettingsUpdatePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SettingsUpdateInstance: """ Build an instance of SettingsUpdateInstance @@ -90,7 +89,6 @@ def __repr__(self) -> str: class SettingsUpdateList(ListResource): - def __init__(self, version: Version): """ Initialize the SettingsUpdateList @@ -501,10 +499,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SettingsUpdatePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/supersim/v1/sim/__init__.py b/twilio/rest/supersim/v1/sim/__init__.py index 54fae80fe..563e096c8 100644 --- a/twilio/rest/supersim/v1/sim/__init__.py +++ b/twilio/rest/supersim/v1/sim/__init__.py @@ -12,6 +12,7 @@ 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 @@ -26,7 +27,6 @@ class SimInstance(InstanceResource): - class Status(object): NEW = "new" READY = "ready" @@ -273,7 +273,6 @@ def __repr__(self) -> str: class SimContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the SimContext @@ -615,7 +614,6 @@ def __repr__(self) -> str: class SimPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SimInstance: """ Build an instance of SimInstance @@ -634,7 +632,6 @@ def __repr__(self) -> str: class SimList(ListResource): - def __init__(self, version: Version): """ Initialize the SimList @@ -1185,10 +1182,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SimPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/supersim/v1/sim/billing_period.py b/twilio/rest/supersim/v1/sim/billing_period.py index f8f2a6f80..4b934fa50 100644 --- a/twilio/rest/supersim/v1/sim/billing_period.py +++ b/twilio/rest/supersim/v1/sim/billing_period.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class BillingPeriodInstance(InstanceResource): - class BpType(object): READY = "ready" ACTIVE = "active" @@ -77,7 +77,6 @@ def __repr__(self) -> str: class BillingPeriodPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> BillingPeriodInstance: """ Build an instance of BillingPeriodInstance @@ -98,7 +97,6 @@ def __repr__(self) -> str: class BillingPeriodList(ListResource): - def __init__(self, version: Version, sim_sid: str): """ Initialize the BillingPeriodList @@ -446,10 +444,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = BillingPeriodPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/supersim/v1/sim/sim_ip_address.py b/twilio/rest/supersim/v1/sim/sim_ip_address.py index cbf56851c..10c23c395 100644 --- a/twilio/rest/supersim/v1/sim/sim_ip_address.py +++ b/twilio/rest/supersim/v1/sim/sim_ip_address.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,7 +24,6 @@ class SimIpAddressInstance(InstanceResource): - class IpAddressVersion(object): IPV4 = "IPv4" IPV6 = "IPv6" @@ -37,9 +37,9 @@ def __init__(self, version: Version, payload: Dict[str, Any], sim_sid: str): super().__init__(version) self.ip_address: Optional[str] = payload.get("ip_address") - self.ip_address_version: Optional["SimIpAddressInstance.IpAddressVersion"] = ( - payload.get("ip_address_version") - ) + self.ip_address_version: Optional[ + "SimIpAddressInstance.IpAddressVersion" + ] = payload.get("ip_address_version") self._solution = { "sim_sid": sim_sid, @@ -56,7 +56,6 @@ def __repr__(self) -> str: class SimIpAddressPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SimIpAddressInstance: """ Build an instance of SimIpAddressInstance @@ -77,7 +76,6 @@ def __repr__(self) -> str: class SimIpAddressList(ListResource): - def __init__(self, version: Version, sim_sid: str): """ Initialize the SimIpAddressList @@ -425,10 +423,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SimIpAddressPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/supersim/v1/sms_command.py b/twilio/rest/supersim/v1/sms_command.py index f8f75f154..ed440c92e 100644 --- a/twilio/rest/supersim/v1/sms_command.py +++ b/twilio/rest/supersim/v1/sms_command.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class SmsCommandInstance(InstanceResource): - class Direction(object): TO_SIM = "to_sim" FROM_SIM = "from_sim" @@ -136,7 +136,6 @@ def __repr__(self) -> str: class SmsCommandContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the SmsCommandContext @@ -253,7 +252,6 @@ def __repr__(self) -> str: class SmsCommandPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SmsCommandInstance: """ Build an instance of SmsCommandInstance @@ -272,7 +270,6 @@ def __repr__(self) -> str: class SmsCommandList(ListResource): - def __init__(self, version: Version): """ Initialize the SmsCommandList @@ -883,10 +880,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SmsCommandPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/supersim/v1/usage_record.py b/twilio/rest/supersim/v1/usage_record.py index f34c0cbe7..bfea07911 100644 --- a/twilio/rest/supersim/v1/usage_record.py +++ b/twilio/rest/supersim/v1/usage_record.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class UsageRecordInstance(InstanceResource): - class Granularity(object): HOUR = "hour" DAY = "day" @@ -36,6 +36,9 @@ class Group(object): NETWORK = "network" ISOCOUNTRY = "isoCountry" + class SortBy(object): + TIME = "time" + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that incurred the usage. :ivar sim_sid: SID of a Sim resource to which the UsageRecord belongs. Value will only be present when either a value for the `Sim` query parameter is provided or when UsageRecords are grouped by `sim`. Otherwise, the value will be `null`. @@ -78,7 +81,6 @@ def __repr__(self) -> str: class UsageRecordPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> UsageRecordInstance: """ Build an instance of UsageRecordInstance @@ -97,7 +99,6 @@ def __repr__(self) -> str: class UsageRecordList(ListResource): - def __init__(self, version: Version): """ Initialize the UsageRecordList @@ -117,6 +118,7 @@ def stream( iso_country: Union[str, object] = values.unset, group: Union["UsageRecordInstance.Group", object] = values.unset, granularity: Union["UsageRecordInstance.Granularity", object] = values.unset, + sort_by: Union["UsageRecordInstance.SortBy", object] = values.unset, start_time: Union[datetime, object] = values.unset, end_time: Union[datetime, object] = values.unset, limit: Optional[int] = None, @@ -134,6 +136,7 @@ def stream( :param str iso_country: Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country. :param "UsageRecordInstance.Group" group: Dimension over which to aggregate usage records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not aggregate across any of these dimensions, UsageRecords will be aggregated into the time buckets described by the `Granularity` parameter. :param "UsageRecordInstance.Granularity" granularity: Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. `all` returns one UsageRecord that describes the usage for the entire period. + :param "UsageRecordInstance.SortBy" sort_by: :param datetime start_time: Only include usage that occurred at or after this time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is one month before the `end_time`. :param datetime end_time: Only include usage that occurred before this time (exclusive), specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is the current time. :param limit: Upper limit for the number of records to return. stream() @@ -153,6 +156,7 @@ def stream( iso_country=iso_country, group=group, granularity=granularity, + sort_by=sort_by, start_time=start_time, end_time=end_time, page_size=limits["page_size"], @@ -168,6 +172,7 @@ async def stream_async( iso_country: Union[str, object] = values.unset, group: Union["UsageRecordInstance.Group", object] = values.unset, granularity: Union["UsageRecordInstance.Granularity", object] = values.unset, + sort_by: Union["UsageRecordInstance.SortBy", object] = values.unset, start_time: Union[datetime, object] = values.unset, end_time: Union[datetime, object] = values.unset, limit: Optional[int] = None, @@ -185,6 +190,7 @@ async def stream_async( :param str iso_country: Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country. :param "UsageRecordInstance.Group" group: Dimension over which to aggregate usage records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not aggregate across any of these dimensions, UsageRecords will be aggregated into the time buckets described by the `Granularity` parameter. :param "UsageRecordInstance.Granularity" granularity: Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. `all` returns one UsageRecord that describes the usage for the entire period. + :param "UsageRecordInstance.SortBy" sort_by: :param datetime start_time: Only include usage that occurred at or after this time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is one month before the `end_time`. :param datetime end_time: Only include usage that occurred before this time (exclusive), specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is the current time. :param limit: Upper limit for the number of records to return. stream() @@ -204,6 +210,7 @@ async def stream_async( iso_country=iso_country, group=group, granularity=granularity, + sort_by=sort_by, start_time=start_time, end_time=end_time, page_size=limits["page_size"], @@ -219,6 +226,7 @@ def stream_with_http_info( iso_country: Union[str, object] = values.unset, group: Union["UsageRecordInstance.Group", object] = values.unset, granularity: Union["UsageRecordInstance.Granularity", object] = values.unset, + sort_by: Union["UsageRecordInstance.SortBy", object] = values.unset, start_time: Union[datetime, object] = values.unset, end_time: Union[datetime, object] = values.unset, limit: Optional[int] = None, @@ -234,6 +242,7 @@ def stream_with_http_info( :param str iso_country: Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country. :param "UsageRecordInstance.Group" group: Dimension over which to aggregate usage records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not aggregate across any of these dimensions, UsageRecords will be aggregated into the time buckets described by the `Granularity` parameter. :param "UsageRecordInstance.Granularity" granularity: Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. `all` returns one UsageRecord that describes the usage for the entire period. + :param "UsageRecordInstance.SortBy" sort_by: :param datetime start_time: Only include usage that occurred at or after this time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is one month before the `end_time`. :param datetime end_time: Only include usage that occurred before this time (exclusive), specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is the current time. :param limit: Upper limit for the number of records to return. stream() @@ -253,6 +262,7 @@ def stream_with_http_info( iso_country=iso_country, group=group, granularity=granularity, + sort_by=sort_by, start_time=start_time, end_time=end_time, page_size=limits["page_size"], @@ -269,6 +279,7 @@ async def stream_with_http_info_async( iso_country: Union[str, object] = values.unset, group: Union["UsageRecordInstance.Group", object] = values.unset, granularity: Union["UsageRecordInstance.Granularity", object] = values.unset, + sort_by: Union["UsageRecordInstance.SortBy", object] = values.unset, start_time: Union[datetime, object] = values.unset, end_time: Union[datetime, object] = values.unset, limit: Optional[int] = None, @@ -284,6 +295,7 @@ async def stream_with_http_info_async( :param str iso_country: Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country. :param "UsageRecordInstance.Group" group: Dimension over which to aggregate usage records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not aggregate across any of these dimensions, UsageRecords will be aggregated into the time buckets described by the `Granularity` parameter. :param "UsageRecordInstance.Granularity" granularity: Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. `all` returns one UsageRecord that describes the usage for the entire period. + :param "UsageRecordInstance.SortBy" sort_by: :param datetime start_time: Only include usage that occurred at or after this time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is one month before the `end_time`. :param datetime end_time: Only include usage that occurred before this time (exclusive), specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is the current time. :param limit: Upper limit for the number of records to return. stream() @@ -303,6 +315,7 @@ async def stream_with_http_info_async( iso_country=iso_country, group=group, granularity=granularity, + sort_by=sort_by, start_time=start_time, end_time=end_time, page_size=limits["page_size"], @@ -319,6 +332,7 @@ def list( iso_country: Union[str, object] = values.unset, group: Union["UsageRecordInstance.Group", object] = values.unset, granularity: Union["UsageRecordInstance.Granularity", object] = values.unset, + sort_by: Union["UsageRecordInstance.SortBy", object] = values.unset, start_time: Union[datetime, object] = values.unset, end_time: Union[datetime, object] = values.unset, limit: Optional[int] = None, @@ -335,6 +349,7 @@ def list( :param str iso_country: Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country. :param "UsageRecordInstance.Group" group: Dimension over which to aggregate usage records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not aggregate across any of these dimensions, UsageRecords will be aggregated into the time buckets described by the `Granularity` parameter. :param "UsageRecordInstance.Granularity" granularity: Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. `all` returns one UsageRecord that describes the usage for the entire period. + :param "UsageRecordInstance.SortBy" sort_by: :param datetime start_time: Only include usage that occurred at or after this time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is one month before the `end_time`. :param datetime end_time: Only include usage that occurred before this time (exclusive), specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is the current time. :param limit: Upper limit for the number of records to return. list() guarantees @@ -354,6 +369,7 @@ def list( iso_country=iso_country, group=group, granularity=granularity, + sort_by=sort_by, start_time=start_time, end_time=end_time, limit=limit, @@ -369,6 +385,7 @@ async def list_async( iso_country: Union[str, object] = values.unset, group: Union["UsageRecordInstance.Group", object] = values.unset, granularity: Union["UsageRecordInstance.Granularity", object] = values.unset, + sort_by: Union["UsageRecordInstance.SortBy", object] = values.unset, start_time: Union[datetime, object] = values.unset, end_time: Union[datetime, object] = values.unset, limit: Optional[int] = None, @@ -385,6 +402,7 @@ async def list_async( :param str iso_country: Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country. :param "UsageRecordInstance.Group" group: Dimension over which to aggregate usage records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not aggregate across any of these dimensions, UsageRecords will be aggregated into the time buckets described by the `Granularity` parameter. :param "UsageRecordInstance.Granularity" granularity: Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. `all` returns one UsageRecord that describes the usage for the entire period. + :param "UsageRecordInstance.SortBy" sort_by: :param datetime start_time: Only include usage that occurred at or after this time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is one month before the `end_time`. :param datetime end_time: Only include usage that occurred before this time (exclusive), specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is the current time. :param limit: Upper limit for the number of records to return. list() guarantees @@ -405,6 +423,7 @@ async def list_async( iso_country=iso_country, group=group, granularity=granularity, + sort_by=sort_by, start_time=start_time, end_time=end_time, limit=limit, @@ -420,6 +439,7 @@ def list_with_http_info( iso_country: Union[str, object] = values.unset, group: Union["UsageRecordInstance.Group", object] = values.unset, granularity: Union["UsageRecordInstance.Granularity", object] = values.unset, + sort_by: Union["UsageRecordInstance.SortBy", object] = values.unset, start_time: Union[datetime, object] = values.unset, end_time: Union[datetime, object] = values.unset, limit: Optional[int] = None, @@ -435,6 +455,7 @@ def list_with_http_info( :param str iso_country: Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country. :param "UsageRecordInstance.Group" group: Dimension over which to aggregate usage records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not aggregate across any of these dimensions, UsageRecords will be aggregated into the time buckets described by the `Granularity` parameter. :param "UsageRecordInstance.Granularity" granularity: Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. `all` returns one UsageRecord that describes the usage for the entire period. + :param "UsageRecordInstance.SortBy" sort_by: :param datetime start_time: Only include usage that occurred at or after this time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is one month before the `end_time`. :param datetime end_time: Only include usage that occurred before this time (exclusive), specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is the current time. :param limit: Upper limit for the number of records to return. list() guarantees @@ -453,6 +474,7 @@ def list_with_http_info( iso_country=iso_country, group=group, granularity=granularity, + sort_by=sort_by, start_time=start_time, end_time=end_time, limit=limit, @@ -469,6 +491,7 @@ async def list_with_http_info_async( iso_country: Union[str, object] = values.unset, group: Union["UsageRecordInstance.Group", object] = values.unset, granularity: Union["UsageRecordInstance.Granularity", object] = values.unset, + sort_by: Union["UsageRecordInstance.SortBy", object] = values.unset, start_time: Union[datetime, object] = values.unset, end_time: Union[datetime, object] = values.unset, limit: Optional[int] = None, @@ -484,6 +507,7 @@ async def list_with_http_info_async( :param str iso_country: Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country. :param "UsageRecordInstance.Group" group: Dimension over which to aggregate usage records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not aggregate across any of these dimensions, UsageRecords will be aggregated into the time buckets described by the `Granularity` parameter. :param "UsageRecordInstance.Granularity" granularity: Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. `all` returns one UsageRecord that describes the usage for the entire period. + :param "UsageRecordInstance.SortBy" sort_by: :param datetime start_time: Only include usage that occurred at or after this time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is one month before the `end_time`. :param datetime end_time: Only include usage that occurred before this time (exclusive), specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is the current time. :param limit: Upper limit for the number of records to return. list() guarantees @@ -502,6 +526,7 @@ async def list_with_http_info_async( iso_country=iso_country, group=group, granularity=granularity, + sort_by=sort_by, start_time=start_time, end_time=end_time, limit=limit, @@ -518,6 +543,7 @@ def page( iso_country: Union[str, object] = values.unset, group: Union["UsageRecordInstance.Group", object] = values.unset, granularity: Union["UsageRecordInstance.Granularity", object] = values.unset, + sort_by: Union["UsageRecordInstance.SortBy", object] = values.unset, start_time: Union[datetime, object] = values.unset, end_time: Union[datetime, object] = values.unset, page_token: Union[str, object] = values.unset, @@ -534,6 +560,7 @@ def page( :param iso_country: Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country. :param group: Dimension over which to aggregate usage records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not aggregate across any of these dimensions, UsageRecords will be aggregated into the time buckets described by the `Granularity` parameter. :param granularity: Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. `all` returns one UsageRecord that describes the usage for the entire period. + :param sort_by: :param start_time: Only include usage that occurred at or after this time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is one month before the `end_time`. :param end_time: Only include usage that occurred before this time (exclusive), specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is the current time. :param page_token: PageToken provided by the API @@ -550,6 +577,7 @@ def page( "IsoCountry": iso_country, "Group": group, "Granularity": granularity, + "SortBy": sort_by, "StartTime": serialize.iso8601_datetime(start_time), "EndTime": serialize.iso8601_datetime(end_time), "PageToken": page_token, @@ -575,6 +603,7 @@ async def page_async( iso_country: Union[str, object] = values.unset, group: Union["UsageRecordInstance.Group", object] = values.unset, granularity: Union["UsageRecordInstance.Granularity", object] = values.unset, + sort_by: Union["UsageRecordInstance.SortBy", object] = values.unset, start_time: Union[datetime, object] = values.unset, end_time: Union[datetime, object] = values.unset, page_token: Union[str, object] = values.unset, @@ -591,6 +620,7 @@ async def page_async( :param iso_country: Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country. :param group: Dimension over which to aggregate usage records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not aggregate across any of these dimensions, UsageRecords will be aggregated into the time buckets described by the `Granularity` parameter. :param granularity: Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. `all` returns one UsageRecord that describes the usage for the entire period. + :param sort_by: :param start_time: Only include usage that occurred at or after this time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is one month before the `end_time`. :param end_time: Only include usage that occurred before this time (exclusive), specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is the current time. :param page_token: PageToken provided by the API @@ -607,6 +637,7 @@ async def page_async( "IsoCountry": iso_country, "Group": group, "Granularity": granularity, + "SortBy": sort_by, "StartTime": serialize.iso8601_datetime(start_time), "EndTime": serialize.iso8601_datetime(end_time), "PageToken": page_token, @@ -632,6 +663,7 @@ def page_with_http_info( iso_country: Union[str, object] = values.unset, group: Union["UsageRecordInstance.Group", object] = values.unset, granularity: Union["UsageRecordInstance.Granularity", object] = values.unset, + sort_by: Union["UsageRecordInstance.SortBy", object] = values.unset, start_time: Union[datetime, object] = values.unset, end_time: Union[datetime, object] = values.unset, page_token: Union[str, object] = values.unset, @@ -648,6 +680,7 @@ def page_with_http_info( :param iso_country: Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country. :param group: Dimension over which to aggregate usage records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not aggregate across any of these dimensions, UsageRecords will be aggregated into the time buckets described by the `Granularity` parameter. :param granularity: Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. `all` returns one UsageRecord that describes the usage for the entire period. + :param sort_by: :param start_time: Only include usage that occurred at or after this time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is one month before the `end_time`. :param end_time: Only include usage that occurred before this time (exclusive), specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is the current time. :param page_token: PageToken provided by the API @@ -664,6 +697,7 @@ def page_with_http_info( "IsoCountry": iso_country, "Group": group, "Granularity": granularity, + "SortBy": sort_by, "StartTime": serialize.iso8601_datetime(start_time), "EndTime": serialize.iso8601_datetime(end_time), "PageToken": page_token, @@ -690,6 +724,7 @@ async def page_with_http_info_async( iso_country: Union[str, object] = values.unset, group: Union["UsageRecordInstance.Group", object] = values.unset, granularity: Union["UsageRecordInstance.Granularity", object] = values.unset, + sort_by: Union["UsageRecordInstance.SortBy", object] = values.unset, start_time: Union[datetime, object] = values.unset, end_time: Union[datetime, object] = values.unset, page_token: Union[str, object] = values.unset, @@ -706,6 +741,7 @@ async def page_with_http_info_async( :param iso_country: Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country. :param group: Dimension over which to aggregate usage records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not aggregate across any of these dimensions, UsageRecords will be aggregated into the time buckets described by the `Granularity` parameter. :param granularity: Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. `all` returns one UsageRecord that describes the usage for the entire period. + :param sort_by: :param start_time: Only include usage that occurred at or after this time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is one month before the `end_time`. :param end_time: Only include usage that occurred before this time (exclusive), specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is the current time. :param page_token: PageToken provided by the API @@ -722,6 +758,7 @@ async def page_with_http_info_async( "IsoCountry": iso_country, "Group": group, "Granularity": granularity, + "SortBy": sort_by, "StartTime": serialize.iso8601_datetime(start_time), "EndTime": serialize.iso8601_datetime(end_time), "PageToken": page_token, @@ -734,10 +771,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = UsageRecordPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/sync/SyncBase.py b/twilio/rest/sync/SyncBase.py index 113cac039..35c4fa984 100644 --- a/twilio/rest/sync/SyncBase.py +++ b/twilio/rest/sync/SyncBase.py @@ -17,7 +17,6 @@ class SyncBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Sync Domain diff --git a/twilio/rest/sync/v1/__init__.py b/twilio/rest/sync/v1/__init__.py index e98201bd4..db6c47899 100644 --- a/twilio/rest/sync/v1/__init__.py +++ b/twilio/rest/sync/v1/__init__.py @@ -19,7 +19,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Sync diff --git a/twilio/rest/sync/v1/service/__init__.py b/twilio/rest/sync/v1/service/__init__.py index ba214d9f3..01b478ed1 100644 --- a/twilio/rest/sync/v1/service/__init__.py +++ b/twilio/rest/sync/v1/service/__init__.py @@ -12,6 +12,7 @@ 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 @@ -28,6 +29,7 @@ class ServiceInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Service resource. :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. It is a read-only property, it cannot be assigned using REST API. @@ -340,7 +342,6 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -804,7 +805,6 @@ def __repr__(self) -> str: class ServicePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -823,7 +823,6 @@ def __repr__(self) -> str: class ServiceList(ListResource): - def __init__(self, version: Version): """ Initialize the ServiceList @@ -1392,10 +1391,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ServicePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/sync/v1/service/document/__init__.py b/twilio/rest/sync/v1/service/document/__init__.py index a50b295a6..ec4f6d7b5 100644 --- a/twilio/rest/sync/v1/service/document/__init__.py +++ b/twilio/rest/sync/v1/service/document/__init__.py @@ -12,6 +12,7 @@ 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 @@ -27,6 +28,7 @@ class DocumentInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Document resource. :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource and can be up to 320 characters long. @@ -266,7 +268,6 @@ def __repr__(self) -> str: class DocumentContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the DocumentContext @@ -638,7 +639,6 @@ def __repr__(self) -> str: class DocumentPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> DocumentInstance: """ Build an instance of DocumentInstance @@ -659,7 +659,6 @@ def __repr__(self) -> str: class DocumentList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the DocumentList @@ -1155,10 +1154,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = DocumentPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/sync/v1/service/document/document_permission.py b/twilio/rest/sync/v1/service/document/document_permission.py index 11fb64159..dac093177 100644 --- a/twilio/rest/sync/v1/service/document/document_permission.py +++ b/twilio/rest/sync/v1/service/document/document_permission.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class DocumentPermissionInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Document Permission resource. :ivar service_sid: The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. @@ -232,7 +234,6 @@ def __repr__(self) -> str: class DocumentPermissionContext(InstanceContext): - def __init__( self, version: Version, service_sid: str, document_sid: str, identity: str ): @@ -573,7 +574,6 @@ def __repr__(self) -> str: class DocumentPermissionPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> DocumentPermissionInstance: """ Build an instance of DocumentPermissionInstance @@ -597,7 +597,6 @@ def __repr__(self) -> str: class DocumentPermissionList(ListResource): - def __init__(self, version: Version, service_sid: str, document_sid: str): """ Initialize the DocumentPermissionList @@ -951,10 +950,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = DocumentPermissionPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/sync/v1/service/sync_list/__init__.py b/twilio/rest/sync/v1/service/sync_list/__init__.py index c46ec89fa..d43086ca5 100644 --- a/twilio/rest/sync/v1/service/sync_list/__init__.py +++ b/twilio/rest/sync/v1/service/sync_list/__init__.py @@ -12,6 +12,7 @@ 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 @@ -28,6 +29,7 @@ class SyncListInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Sync List resource. :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. @@ -260,7 +262,6 @@ def __repr__(self) -> str: class SyncListContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the SyncListContext @@ -626,7 +627,6 @@ def __repr__(self) -> str: class SyncListPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SyncListInstance: """ Build an instance of SyncListInstance @@ -647,7 +647,6 @@ def __repr__(self) -> str: class SyncListList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the SyncListList @@ -1145,10 +1144,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SyncListPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/sync/v1/service/sync_list/sync_list_item.py b/twilio/rest/sync/v1/service/sync_list/sync_list_item.py index 2614148e1..8d63644a4 100644 --- a/twilio/rest/sync/v1/service/sync_list/sync_list_item.py +++ b/twilio/rest/sync/v1/service/sync_list/sync_list_item.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class SyncListItemInstance(InstanceResource): - class QueryFromBoundType(object): INCLUSIVE = "inclusive" EXCLUSIVE = "exclusive" @@ -306,7 +306,6 @@ def __repr__(self) -> str: class SyncListItemContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, list_sid: str, index: int): """ Initialize the SyncListItemContext @@ -737,7 +736,6 @@ def __repr__(self) -> str: class SyncListItemPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SyncListItemInstance: """ Build an instance of SyncListItemInstance @@ -761,7 +759,6 @@ def __repr__(self) -> str: class SyncListItemList(ListResource): - def __init__(self, version: Version, service_sid: str, list_sid: str): """ Initialize the SyncListItemList @@ -1389,10 +1386,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SyncListItemPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py b/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py index a50060cc4..2669c645a 100644 --- a/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py +++ b/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class SyncListPermissionInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync List Permission resource. :ivar service_sid: The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. @@ -232,7 +234,6 @@ def __repr__(self) -> str: class SyncListPermissionContext(InstanceContext): - def __init__( self, version: Version, service_sid: str, list_sid: str, identity: str ): @@ -575,7 +576,6 @@ def __repr__(self) -> str: class SyncListPermissionPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SyncListPermissionInstance: """ Build an instance of SyncListPermissionInstance @@ -599,7 +599,6 @@ def __repr__(self) -> str: class SyncListPermissionList(ListResource): - def __init__(self, version: Version, service_sid: str, list_sid: str): """ Initialize the SyncListPermissionList @@ -951,10 +950,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SyncListPermissionPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/sync/v1/service/sync_map/__init__.py b/twilio/rest/sync/v1/service/sync_map/__init__.py index 73e06cb74..5446d5be0 100644 --- a/twilio/rest/sync/v1/service/sync_map/__init__.py +++ b/twilio/rest/sync/v1/service/sync_map/__init__.py @@ -12,6 +12,7 @@ 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 @@ -28,6 +29,7 @@ class SyncMapInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Sync Map resource. :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. @@ -260,7 +262,6 @@ def __repr__(self) -> str: class SyncMapContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the SyncMapContext @@ -626,7 +627,6 @@ def __repr__(self) -> str: class SyncMapPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SyncMapInstance: """ Build an instance of SyncMapInstance @@ -647,7 +647,6 @@ def __repr__(self) -> str: class SyncMapList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the SyncMapList @@ -1145,10 +1144,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SyncMapPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/sync/v1/service/sync_map/sync_map_item.py b/twilio/rest/sync/v1/service/sync_map/sync_map_item.py index e244c6b43..2032d2d4a 100644 --- a/twilio/rest/sync/v1/service/sync_map/sync_map_item.py +++ b/twilio/rest/sync/v1/service/sync_map/sync_map_item.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class SyncMapItemInstance(InstanceResource): - class QueryFromBoundType(object): INCLUSIVE = "inclusive" EXCLUSIVE = "exclusive" @@ -306,7 +306,6 @@ def __repr__(self) -> str: class SyncMapItemContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, map_sid: str, key: str): """ Initialize the SyncMapItemContext @@ -737,7 +736,6 @@ def __repr__(self) -> str: class SyncMapItemPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SyncMapItemInstance: """ Build an instance of SyncMapItemInstance @@ -761,7 +759,6 @@ def __repr__(self) -> str: class SyncMapItemList(ListResource): - def __init__(self, version: Version, service_sid: str, map_sid: str): """ Initialize the SyncMapItemList @@ -1417,10 +1414,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SyncMapItemPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py b/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py index 555bc3394..d1beb98f4 100644 --- a/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py +++ b/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class SyncMapPermissionInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync Map Permission resource. :ivar service_sid: The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. @@ -232,7 +234,6 @@ def __repr__(self) -> str: class SyncMapPermissionContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, map_sid: str, identity: str): """ Initialize the SyncMapPermissionContext @@ -573,7 +574,6 @@ def __repr__(self) -> str: class SyncMapPermissionPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SyncMapPermissionInstance: """ Build an instance of SyncMapPermissionInstance @@ -597,7 +597,6 @@ def __repr__(self) -> str: class SyncMapPermissionList(ListResource): - def __init__(self, version: Version, service_sid: str, map_sid: str): """ Initialize the SyncMapPermissionList @@ -949,10 +948,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SyncMapPermissionPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/sync/v1/service/sync_stream/__init__.py b/twilio/rest/sync/v1/service/sync_stream/__init__.py index 2a1a9b627..21973ef7d 100644 --- a/twilio/rest/sync/v1/service/sync_stream/__init__.py +++ b/twilio/rest/sync/v1/service/sync_stream/__init__.py @@ -12,6 +12,7 @@ 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 @@ -25,6 +26,7 @@ class SyncStreamInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Sync Stream resource. :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. @@ -230,7 +232,6 @@ def __repr__(self) -> str: class SyncStreamContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the SyncStreamContext @@ -554,7 +555,6 @@ def __repr__(self) -> str: class SyncStreamPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SyncStreamInstance: """ Build an instance of SyncStreamInstance @@ -575,7 +575,6 @@ def __repr__(self) -> str: class SyncStreamList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the SyncStreamList @@ -1055,10 +1054,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SyncStreamPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/sync/v1/service/sync_stream/stream_message.py b/twilio/rest/sync/v1/service/sync_stream/stream_message.py index f7646d193..6bd44409f 100644 --- a/twilio/rest/sync/v1/service/sync_stream/stream_message.py +++ b/twilio/rest/sync/v1/service/sync_stream/stream_message.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class StreamMessageInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Stream Message resource. :ivar data: An arbitrary, schema-less object that contains the Stream Message body. Can be up to 4 KiB in length. @@ -55,7 +57,6 @@ def __repr__(self) -> str: class StreamMessageList(ListResource): - def __init__(self, version: Version, service_sid: str, stream_sid: str): """ Initialize the StreamMessageList diff --git a/twilio/rest/taskrouter/TaskrouterBase.py b/twilio/rest/taskrouter/TaskrouterBase.py index 4bbbdb602..ee7fbfd7e 100644 --- a/twilio/rest/taskrouter/TaskrouterBase.py +++ b/twilio/rest/taskrouter/TaskrouterBase.py @@ -17,7 +17,6 @@ class TaskrouterBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Taskrouter Domain diff --git a/twilio/rest/taskrouter/v1/__init__.py b/twilio/rest/taskrouter/v1/__init__.py index a17eeccc2..a331fb349 100644 --- a/twilio/rest/taskrouter/v1/__init__.py +++ b/twilio/rest/taskrouter/v1/__init__.py @@ -19,7 +19,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Taskrouter diff --git a/twilio/rest/taskrouter/v1/workspace/__init__.py b/twilio/rest/taskrouter/v1/workspace/__init__.py index 8fbe2cb9f..9e1594ab4 100644 --- a/twilio/rest/taskrouter/v1/workspace/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/__init__.py @@ -12,6 +12,7 @@ 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 @@ -40,7 +41,6 @@ class WorkspaceInstance(InstanceResource): - class QueueOrder(object): FIFO = "FIFO" LIFO = "LIFO" @@ -61,6 +61,9 @@ class QueueOrder(object): :ivar prioritize_queue_order: :ivar url: The absolute URL of the Workspace resource. :ivar links: The URLs of related resources. + :ivar default_operating_unit_sid: The SID of the default Operating Unit of the Workspace. + :ivar default_attention_profile_sid: The SID of the default Attention Profile of the Workspace. + :ivar attention_routing_enabled: Whether Attention Based Routing is enabled. """ def __init__( @@ -84,11 +87,20 @@ def __init__( self.sid: Optional[str] = payload.get("sid") self.timeout_activity_name: Optional[str] = payload.get("timeout_activity_name") self.timeout_activity_sid: Optional[str] = payload.get("timeout_activity_sid") - self.prioritize_queue_order: Optional["WorkspaceInstance.QueueOrder"] = ( - payload.get("prioritize_queue_order") - ) + self.prioritize_queue_order: Optional[ + "WorkspaceInstance.QueueOrder" + ] = payload.get("prioritize_queue_order") self.url: Optional[str] = payload.get("url") self.links: Optional[Dict[str, object]] = payload.get("links") + self.default_operating_unit_sid: Optional[str] = payload.get( + "default_operating_unit_sid" + ) + self.default_attention_profile_sid: Optional[str] = payload.get( + "default_attention_profile_sid" + ) + self.attention_routing_enabled: Optional[bool] = payload.get( + "attention_routing_enabled" + ) self._solution = { "sid": sid or self.sid, @@ -193,6 +205,8 @@ def update( prioritize_queue_order: Union[ "WorkspaceInstance.QueueOrder", object ] = values.unset, + default_attention_profile_sid: Union[str, object] = values.unset, + attention_routing_enabled: Union[bool, object] = values.unset, ) -> "WorkspaceInstance": """ Update the WorkspaceInstance @@ -204,6 +218,8 @@ def update( :param multi_task_enabled: Whether to enable multi-tasking. Can be: `true` to enable multi-tasking, or `false` to disable it. However, all workspaces should be maintained as multi-tasking. There is no default when omitting this parameter. A multi-tasking Workspace can't be updated to single-tasking unless it is not a Flex Project and another (legacy) single-tasking Workspace exists. Multi-tasking allows Workers to handle multiple Tasks simultaneously. In multi-tasking mode, each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking mode (legacy mode), each Worker will only receive a new reservation when the previous task is completed. Learn more at [Multitasking](https://www.twilio.com/docs/taskrouter/multitasking). :param timeout_activity_sid: The SID of the Activity that will be assigned to a Worker when a Task reservation times out without a response. :param prioritize_queue_order: + :param default_attention_profile_sid: The SID of the default Attention Profile of the Workspace. + :param attention_routing_enabled: Whether Attention Based Routing is enabled. :returns: The updated WorkspaceInstance """ @@ -215,6 +231,8 @@ def update( multi_task_enabled=multi_task_enabled, timeout_activity_sid=timeout_activity_sid, prioritize_queue_order=prioritize_queue_order, + default_attention_profile_sid=default_attention_profile_sid, + attention_routing_enabled=attention_routing_enabled, ) async def update_async( @@ -228,6 +246,8 @@ async def update_async( prioritize_queue_order: Union[ "WorkspaceInstance.QueueOrder", object ] = values.unset, + default_attention_profile_sid: Union[str, object] = values.unset, + attention_routing_enabled: Union[bool, object] = values.unset, ) -> "WorkspaceInstance": """ Asynchronous coroutine to update the WorkspaceInstance @@ -239,6 +259,8 @@ async def update_async( :param multi_task_enabled: Whether to enable multi-tasking. Can be: `true` to enable multi-tasking, or `false` to disable it. However, all workspaces should be maintained as multi-tasking. There is no default when omitting this parameter. A multi-tasking Workspace can't be updated to single-tasking unless it is not a Flex Project and another (legacy) single-tasking Workspace exists. Multi-tasking allows Workers to handle multiple Tasks simultaneously. In multi-tasking mode, each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking mode (legacy mode), each Worker will only receive a new reservation when the previous task is completed. Learn more at [Multitasking](https://www.twilio.com/docs/taskrouter/multitasking). :param timeout_activity_sid: The SID of the Activity that will be assigned to a Worker when a Task reservation times out without a response. :param prioritize_queue_order: + :param default_attention_profile_sid: The SID of the default Attention Profile of the Workspace. + :param attention_routing_enabled: Whether Attention Based Routing is enabled. :returns: The updated WorkspaceInstance """ @@ -250,6 +272,8 @@ async def update_async( multi_task_enabled=multi_task_enabled, timeout_activity_sid=timeout_activity_sid, prioritize_queue_order=prioritize_queue_order, + default_attention_profile_sid=default_attention_profile_sid, + attention_routing_enabled=attention_routing_enabled, ) def update_with_http_info( @@ -263,6 +287,8 @@ def update_with_http_info( prioritize_queue_order: Union[ "WorkspaceInstance.QueueOrder", object ] = values.unset, + default_attention_profile_sid: Union[str, object] = values.unset, + attention_routing_enabled: Union[bool, object] = values.unset, ) -> ApiResponse: """ Update the WorkspaceInstance with HTTP info @@ -274,6 +300,8 @@ def update_with_http_info( :param multi_task_enabled: Whether to enable multi-tasking. Can be: `true` to enable multi-tasking, or `false` to disable it. However, all workspaces should be maintained as multi-tasking. There is no default when omitting this parameter. A multi-tasking Workspace can't be updated to single-tasking unless it is not a Flex Project and another (legacy) single-tasking Workspace exists. Multi-tasking allows Workers to handle multiple Tasks simultaneously. In multi-tasking mode, each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking mode (legacy mode), each Worker will only receive a new reservation when the previous task is completed. Learn more at [Multitasking](https://www.twilio.com/docs/taskrouter/multitasking). :param timeout_activity_sid: The SID of the Activity that will be assigned to a Worker when a Task reservation times out without a response. :param prioritize_queue_order: + :param default_attention_profile_sid: The SID of the default Attention Profile of the Workspace. + :param attention_routing_enabled: Whether Attention Based Routing is enabled. :returns: ApiResponse with instance, status code, and headers """ @@ -285,6 +313,8 @@ def update_with_http_info( multi_task_enabled=multi_task_enabled, timeout_activity_sid=timeout_activity_sid, prioritize_queue_order=prioritize_queue_order, + default_attention_profile_sid=default_attention_profile_sid, + attention_routing_enabled=attention_routing_enabled, ) async def update_with_http_info_async( @@ -298,6 +328,8 @@ async def update_with_http_info_async( prioritize_queue_order: Union[ "WorkspaceInstance.QueueOrder", object ] = values.unset, + default_attention_profile_sid: Union[str, object] = values.unset, + attention_routing_enabled: Union[bool, object] = values.unset, ) -> ApiResponse: """ Asynchronous coroutine to update the WorkspaceInstance with HTTP info @@ -309,6 +341,8 @@ async def update_with_http_info_async( :param multi_task_enabled: Whether to enable multi-tasking. Can be: `true` to enable multi-tasking, or `false` to disable it. However, all workspaces should be maintained as multi-tasking. There is no default when omitting this parameter. A multi-tasking Workspace can't be updated to single-tasking unless it is not a Flex Project and another (legacy) single-tasking Workspace exists. Multi-tasking allows Workers to handle multiple Tasks simultaneously. In multi-tasking mode, each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking mode (legacy mode), each Worker will only receive a new reservation when the previous task is completed. Learn more at [Multitasking](https://www.twilio.com/docs/taskrouter/multitasking). :param timeout_activity_sid: The SID of the Activity that will be assigned to a Worker when a Task reservation times out without a response. :param prioritize_queue_order: + :param default_attention_profile_sid: The SID of the default Attention Profile of the Workspace. + :param attention_routing_enabled: Whether Attention Based Routing is enabled. :returns: ApiResponse with instance, status code, and headers """ @@ -320,6 +354,8 @@ async def update_with_http_info_async( multi_task_enabled=multi_task_enabled, timeout_activity_sid=timeout_activity_sid, prioritize_queue_order=prioritize_queue_order, + default_attention_profile_sid=default_attention_profile_sid, + attention_routing_enabled=attention_routing_enabled, ) @property @@ -403,7 +439,6 @@ def __repr__(self) -> str: class WorkspaceContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the WorkspaceContext @@ -599,6 +634,8 @@ def _update( prioritize_queue_order: Union[ "WorkspaceInstance.QueueOrder", object ] = values.unset, + default_attention_profile_sid: Union[str, object] = values.unset, + attention_routing_enabled: Union[bool, object] = values.unset, ) -> tuple: """ Internal helper for update operation @@ -616,6 +653,10 @@ def _update( "MultiTaskEnabled": serialize.boolean_to_string(multi_task_enabled), "TimeoutActivitySid": timeout_activity_sid, "PrioritizeQueueOrder": prioritize_queue_order, + "DefaultAttentionProfileSid": default_attention_profile_sid, + "AttentionRoutingEnabled": serialize.boolean_to_string( + attention_routing_enabled + ), } ) headers = values.of({}) @@ -639,6 +680,8 @@ def update( prioritize_queue_order: Union[ "WorkspaceInstance.QueueOrder", object ] = values.unset, + default_attention_profile_sid: Union[str, object] = values.unset, + attention_routing_enabled: Union[bool, object] = values.unset, ) -> WorkspaceInstance: """ Update the WorkspaceInstance @@ -650,6 +693,8 @@ def update( :param multi_task_enabled: Whether to enable multi-tasking. Can be: `true` to enable multi-tasking, or `false` to disable it. However, all workspaces should be maintained as multi-tasking. There is no default when omitting this parameter. A multi-tasking Workspace can't be updated to single-tasking unless it is not a Flex Project and another (legacy) single-tasking Workspace exists. Multi-tasking allows Workers to handle multiple Tasks simultaneously. In multi-tasking mode, each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking mode (legacy mode), each Worker will only receive a new reservation when the previous task is completed. Learn more at [Multitasking](https://www.twilio.com/docs/taskrouter/multitasking). :param timeout_activity_sid: The SID of the Activity that will be assigned to a Worker when a Task reservation times out without a response. :param prioritize_queue_order: + :param default_attention_profile_sid: The SID of the default Attention Profile of the Workspace. + :param attention_routing_enabled: Whether Attention Based Routing is enabled. :returns: The updated WorkspaceInstance """ @@ -661,6 +706,8 @@ def update( multi_task_enabled=multi_task_enabled, timeout_activity_sid=timeout_activity_sid, prioritize_queue_order=prioritize_queue_order, + default_attention_profile_sid=default_attention_profile_sid, + attention_routing_enabled=attention_routing_enabled, ) return WorkspaceInstance(self._version, payload, sid=self._solution["sid"]) @@ -675,6 +722,8 @@ def update_with_http_info( prioritize_queue_order: Union[ "WorkspaceInstance.QueueOrder", object ] = values.unset, + default_attention_profile_sid: Union[str, object] = values.unset, + attention_routing_enabled: Union[bool, object] = values.unset, ) -> ApiResponse: """ Update the WorkspaceInstance and return response metadata @@ -686,6 +735,8 @@ def update_with_http_info( :param multi_task_enabled: Whether to enable multi-tasking. Can be: `true` to enable multi-tasking, or `false` to disable it. However, all workspaces should be maintained as multi-tasking. There is no default when omitting this parameter. A multi-tasking Workspace can't be updated to single-tasking unless it is not a Flex Project and another (legacy) single-tasking Workspace exists. Multi-tasking allows Workers to handle multiple Tasks simultaneously. In multi-tasking mode, each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking mode (legacy mode), each Worker will only receive a new reservation when the previous task is completed. Learn more at [Multitasking](https://www.twilio.com/docs/taskrouter/multitasking). :param timeout_activity_sid: The SID of the Activity that will be assigned to a Worker when a Task reservation times out without a response. :param prioritize_queue_order: + :param default_attention_profile_sid: The SID of the default Attention Profile of the Workspace. + :param attention_routing_enabled: Whether Attention Based Routing is enabled. :returns: ApiResponse with instance, status code, and headers """ @@ -697,6 +748,8 @@ def update_with_http_info( multi_task_enabled=multi_task_enabled, timeout_activity_sid=timeout_activity_sid, prioritize_queue_order=prioritize_queue_order, + default_attention_profile_sid=default_attention_profile_sid, + attention_routing_enabled=attention_routing_enabled, ) instance = WorkspaceInstance(self._version, payload, sid=self._solution["sid"]) return ApiResponse(data=instance, status_code=status_code, headers=headers) @@ -712,6 +765,8 @@ async def _update_async( prioritize_queue_order: Union[ "WorkspaceInstance.QueueOrder", object ] = values.unset, + default_attention_profile_sid: Union[str, object] = values.unset, + attention_routing_enabled: Union[bool, object] = values.unset, ) -> tuple: """ Internal async helper for update operation @@ -729,6 +784,10 @@ async def _update_async( "MultiTaskEnabled": serialize.boolean_to_string(multi_task_enabled), "TimeoutActivitySid": timeout_activity_sid, "PrioritizeQueueOrder": prioritize_queue_order, + "DefaultAttentionProfileSid": default_attention_profile_sid, + "AttentionRoutingEnabled": serialize.boolean_to_string( + attention_routing_enabled + ), } ) headers = values.of({}) @@ -752,6 +811,8 @@ async def update_async( prioritize_queue_order: Union[ "WorkspaceInstance.QueueOrder", object ] = values.unset, + default_attention_profile_sid: Union[str, object] = values.unset, + attention_routing_enabled: Union[bool, object] = values.unset, ) -> WorkspaceInstance: """ Asynchronous coroutine to update the WorkspaceInstance @@ -763,6 +824,8 @@ async def update_async( :param multi_task_enabled: Whether to enable multi-tasking. Can be: `true` to enable multi-tasking, or `false` to disable it. However, all workspaces should be maintained as multi-tasking. There is no default when omitting this parameter. A multi-tasking Workspace can't be updated to single-tasking unless it is not a Flex Project and another (legacy) single-tasking Workspace exists. Multi-tasking allows Workers to handle multiple Tasks simultaneously. In multi-tasking mode, each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking mode (legacy mode), each Worker will only receive a new reservation when the previous task is completed. Learn more at [Multitasking](https://www.twilio.com/docs/taskrouter/multitasking). :param timeout_activity_sid: The SID of the Activity that will be assigned to a Worker when a Task reservation times out without a response. :param prioritize_queue_order: + :param default_attention_profile_sid: The SID of the default Attention Profile of the Workspace. + :param attention_routing_enabled: Whether Attention Based Routing is enabled. :returns: The updated WorkspaceInstance """ @@ -774,6 +837,8 @@ async def update_async( multi_task_enabled=multi_task_enabled, timeout_activity_sid=timeout_activity_sid, prioritize_queue_order=prioritize_queue_order, + default_attention_profile_sid=default_attention_profile_sid, + attention_routing_enabled=attention_routing_enabled, ) return WorkspaceInstance(self._version, payload, sid=self._solution["sid"]) @@ -788,6 +853,8 @@ async def update_with_http_info_async( prioritize_queue_order: Union[ "WorkspaceInstance.QueueOrder", object ] = values.unset, + default_attention_profile_sid: Union[str, object] = values.unset, + attention_routing_enabled: Union[bool, object] = values.unset, ) -> ApiResponse: """ Asynchronous coroutine to update the WorkspaceInstance and return response metadata @@ -799,6 +866,8 @@ async def update_with_http_info_async( :param multi_task_enabled: Whether to enable multi-tasking. Can be: `true` to enable multi-tasking, or `false` to disable it. However, all workspaces should be maintained as multi-tasking. There is no default when omitting this parameter. A multi-tasking Workspace can't be updated to single-tasking unless it is not a Flex Project and another (legacy) single-tasking Workspace exists. Multi-tasking allows Workers to handle multiple Tasks simultaneously. In multi-tasking mode, each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking mode (legacy mode), each Worker will only receive a new reservation when the previous task is completed. Learn more at [Multitasking](https://www.twilio.com/docs/taskrouter/multitasking). :param timeout_activity_sid: The SID of the Activity that will be assigned to a Worker when a Task reservation times out without a response. :param prioritize_queue_order: + :param default_attention_profile_sid: The SID of the default Attention Profile of the Workspace. + :param attention_routing_enabled: Whether Attention Based Routing is enabled. :returns: ApiResponse with instance, status code, and headers """ @@ -810,6 +879,8 @@ async def update_with_http_info_async( multi_task_enabled=multi_task_enabled, timeout_activity_sid=timeout_activity_sid, prioritize_queue_order=prioritize_queue_order, + default_attention_profile_sid=default_attention_profile_sid, + attention_routing_enabled=attention_routing_enabled, ) instance = WorkspaceInstance(self._version, payload, sid=self._solution["sid"]) return ApiResponse(data=instance, status_code=status_code, headers=headers) @@ -945,7 +1016,6 @@ def __repr__(self) -> str: class WorkspacePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> WorkspaceInstance: """ Build an instance of WorkspaceInstance @@ -964,7 +1034,6 @@ def __repr__(self) -> str: class WorkspaceList(ListResource): - def __init__(self, version: Version): """ Initialize the WorkspaceList @@ -1553,10 +1622,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = WorkspacePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/taskrouter/v1/workspace/activity.py b/twilio/rest/taskrouter/v1/workspace/activity.py index 3217dba21..80a9cc827 100644 --- a/twilio/rest/taskrouter/v1/workspace/activity.py +++ b/twilio/rest/taskrouter/v1/workspace/activity.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class ActivityInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Activity resource. :ivar available: Whether the Worker is eligible to receive a Task when it occupies the Activity. A value of `true`, `1`, or `yes` indicates the Activity is available. All other values indicate that it is not. The value cannot be changed after the Activity is created. @@ -220,7 +222,6 @@ def __repr__(self) -> str: class ActivityContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str, sid: str): """ Initialize the ActivityContext @@ -537,7 +538,6 @@ def __repr__(self) -> str: class ActivityPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ActivityInstance: """ Build an instance of ActivityInstance @@ -558,7 +558,6 @@ def __repr__(self) -> str: class ActivityList(ListResource): - def __init__(self, version: Version, workspace_sid: str): """ Initialize the ActivityList @@ -1108,10 +1107,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ActivityPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/taskrouter/v1/workspace/event.py b/twilio/rest/taskrouter/v1/workspace/event.py index 52f1c31ca..b2ba3eadb 100644 --- a/twilio/rest/taskrouter/v1/workspace/event.py +++ b/twilio/rest/taskrouter/v1/workspace/event.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class EventInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Event resource. :ivar actor_sid: The SID of the resource that triggered the event. @@ -142,7 +144,6 @@ def __repr__(self) -> str: class EventContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str, sid: str): """ Initialize the EventContext @@ -265,7 +266,6 @@ def __repr__(self) -> str: class EventPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> EventInstance: """ Build an instance of EventInstance @@ -286,7 +286,6 @@ def __repr__(self) -> str: class EventList(ListResource): - def __init__(self, version: Version, workspace_sid: str): """ Initialize the EventList @@ -1036,10 +1035,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = EventPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/taskrouter/v1/workspace/task/__init__.py b/twilio/rest/taskrouter/v1/workspace/task/__init__.py index 2cee981e9..b8ae262e6 100644 --- a/twilio/rest/taskrouter/v1/workspace/task/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/task/__init__.py @@ -12,6 +12,7 @@ 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 @@ -25,7 +26,6 @@ class TaskInstance(InstanceResource): - class Status(object): PENDING = "pending" RESERVED = "reserved" @@ -59,6 +59,7 @@ class Status(object): :ivar virtual_start_time: The date and time in GMT indicating the ordering for routing of the Task specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. :ivar ignore_capacity: A boolean that indicates if the Task should respect a Worker's capacity and availability during assignment. This field can only be used when the `RoutingTarget` field is set to a Worker SID. By setting `IgnoreCapacity` to a value of `true`, `1`, or `yes`, the Task will be routed to the Worker without respecting their capacity and availability. Any other value will enforce the Worker's capacity and availability. The default value of `IgnoreCapacity` is `true` when the `RoutingTarget` is set to a Worker SID. :ivar routing_target: A SID of a Worker, Queue, or Workflow to route a Task to + :ivar required_attention: The amount of Attention this task will require on the Worker. """ def __init__( @@ -110,6 +111,9 @@ def __init__( ) self.ignore_capacity: Optional[bool] = payload.get("ignore_capacity") self.routing_target: Optional[str] = payload.get("routing_target") + self.required_attention: Optional[int] = deserialize.integer( + payload.get("required_attention") + ) self._solution = { "workspace_sid": workspace_sid, @@ -230,6 +234,7 @@ def update( priority: Union[int, object] = values.unset, task_channel: Union[str, object] = values.unset, virtual_start_time: Union[datetime, object] = values.unset, + required_attention: Union[int, object] = values.unset, ) -> "TaskInstance": """ Update the TaskInstance @@ -241,6 +246,7 @@ def update( :param priority: The Task's new priority value. When supplied, the Task takes on the specified priority unless it matches a Workflow Target with a Priority set. Value can be 0 to 2^31^ (2,147,483,647). :param task_channel: When MultiTasking is enabled, specify the TaskChannel with the task to update. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. :param virtual_start_time: The task's new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can't be in the future or before the year of 1900. + :param required_attention: The amount of Attention this task will require on the Worker. :returns: The updated TaskInstance """ @@ -252,6 +258,7 @@ def update( priority=priority, task_channel=task_channel, virtual_start_time=virtual_start_time, + required_attention=required_attention, ) async def update_async( @@ -263,6 +270,7 @@ async def update_async( priority: Union[int, object] = values.unset, task_channel: Union[str, object] = values.unset, virtual_start_time: Union[datetime, object] = values.unset, + required_attention: Union[int, object] = values.unset, ) -> "TaskInstance": """ Asynchronous coroutine to update the TaskInstance @@ -274,6 +282,7 @@ async def update_async( :param priority: The Task's new priority value. When supplied, the Task takes on the specified priority unless it matches a Workflow Target with a Priority set. Value can be 0 to 2^31^ (2,147,483,647). :param task_channel: When MultiTasking is enabled, specify the TaskChannel with the task to update. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. :param virtual_start_time: The task's new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can't be in the future or before the year of 1900. + :param required_attention: The amount of Attention this task will require on the Worker. :returns: The updated TaskInstance """ @@ -285,6 +294,7 @@ async def update_async( priority=priority, task_channel=task_channel, virtual_start_time=virtual_start_time, + required_attention=required_attention, ) def update_with_http_info( @@ -296,6 +306,7 @@ def update_with_http_info( priority: Union[int, object] = values.unset, task_channel: Union[str, object] = values.unset, virtual_start_time: Union[datetime, object] = values.unset, + required_attention: Union[int, object] = values.unset, ) -> ApiResponse: """ Update the TaskInstance with HTTP info @@ -307,6 +318,7 @@ def update_with_http_info( :param priority: The Task's new priority value. When supplied, the Task takes on the specified priority unless it matches a Workflow Target with a Priority set. Value can be 0 to 2^31^ (2,147,483,647). :param task_channel: When MultiTasking is enabled, specify the TaskChannel with the task to update. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. :param virtual_start_time: The task's new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can't be in the future or before the year of 1900. + :param required_attention: The amount of Attention this task will require on the Worker. :returns: ApiResponse with instance, status code, and headers """ @@ -318,6 +330,7 @@ def update_with_http_info( priority=priority, task_channel=task_channel, virtual_start_time=virtual_start_time, + required_attention=required_attention, ) async def update_with_http_info_async( @@ -329,6 +342,7 @@ async def update_with_http_info_async( priority: Union[int, object] = values.unset, task_channel: Union[str, object] = values.unset, virtual_start_time: Union[datetime, object] = values.unset, + required_attention: Union[int, object] = values.unset, ) -> ApiResponse: """ Asynchronous coroutine to update the TaskInstance with HTTP info @@ -340,6 +354,7 @@ async def update_with_http_info_async( :param priority: The Task's new priority value. When supplied, the Task takes on the specified priority unless it matches a Workflow Target with a Priority set. Value can be 0 to 2^31^ (2,147,483,647). :param task_channel: When MultiTasking is enabled, specify the TaskChannel with the task to update. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. :param virtual_start_time: The task's new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can't be in the future or before the year of 1900. + :param required_attention: The amount of Attention this task will require on the Worker. :returns: ApiResponse with instance, status code, and headers """ @@ -351,6 +366,7 @@ async def update_with_http_info_async( priority=priority, task_channel=task_channel, virtual_start_time=virtual_start_time, + required_attention=required_attention, ) @property @@ -371,7 +387,6 @@ def __repr__(self) -> str: class TaskContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str, sid: str): """ Initialize the TaskContext @@ -580,6 +595,7 @@ def _update( priority: Union[int, object] = values.unset, task_channel: Union[str, object] = values.unset, virtual_start_time: Union[datetime, object] = values.unset, + required_attention: Union[int, object] = values.unset, ) -> tuple: """ Internal helper for update operation @@ -596,6 +612,7 @@ def _update( "Priority": priority, "TaskChannel": task_channel, "VirtualStartTime": serialize.iso8601_datetime(virtual_start_time), + "RequiredAttention": required_attention, } ) headers = values.of({}) @@ -622,6 +639,7 @@ def update( priority: Union[int, object] = values.unset, task_channel: Union[str, object] = values.unset, virtual_start_time: Union[datetime, object] = values.unset, + required_attention: Union[int, object] = values.unset, ) -> TaskInstance: """ Update the TaskInstance @@ -633,6 +651,7 @@ def update( :param priority: The Task's new priority value. When supplied, the Task takes on the specified priority unless it matches a Workflow Target with a Priority set. Value can be 0 to 2^31^ (2,147,483,647). :param task_channel: When MultiTasking is enabled, specify the TaskChannel with the task to update. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. :param virtual_start_time: The task's new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can't be in the future or before the year of 1900. + :param required_attention: The amount of Attention this task will require on the Worker. :returns: The updated TaskInstance """ @@ -644,6 +663,7 @@ def update( priority=priority, task_channel=task_channel, virtual_start_time=virtual_start_time, + required_attention=required_attention, ) return TaskInstance( self._version, @@ -661,6 +681,7 @@ def update_with_http_info( priority: Union[int, object] = values.unset, task_channel: Union[str, object] = values.unset, virtual_start_time: Union[datetime, object] = values.unset, + required_attention: Union[int, object] = values.unset, ) -> ApiResponse: """ Update the TaskInstance and return response metadata @@ -672,6 +693,7 @@ def update_with_http_info( :param priority: The Task's new priority value. When supplied, the Task takes on the specified priority unless it matches a Workflow Target with a Priority set. Value can be 0 to 2^31^ (2,147,483,647). :param task_channel: When MultiTasking is enabled, specify the TaskChannel with the task to update. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. :param virtual_start_time: The task's new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can't be in the future or before the year of 1900. + :param required_attention: The amount of Attention this task will require on the Worker. :returns: ApiResponse with instance, status code, and headers """ @@ -683,6 +705,7 @@ def update_with_http_info( priority=priority, task_channel=task_channel, virtual_start_time=virtual_start_time, + required_attention=required_attention, ) instance = TaskInstance( self._version, @@ -701,6 +724,7 @@ async def _update_async( priority: Union[int, object] = values.unset, task_channel: Union[str, object] = values.unset, virtual_start_time: Union[datetime, object] = values.unset, + required_attention: Union[int, object] = values.unset, ) -> tuple: """ Internal async helper for update operation @@ -717,6 +741,7 @@ async def _update_async( "Priority": priority, "TaskChannel": task_channel, "VirtualStartTime": serialize.iso8601_datetime(virtual_start_time), + "RequiredAttention": required_attention, } ) headers = values.of({}) @@ -743,6 +768,7 @@ async def update_async( priority: Union[int, object] = values.unset, task_channel: Union[str, object] = values.unset, virtual_start_time: Union[datetime, object] = values.unset, + required_attention: Union[int, object] = values.unset, ) -> TaskInstance: """ Asynchronous coroutine to update the TaskInstance @@ -754,6 +780,7 @@ async def update_async( :param priority: The Task's new priority value. When supplied, the Task takes on the specified priority unless it matches a Workflow Target with a Priority set. Value can be 0 to 2^31^ (2,147,483,647). :param task_channel: When MultiTasking is enabled, specify the TaskChannel with the task to update. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. :param virtual_start_time: The task's new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can't be in the future or before the year of 1900. + :param required_attention: The amount of Attention this task will require on the Worker. :returns: The updated TaskInstance """ @@ -765,6 +792,7 @@ async def update_async( priority=priority, task_channel=task_channel, virtual_start_time=virtual_start_time, + required_attention=required_attention, ) return TaskInstance( self._version, @@ -782,6 +810,7 @@ async def update_with_http_info_async( priority: Union[int, object] = values.unset, task_channel: Union[str, object] = values.unset, virtual_start_time: Union[datetime, object] = values.unset, + required_attention: Union[int, object] = values.unset, ) -> ApiResponse: """ Asynchronous coroutine to update the TaskInstance and return response metadata @@ -793,6 +822,7 @@ async def update_with_http_info_async( :param priority: The Task's new priority value. When supplied, the Task takes on the specified priority unless it matches a Workflow Target with a Priority set. Value can be 0 to 2^31^ (2,147,483,647). :param task_channel: When MultiTasking is enabled, specify the TaskChannel with the task to update. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. :param virtual_start_time: The task's new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can't be in the future or before the year of 1900. + :param required_attention: The amount of Attention this task will require on the Worker. :returns: ApiResponse with instance, status code, and headers """ @@ -804,6 +834,7 @@ async def update_with_http_info_async( priority=priority, task_channel=task_channel, virtual_start_time=virtual_start_time, + required_attention=required_attention, ) instance = TaskInstance( self._version, @@ -837,7 +868,6 @@ def __repr__(self) -> str: class TaskPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> TaskInstance: """ Build an instance of TaskInstance @@ -858,7 +888,6 @@ def __repr__(self) -> str: class TaskList(ListResource): - def __init__(self, version: Version, workspace_sid: str): """ Initialize the TaskList @@ -886,6 +915,7 @@ def _create( routing_target: Union[str, object] = values.unset, ignore_capacity: Union[str, object] = values.unset, task_queue_sid: Union[str, object] = values.unset, + required_attention: Union[int, object] = values.unset, ) -> tuple: """ Internal helper for create operation @@ -905,6 +935,7 @@ def _create( "RoutingTarget": routing_target, "IgnoreCapacity": ignore_capacity, "TaskQueueSid": task_queue_sid, + "RequiredAttention": required_attention, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -928,6 +959,7 @@ def create( routing_target: Union[str, object] = values.unset, ignore_capacity: Union[str, object] = values.unset, task_queue_sid: Union[str, object] = values.unset, + required_attention: Union[int, object] = values.unset, ) -> TaskInstance: """ Create the TaskInstance @@ -941,6 +973,7 @@ def create( :param routing_target: A SID of a Worker, Queue, or Workflow to route a Task to :param ignore_capacity: A boolean that indicates if the Task should respect a Worker's capacity and availability during assignment. This field can only be used when the `RoutingTarget` field is set to a Worker SID. By setting `IgnoreCapacity` to a value of `true`, `1`, or `yes`, the Task will be routed to the Worker without respecting their capacity and availability. Any other value will enforce the Worker's capacity and availability. The default value of `IgnoreCapacity` is `true` when the `RoutingTarget` is set to a Worker SID. :param task_queue_sid: The SID of the TaskQueue in which the Task belongs + :param required_attention: The amount of Attention this task will require on the Worker. :returns: The created TaskInstance """ @@ -954,6 +987,7 @@ def create( routing_target=routing_target, ignore_capacity=ignore_capacity, task_queue_sid=task_queue_sid, + required_attention=required_attention, ) return TaskInstance( self._version, payload, workspace_sid=self._solution["workspace_sid"] @@ -970,6 +1004,7 @@ def create_with_http_info( routing_target: Union[str, object] = values.unset, ignore_capacity: Union[str, object] = values.unset, task_queue_sid: Union[str, object] = values.unset, + required_attention: Union[int, object] = values.unset, ) -> ApiResponse: """ Create the TaskInstance and return response metadata @@ -983,6 +1018,7 @@ def create_with_http_info( :param routing_target: A SID of a Worker, Queue, or Workflow to route a Task to :param ignore_capacity: A boolean that indicates if the Task should respect a Worker's capacity and availability during assignment. This field can only be used when the `RoutingTarget` field is set to a Worker SID. By setting `IgnoreCapacity` to a value of `true`, `1`, or `yes`, the Task will be routed to the Worker without respecting their capacity and availability. Any other value will enforce the Worker's capacity and availability. The default value of `IgnoreCapacity` is `true` when the `RoutingTarget` is set to a Worker SID. :param task_queue_sid: The SID of the TaskQueue in which the Task belongs + :param required_attention: The amount of Attention this task will require on the Worker. :returns: ApiResponse with instance, status code, and headers """ @@ -996,6 +1032,7 @@ def create_with_http_info( routing_target=routing_target, ignore_capacity=ignore_capacity, task_queue_sid=task_queue_sid, + required_attention=required_attention, ) instance = TaskInstance( self._version, payload, workspace_sid=self._solution["workspace_sid"] @@ -1013,6 +1050,7 @@ async def _create_async( routing_target: Union[str, object] = values.unset, ignore_capacity: Union[str, object] = values.unset, task_queue_sid: Union[str, object] = values.unset, + required_attention: Union[int, object] = values.unset, ) -> tuple: """ Internal async helper for create operation @@ -1032,6 +1070,7 @@ async def _create_async( "RoutingTarget": routing_target, "IgnoreCapacity": ignore_capacity, "TaskQueueSid": task_queue_sid, + "RequiredAttention": required_attention, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -1055,6 +1094,7 @@ async def create_async( routing_target: Union[str, object] = values.unset, ignore_capacity: Union[str, object] = values.unset, task_queue_sid: Union[str, object] = values.unset, + required_attention: Union[int, object] = values.unset, ) -> TaskInstance: """ Asynchronously create the TaskInstance @@ -1068,6 +1108,7 @@ async def create_async( :param routing_target: A SID of a Worker, Queue, or Workflow to route a Task to :param ignore_capacity: A boolean that indicates if the Task should respect a Worker's capacity and availability during assignment. This field can only be used when the `RoutingTarget` field is set to a Worker SID. By setting `IgnoreCapacity` to a value of `true`, `1`, or `yes`, the Task will be routed to the Worker without respecting their capacity and availability. Any other value will enforce the Worker's capacity and availability. The default value of `IgnoreCapacity` is `true` when the `RoutingTarget` is set to a Worker SID. :param task_queue_sid: The SID of the TaskQueue in which the Task belongs + :param required_attention: The amount of Attention this task will require on the Worker. :returns: The created TaskInstance """ @@ -1081,6 +1122,7 @@ async def create_async( routing_target=routing_target, ignore_capacity=ignore_capacity, task_queue_sid=task_queue_sid, + required_attention=required_attention, ) return TaskInstance( self._version, payload, workspace_sid=self._solution["workspace_sid"] @@ -1097,6 +1139,7 @@ async def create_with_http_info_async( routing_target: Union[str, object] = values.unset, ignore_capacity: Union[str, object] = values.unset, task_queue_sid: Union[str, object] = values.unset, + required_attention: Union[int, object] = values.unset, ) -> ApiResponse: """ Asynchronously create the TaskInstance and return response metadata @@ -1110,6 +1153,7 @@ async def create_with_http_info_async( :param routing_target: A SID of a Worker, Queue, or Workflow to route a Task to :param ignore_capacity: A boolean that indicates if the Task should respect a Worker's capacity and availability during assignment. This field can only be used when the `RoutingTarget` field is set to a Worker SID. By setting `IgnoreCapacity` to a value of `true`, `1`, or `yes`, the Task will be routed to the Worker without respecting their capacity and availability. Any other value will enforce the Worker's capacity and availability. The default value of `IgnoreCapacity` is `true` when the `RoutingTarget` is set to a Worker SID. :param task_queue_sid: The SID of the TaskQueue in which the Task belongs + :param required_attention: The amount of Attention this task will require on the Worker. :returns: ApiResponse with instance, status code, and headers """ @@ -1123,6 +1167,7 @@ async def create_with_http_info_async( routing_target=routing_target, ignore_capacity=ignore_capacity, task_queue_sid=task_queue_sid, + required_attention=required_attention, ) instance = TaskInstance( self._version, payload, workspace_sid=self._solution["workspace_sid"] @@ -1826,10 +1871,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = TaskPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/taskrouter/v1/workspace/task/reservation.py b/twilio/rest/taskrouter/v1/workspace/task/reservation.py index 9542b139c..2c4fb4905 100644 --- a/twilio/rest/taskrouter/v1/workspace/task/reservation.py +++ b/twilio/rest/taskrouter/v1/workspace/task/reservation.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class ReservationInstance(InstanceResource): - class CallStatus(object): INITIATED = "initiated" RINGING = "ringing" @@ -67,6 +67,7 @@ class SupervisorMode(object): :ivar workspace_sid: The SID of the Workspace that this task is contained within. :ivar url: The absolute URL of the TaskReservation reservation. :ivar links: The URLs of related resources. + :ivar attention: The attention consumed for the reservation. """ def __init__( @@ -96,6 +97,7 @@ def __init__( self.workspace_sid: Optional[str] = payload.get("workspace_sid") self.url: Optional[str] = payload.get("url") self.links: Optional[Dict[str, object]] = payload.get("links") + self.attention: Optional[int] = deserialize.integer(payload.get("attention")) self._solution = { "workspace_sid": workspace_sid, @@ -219,6 +221,8 @@ def update( supervisor: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, jitter_buffer_size: Union[str, object] = values.unset, ) -> "ReservationInstance": """ @@ -278,6 +282,8 @@ def update( :param supervisor: The Supervisor SID/URI when executing the Supervise instruction. :param end_conference_on_customer_exit: Whether to end the conference when the customer leaves. :param beep_on_customer_entrance: Whether to play a notification beep when the customer joins. + :param transcribe: Whether to transcribe the call recording. The default is `false`. + :param transcription_configuration: The SID or (unique) friendly name of the transcription configuration object to use for transcribing. :param jitter_buffer_size: The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. :returns: The updated ReservationInstance @@ -337,6 +343,8 @@ def update( supervisor=supervisor, end_conference_on_customer_exit=end_conference_on_customer_exit, beep_on_customer_entrance=beep_on_customer_entrance, + transcribe=transcribe, + transcription_configuration=transcription_configuration, jitter_buffer_size=jitter_buffer_size, ) @@ -402,6 +410,8 @@ async def update_async( supervisor: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, jitter_buffer_size: Union[str, object] = values.unset, ) -> "ReservationInstance": """ @@ -461,6 +471,8 @@ async def update_async( :param supervisor: The Supervisor SID/URI when executing the Supervise instruction. :param end_conference_on_customer_exit: Whether to end the conference when the customer leaves. :param beep_on_customer_entrance: Whether to play a notification beep when the customer joins. + :param transcribe: Whether to transcribe the call recording. The default is `false`. + :param transcription_configuration: The SID or (unique) friendly name of the transcription configuration object to use for transcribing. :param jitter_buffer_size: The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. :returns: The updated ReservationInstance @@ -520,6 +532,8 @@ async def update_async( supervisor=supervisor, end_conference_on_customer_exit=end_conference_on_customer_exit, beep_on_customer_entrance=beep_on_customer_entrance, + transcribe=transcribe, + transcription_configuration=transcription_configuration, jitter_buffer_size=jitter_buffer_size, ) @@ -585,6 +599,8 @@ def update_with_http_info( supervisor: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, jitter_buffer_size: Union[str, object] = values.unset, ) -> ApiResponse: """ @@ -644,6 +660,8 @@ def update_with_http_info( :param supervisor: The Supervisor SID/URI when executing the Supervise instruction. :param end_conference_on_customer_exit: Whether to end the conference when the customer leaves. :param beep_on_customer_entrance: Whether to play a notification beep when the customer joins. + :param transcribe: Whether to transcribe the call recording. The default is `false`. + :param transcription_configuration: The SID or (unique) friendly name of the transcription configuration object to use for transcribing. :param jitter_buffer_size: The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. :returns: ApiResponse with instance, status code, and headers @@ -703,6 +721,8 @@ def update_with_http_info( supervisor=supervisor, end_conference_on_customer_exit=end_conference_on_customer_exit, beep_on_customer_entrance=beep_on_customer_entrance, + transcribe=transcribe, + transcription_configuration=transcription_configuration, jitter_buffer_size=jitter_buffer_size, ) @@ -768,6 +788,8 @@ async def update_with_http_info_async( supervisor: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, jitter_buffer_size: Union[str, object] = values.unset, ) -> ApiResponse: """ @@ -827,6 +849,8 @@ async def update_with_http_info_async( :param supervisor: The Supervisor SID/URI when executing the Supervise instruction. :param end_conference_on_customer_exit: Whether to end the conference when the customer leaves. :param beep_on_customer_entrance: Whether to play a notification beep when the customer joins. + :param transcribe: Whether to transcribe the call recording. The default is `false`. + :param transcription_configuration: The SID or (unique) friendly name of the transcription configuration object to use for transcribing. :param jitter_buffer_size: The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. :returns: ApiResponse with instance, status code, and headers @@ -886,6 +910,8 @@ async def update_with_http_info_async( supervisor=supervisor, end_conference_on_customer_exit=end_conference_on_customer_exit, beep_on_customer_entrance=beep_on_customer_entrance, + transcribe=transcribe, + transcription_configuration=transcription_configuration, jitter_buffer_size=jitter_buffer_size, ) @@ -900,7 +926,6 @@ def __repr__(self) -> str: class ReservationContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str, task_sid: str, sid: str): """ Initialize the ReservationContext @@ -1084,6 +1109,8 @@ def _update( supervisor: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, jitter_buffer_size: Union[str, object] = values.unset, ) -> tuple: """ @@ -1162,6 +1189,8 @@ def _update( "BeepOnCustomerEntrance": serialize.boolean_to_string( beep_on_customer_entrance ), + "Transcribe": serialize.boolean_to_string(transcribe), + "TranscriptionConfiguration": transcription_configuration, "JitterBufferSize": jitter_buffer_size, } ) @@ -1242,6 +1271,8 @@ def update( supervisor: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, jitter_buffer_size: Union[str, object] = values.unset, ) -> ReservationInstance: """ @@ -1301,6 +1332,8 @@ def update( :param supervisor: The Supervisor SID/URI when executing the Supervise instruction. :param end_conference_on_customer_exit: Whether to end the conference when the customer leaves. :param beep_on_customer_entrance: Whether to play a notification beep when the customer joins. + :param transcribe: Whether to transcribe the call recording. The default is `false`. + :param transcription_configuration: The SID or (unique) friendly name of the transcription configuration object to use for transcribing. :param jitter_buffer_size: The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. :returns: The updated ReservationInstance @@ -1360,6 +1393,8 @@ def update( supervisor=supervisor, end_conference_on_customer_exit=end_conference_on_customer_exit, beep_on_customer_entrance=beep_on_customer_entrance, + transcribe=transcribe, + transcription_configuration=transcription_configuration, jitter_buffer_size=jitter_buffer_size, ) return ReservationInstance( @@ -1432,6 +1467,8 @@ def update_with_http_info( supervisor: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, jitter_buffer_size: Union[str, object] = values.unset, ) -> ApiResponse: """ @@ -1491,6 +1528,8 @@ def update_with_http_info( :param supervisor: The Supervisor SID/URI when executing the Supervise instruction. :param end_conference_on_customer_exit: Whether to end the conference when the customer leaves. :param beep_on_customer_entrance: Whether to play a notification beep when the customer joins. + :param transcribe: Whether to transcribe the call recording. The default is `false`. + :param transcription_configuration: The SID or (unique) friendly name of the transcription configuration object to use for transcribing. :param jitter_buffer_size: The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. :returns: ApiResponse with instance, status code, and headers @@ -1550,6 +1589,8 @@ def update_with_http_info( supervisor=supervisor, end_conference_on_customer_exit=end_conference_on_customer_exit, beep_on_customer_entrance=beep_on_customer_entrance, + transcribe=transcribe, + transcription_configuration=transcription_configuration, jitter_buffer_size=jitter_buffer_size, ) instance = ReservationInstance( @@ -1623,6 +1664,8 @@ async def _update_async( supervisor: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, jitter_buffer_size: Union[str, object] = values.unset, ) -> tuple: """ @@ -1701,6 +1744,8 @@ async def _update_async( "BeepOnCustomerEntrance": serialize.boolean_to_string( beep_on_customer_entrance ), + "Transcribe": serialize.boolean_to_string(transcribe), + "TranscriptionConfiguration": transcription_configuration, "JitterBufferSize": jitter_buffer_size, } ) @@ -1781,6 +1826,8 @@ async def update_async( supervisor: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, jitter_buffer_size: Union[str, object] = values.unset, ) -> ReservationInstance: """ @@ -1840,6 +1887,8 @@ async def update_async( :param supervisor: The Supervisor SID/URI when executing the Supervise instruction. :param end_conference_on_customer_exit: Whether to end the conference when the customer leaves. :param beep_on_customer_entrance: Whether to play a notification beep when the customer joins. + :param transcribe: Whether to transcribe the call recording. The default is `false`. + :param transcription_configuration: The SID or (unique) friendly name of the transcription configuration object to use for transcribing. :param jitter_buffer_size: The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. :returns: The updated ReservationInstance @@ -1899,6 +1948,8 @@ async def update_async( supervisor=supervisor, end_conference_on_customer_exit=end_conference_on_customer_exit, beep_on_customer_entrance=beep_on_customer_entrance, + transcribe=transcribe, + transcription_configuration=transcription_configuration, jitter_buffer_size=jitter_buffer_size, ) return ReservationInstance( @@ -1971,6 +2022,8 @@ async def update_with_http_info_async( supervisor: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, jitter_buffer_size: Union[str, object] = values.unset, ) -> ApiResponse: """ @@ -2030,6 +2083,8 @@ async def update_with_http_info_async( :param supervisor: The Supervisor SID/URI when executing the Supervise instruction. :param end_conference_on_customer_exit: Whether to end the conference when the customer leaves. :param beep_on_customer_entrance: Whether to play a notification beep when the customer joins. + :param transcribe: Whether to transcribe the call recording. The default is `false`. + :param transcription_configuration: The SID or (unique) friendly name of the transcription configuration object to use for transcribing. :param jitter_buffer_size: The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. :returns: ApiResponse with instance, status code, and headers @@ -2089,6 +2144,8 @@ async def update_with_http_info_async( supervisor=supervisor, end_conference_on_customer_exit=end_conference_on_customer_exit, beep_on_customer_entrance=beep_on_customer_entrance, + transcribe=transcribe, + transcription_configuration=transcription_configuration, jitter_buffer_size=jitter_buffer_size, ) instance = ReservationInstance( @@ -2111,7 +2168,6 @@ def __repr__(self) -> str: class ReservationPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ReservationInstance: """ Build an instance of ReservationInstance @@ -2135,7 +2191,6 @@ def __repr__(self) -> str: class ReservationList(ListResource): - def __init__(self, version: Version, workspace_sid: str, task_sid: str): """ Initialize the ReservationList @@ -2565,10 +2620,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ReservationPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/taskrouter/v1/workspace/task_channel.py b/twilio/rest/taskrouter/v1/workspace/task_channel.py index 9bc036b58..cf0ab7d59 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_channel.py +++ b/twilio/rest/taskrouter/v1/workspace/task_channel.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class TaskChannelInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Task Channel resource. :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. @@ -240,7 +242,6 @@ def __repr__(self) -> str: class TaskChannelContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str, sid: str): """ Initialize the TaskChannelContext @@ -591,7 +592,6 @@ def __repr__(self) -> str: class TaskChannelPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> TaskChannelInstance: """ Build an instance of TaskChannelInstance @@ -612,7 +612,6 @@ def __repr__(self) -> str: class TaskChannelList(ListResource): - def __init__(self, version: Version, workspace_sid: str): """ Initialize the TaskChannelList @@ -634,6 +633,7 @@ def _create( friendly_name: str, unique_name: str, channel_optimized_routing: Union[bool, object] = values.unset, + required_attention: Union[int, object] = values.unset, ) -> tuple: """ Internal helper for create operation @@ -649,6 +649,7 @@ def _create( "ChannelOptimizedRouting": serialize.boolean_to_string( channel_optimized_routing ), + "RequiredAttention": required_attention, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -666,6 +667,7 @@ def create( friendly_name: str, unique_name: str, channel_optimized_routing: Union[bool, object] = values.unset, + required_attention: Union[int, object] = values.unset, ) -> TaskChannelInstance: """ Create the TaskChannelInstance @@ -673,6 +675,7 @@ def create( :param friendly_name: A descriptive string that you create to describe the Task Channel. It can be up to 64 characters long. :param unique_name: An application-defined string that uniquely identifies the Task Channel, such as `voice` or `sms`. :param channel_optimized_routing: Whether the Task Channel should prioritize Workers that have been idle. If `true`, Workers that have been idle the longest are prioritized. + :param required_attention: The amount of Attention a Task with this channel will occupy on the Worker. :returns: The created TaskChannelInstance """ @@ -680,6 +683,7 @@ def create( friendly_name=friendly_name, unique_name=unique_name, channel_optimized_routing=channel_optimized_routing, + required_attention=required_attention, ) return TaskChannelInstance( self._version, payload, workspace_sid=self._solution["workspace_sid"] @@ -690,6 +694,7 @@ def create_with_http_info( friendly_name: str, unique_name: str, channel_optimized_routing: Union[bool, object] = values.unset, + required_attention: Union[int, object] = values.unset, ) -> ApiResponse: """ Create the TaskChannelInstance and return response metadata @@ -697,6 +702,7 @@ def create_with_http_info( :param friendly_name: A descriptive string that you create to describe the Task Channel. It can be up to 64 characters long. :param unique_name: An application-defined string that uniquely identifies the Task Channel, such as `voice` or `sms`. :param channel_optimized_routing: Whether the Task Channel should prioritize Workers that have been idle. If `true`, Workers that have been idle the longest are prioritized. + :param required_attention: The amount of Attention a Task with this channel will occupy on the Worker. :returns: ApiResponse with instance, status code, and headers """ @@ -704,6 +710,7 @@ def create_with_http_info( friendly_name=friendly_name, unique_name=unique_name, channel_optimized_routing=channel_optimized_routing, + required_attention=required_attention, ) instance = TaskChannelInstance( self._version, payload, workspace_sid=self._solution["workspace_sid"] @@ -715,6 +722,7 @@ async def _create_async( friendly_name: str, unique_name: str, channel_optimized_routing: Union[bool, object] = values.unset, + required_attention: Union[int, object] = values.unset, ) -> tuple: """ Internal async helper for create operation @@ -730,6 +738,7 @@ async def _create_async( "ChannelOptimizedRouting": serialize.boolean_to_string( channel_optimized_routing ), + "RequiredAttention": required_attention, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -747,6 +756,7 @@ async def create_async( friendly_name: str, unique_name: str, channel_optimized_routing: Union[bool, object] = values.unset, + required_attention: Union[int, object] = values.unset, ) -> TaskChannelInstance: """ Asynchronously create the TaskChannelInstance @@ -754,6 +764,7 @@ async def create_async( :param friendly_name: A descriptive string that you create to describe the Task Channel. It can be up to 64 characters long. :param unique_name: An application-defined string that uniquely identifies the Task Channel, such as `voice` or `sms`. :param channel_optimized_routing: Whether the Task Channel should prioritize Workers that have been idle. If `true`, Workers that have been idle the longest are prioritized. + :param required_attention: The amount of Attention a Task with this channel will occupy on the Worker. :returns: The created TaskChannelInstance """ @@ -761,6 +772,7 @@ async def create_async( friendly_name=friendly_name, unique_name=unique_name, channel_optimized_routing=channel_optimized_routing, + required_attention=required_attention, ) return TaskChannelInstance( self._version, payload, workspace_sid=self._solution["workspace_sid"] @@ -771,6 +783,7 @@ async def create_with_http_info_async( friendly_name: str, unique_name: str, channel_optimized_routing: Union[bool, object] = values.unset, + required_attention: Union[int, object] = values.unset, ) -> ApiResponse: """ Asynchronously create the TaskChannelInstance and return response metadata @@ -778,6 +791,7 @@ async def create_with_http_info_async( :param friendly_name: A descriptive string that you create to describe the Task Channel. It can be up to 64 characters long. :param unique_name: An application-defined string that uniquely identifies the Task Channel, such as `voice` or `sms`. :param channel_optimized_routing: Whether the Task Channel should prioritize Workers that have been idle. If `true`, Workers that have been idle the longest are prioritized. + :param required_attention: The amount of Attention a Task with this channel will occupy on the Worker. :returns: ApiResponse with instance, status code, and headers """ @@ -785,6 +799,7 @@ async def create_with_http_info_async( friendly_name=friendly_name, unique_name=unique_name, channel_optimized_routing=channel_optimized_routing, + required_attention=required_attention, ) instance = TaskChannelInstance( self._version, payload, workspace_sid=self._solution["workspace_sid"] @@ -1122,10 +1137,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = TaskChannelPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py b/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py index 9424b6655..da0e25b2c 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py @@ -12,6 +12,7 @@ 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 @@ -39,7 +40,6 @@ class TaskQueueInstance(InstanceResource): - class TaskOrder(object): FIFO = "FIFO" LIFO = "LIFO" @@ -60,6 +60,7 @@ class TaskOrder(object): :ivar url: The absolute URL of the TaskQueue resource. :ivar workspace_sid: The SID of the Workspace that contains the TaskQueue. :ivar links: The URLs of related resources. + :ivar operating_unit_sid: The SID of the Operating Unit that contains the TaskQueue. """ def __init__( @@ -102,6 +103,7 @@ def __init__( self.url: Optional[str] = payload.get("url") self.workspace_sid: Optional[str] = payload.get("workspace_sid") self.links: Optional[Dict[str, object]] = payload.get("links") + self.operating_unit_sid: Optional[str] = payload.get("operating_unit_sid") self._solution = { "workspace_sid": workspace_sid, @@ -205,6 +207,7 @@ def update( assignment_activity_sid: Union[str, object] = values.unset, max_reserved_workers: Union[int, object] = values.unset, task_order: Union["TaskQueueInstance.TaskOrder", object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, ) -> "TaskQueueInstance": """ Update the TaskQueueInstance @@ -215,6 +218,7 @@ def update( :param assignment_activity_sid: The SID of the Activity to assign Workers when a task is assigned for them. :param max_reserved_workers: The maximum number of Workers to create reservations for the assignment of a task while in the queue. Maximum of 50. :param task_order: + :param operating_unit_sid: The SID of the Operating Unit with the TaskQueue to update. :returns: The updated TaskQueueInstance """ @@ -225,6 +229,7 @@ def update( assignment_activity_sid=assignment_activity_sid, max_reserved_workers=max_reserved_workers, task_order=task_order, + operating_unit_sid=operating_unit_sid, ) async def update_async( @@ -235,6 +240,7 @@ async def update_async( assignment_activity_sid: Union[str, object] = values.unset, max_reserved_workers: Union[int, object] = values.unset, task_order: Union["TaskQueueInstance.TaskOrder", object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, ) -> "TaskQueueInstance": """ Asynchronous coroutine to update the TaskQueueInstance @@ -245,6 +251,7 @@ async def update_async( :param assignment_activity_sid: The SID of the Activity to assign Workers when a task is assigned for them. :param max_reserved_workers: The maximum number of Workers to create reservations for the assignment of a task while in the queue. Maximum of 50. :param task_order: + :param operating_unit_sid: The SID of the Operating Unit with the TaskQueue to update. :returns: The updated TaskQueueInstance """ @@ -255,6 +262,7 @@ async def update_async( assignment_activity_sid=assignment_activity_sid, max_reserved_workers=max_reserved_workers, task_order=task_order, + operating_unit_sid=operating_unit_sid, ) def update_with_http_info( @@ -265,6 +273,7 @@ def update_with_http_info( assignment_activity_sid: Union[str, object] = values.unset, max_reserved_workers: Union[int, object] = values.unset, task_order: Union["TaskQueueInstance.TaskOrder", object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, ) -> ApiResponse: """ Update the TaskQueueInstance with HTTP info @@ -275,6 +284,7 @@ def update_with_http_info( :param assignment_activity_sid: The SID of the Activity to assign Workers when a task is assigned for them. :param max_reserved_workers: The maximum number of Workers to create reservations for the assignment of a task while in the queue. Maximum of 50. :param task_order: + :param operating_unit_sid: The SID of the Operating Unit with the TaskQueue to update. :returns: ApiResponse with instance, status code, and headers """ @@ -285,6 +295,7 @@ def update_with_http_info( assignment_activity_sid=assignment_activity_sid, max_reserved_workers=max_reserved_workers, task_order=task_order, + operating_unit_sid=operating_unit_sid, ) async def update_with_http_info_async( @@ -295,6 +306,7 @@ async def update_with_http_info_async( assignment_activity_sid: Union[str, object] = values.unset, max_reserved_workers: Union[int, object] = values.unset, task_order: Union["TaskQueueInstance.TaskOrder", object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, ) -> ApiResponse: """ Asynchronous coroutine to update the TaskQueueInstance with HTTP info @@ -305,6 +317,7 @@ async def update_with_http_info_async( :param assignment_activity_sid: The SID of the Activity to assign Workers when a task is assigned for them. :param max_reserved_workers: The maximum number of Workers to create reservations for the assignment of a task while in the queue. Maximum of 50. :param task_order: + :param operating_unit_sid: The SID of the Operating Unit with the TaskQueue to update. :returns: ApiResponse with instance, status code, and headers """ @@ -315,6 +328,7 @@ async def update_with_http_info_async( assignment_activity_sid=assignment_activity_sid, max_reserved_workers=max_reserved_workers, task_order=task_order, + operating_unit_sid=operating_unit_sid, ) @property @@ -349,7 +363,6 @@ def __repr__(self) -> str: class TaskQueueContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str, sid: str): """ Initialize the TaskQueueContext @@ -543,6 +556,7 @@ def _update( assignment_activity_sid: Union[str, object] = values.unset, max_reserved_workers: Union[int, object] = values.unset, task_order: Union["TaskQueueInstance.TaskOrder", object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, ) -> tuple: """ Internal helper for update operation @@ -559,6 +573,7 @@ def _update( "AssignmentActivitySid": assignment_activity_sid, "MaxReservedWorkers": max_reserved_workers, "TaskOrder": task_order, + "OperatingUnitSid": operating_unit_sid, } ) headers = values.of({}) @@ -579,6 +594,7 @@ def update( assignment_activity_sid: Union[str, object] = values.unset, max_reserved_workers: Union[int, object] = values.unset, task_order: Union["TaskQueueInstance.TaskOrder", object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, ) -> TaskQueueInstance: """ Update the TaskQueueInstance @@ -589,6 +605,7 @@ def update( :param assignment_activity_sid: The SID of the Activity to assign Workers when a task is assigned for them. :param max_reserved_workers: The maximum number of Workers to create reservations for the assignment of a task while in the queue. Maximum of 50. :param task_order: + :param operating_unit_sid: The SID of the Operating Unit with the TaskQueue to update. :returns: The updated TaskQueueInstance """ @@ -599,6 +616,7 @@ def update( assignment_activity_sid=assignment_activity_sid, max_reserved_workers=max_reserved_workers, task_order=task_order, + operating_unit_sid=operating_unit_sid, ) return TaskQueueInstance( self._version, @@ -615,6 +633,7 @@ def update_with_http_info( assignment_activity_sid: Union[str, object] = values.unset, max_reserved_workers: Union[int, object] = values.unset, task_order: Union["TaskQueueInstance.TaskOrder", object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, ) -> ApiResponse: """ Update the TaskQueueInstance and return response metadata @@ -625,6 +644,7 @@ def update_with_http_info( :param assignment_activity_sid: The SID of the Activity to assign Workers when a task is assigned for them. :param max_reserved_workers: The maximum number of Workers to create reservations for the assignment of a task while in the queue. Maximum of 50. :param task_order: + :param operating_unit_sid: The SID of the Operating Unit with the TaskQueue to update. :returns: ApiResponse with instance, status code, and headers """ @@ -635,6 +655,7 @@ def update_with_http_info( assignment_activity_sid=assignment_activity_sid, max_reserved_workers=max_reserved_workers, task_order=task_order, + operating_unit_sid=operating_unit_sid, ) instance = TaskQueueInstance( self._version, @@ -652,6 +673,7 @@ async def _update_async( assignment_activity_sid: Union[str, object] = values.unset, max_reserved_workers: Union[int, object] = values.unset, task_order: Union["TaskQueueInstance.TaskOrder", object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, ) -> tuple: """ Internal async helper for update operation @@ -668,6 +690,7 @@ async def _update_async( "AssignmentActivitySid": assignment_activity_sid, "MaxReservedWorkers": max_reserved_workers, "TaskOrder": task_order, + "OperatingUnitSid": operating_unit_sid, } ) headers = values.of({}) @@ -688,6 +711,7 @@ async def update_async( assignment_activity_sid: Union[str, object] = values.unset, max_reserved_workers: Union[int, object] = values.unset, task_order: Union["TaskQueueInstance.TaskOrder", object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, ) -> TaskQueueInstance: """ Asynchronous coroutine to update the TaskQueueInstance @@ -698,6 +722,7 @@ async def update_async( :param assignment_activity_sid: The SID of the Activity to assign Workers when a task is assigned for them. :param max_reserved_workers: The maximum number of Workers to create reservations for the assignment of a task while in the queue. Maximum of 50. :param task_order: + :param operating_unit_sid: The SID of the Operating Unit with the TaskQueue to update. :returns: The updated TaskQueueInstance """ @@ -708,6 +733,7 @@ async def update_async( assignment_activity_sid=assignment_activity_sid, max_reserved_workers=max_reserved_workers, task_order=task_order, + operating_unit_sid=operating_unit_sid, ) return TaskQueueInstance( self._version, @@ -724,6 +750,7 @@ async def update_with_http_info_async( assignment_activity_sid: Union[str, object] = values.unset, max_reserved_workers: Union[int, object] = values.unset, task_order: Union["TaskQueueInstance.TaskOrder", object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, ) -> ApiResponse: """ Asynchronous coroutine to update the TaskQueueInstance and return response metadata @@ -734,6 +761,7 @@ async def update_with_http_info_async( :param assignment_activity_sid: The SID of the Activity to assign Workers when a task is assigned for them. :param max_reserved_workers: The maximum number of Workers to create reservations for the assignment of a task while in the queue. Maximum of 50. :param task_order: + :param operating_unit_sid: The SID of the Operating Unit with the TaskQueue to update. :returns: ApiResponse with instance, status code, and headers """ @@ -744,6 +772,7 @@ async def update_with_http_info_async( assignment_activity_sid=assignment_activity_sid, max_reserved_workers=max_reserved_workers, task_order=task_order, + operating_unit_sid=operating_unit_sid, ) instance = TaskQueueInstance( self._version, @@ -803,7 +832,6 @@ def __repr__(self) -> str: class TaskQueuePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> TaskQueueInstance: """ Build an instance of TaskQueueInstance @@ -824,7 +852,6 @@ def __repr__(self) -> str: class TaskQueueList(ListResource): - def __init__(self, version: Version, workspace_sid: str): """ Initialize the TaskQueueList @@ -854,6 +881,7 @@ def _create( task_order: Union["TaskQueueInstance.TaskOrder", object] = values.unset, reservation_activity_sid: Union[str, object] = values.unset, assignment_activity_sid: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, ) -> tuple: """ Internal helper for create operation @@ -870,6 +898,7 @@ def _create( "TaskOrder": task_order, "ReservationActivitySid": reservation_activity_sid, "AssignmentActivitySid": assignment_activity_sid, + "OperatingUnitSid": operating_unit_sid, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -890,6 +919,7 @@ def create( task_order: Union["TaskQueueInstance.TaskOrder", object] = values.unset, reservation_activity_sid: Union[str, object] = values.unset, assignment_activity_sid: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, ) -> TaskQueueInstance: """ Create the TaskQueueInstance @@ -900,6 +930,7 @@ def create( :param task_order: :param reservation_activity_sid: The SID of the Activity to assign Workers when a task is reserved for them. :param assignment_activity_sid: The SID of the Activity to assign Workers when a task is assigned to them. + :param operating_unit_sid: The SID of the Operating Unit that the new TaskQueue belongs to. :returns: The created TaskQueueInstance """ @@ -910,6 +941,7 @@ def create( task_order=task_order, reservation_activity_sid=reservation_activity_sid, assignment_activity_sid=assignment_activity_sid, + operating_unit_sid=operating_unit_sid, ) return TaskQueueInstance( self._version, payload, workspace_sid=self._solution["workspace_sid"] @@ -923,6 +955,7 @@ def create_with_http_info( task_order: Union["TaskQueueInstance.TaskOrder", object] = values.unset, reservation_activity_sid: Union[str, object] = values.unset, assignment_activity_sid: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, ) -> ApiResponse: """ Create the TaskQueueInstance and return response metadata @@ -933,6 +966,7 @@ def create_with_http_info( :param task_order: :param reservation_activity_sid: The SID of the Activity to assign Workers when a task is reserved for them. :param assignment_activity_sid: The SID of the Activity to assign Workers when a task is assigned to them. + :param operating_unit_sid: The SID of the Operating Unit that the new TaskQueue belongs to. :returns: ApiResponse with instance, status code, and headers """ @@ -943,6 +977,7 @@ def create_with_http_info( task_order=task_order, reservation_activity_sid=reservation_activity_sid, assignment_activity_sid=assignment_activity_sid, + operating_unit_sid=operating_unit_sid, ) instance = TaskQueueInstance( self._version, payload, workspace_sid=self._solution["workspace_sid"] @@ -957,6 +992,7 @@ async def _create_async( task_order: Union["TaskQueueInstance.TaskOrder", object] = values.unset, reservation_activity_sid: Union[str, object] = values.unset, assignment_activity_sid: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, ) -> tuple: """ Internal async helper for create operation @@ -973,6 +1009,7 @@ async def _create_async( "TaskOrder": task_order, "ReservationActivitySid": reservation_activity_sid, "AssignmentActivitySid": assignment_activity_sid, + "OperatingUnitSid": operating_unit_sid, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -993,6 +1030,7 @@ async def create_async( task_order: Union["TaskQueueInstance.TaskOrder", object] = values.unset, reservation_activity_sid: Union[str, object] = values.unset, assignment_activity_sid: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, ) -> TaskQueueInstance: """ Asynchronously create the TaskQueueInstance @@ -1003,6 +1041,7 @@ async def create_async( :param task_order: :param reservation_activity_sid: The SID of the Activity to assign Workers when a task is reserved for them. :param assignment_activity_sid: The SID of the Activity to assign Workers when a task is assigned to them. + :param operating_unit_sid: The SID of the Operating Unit that the new TaskQueue belongs to. :returns: The created TaskQueueInstance """ @@ -1013,6 +1052,7 @@ async def create_async( task_order=task_order, reservation_activity_sid=reservation_activity_sid, assignment_activity_sid=assignment_activity_sid, + operating_unit_sid=operating_unit_sid, ) return TaskQueueInstance( self._version, payload, workspace_sid=self._solution["workspace_sid"] @@ -1026,6 +1066,7 @@ async def create_with_http_info_async( task_order: Union["TaskQueueInstance.TaskOrder", object] = values.unset, reservation_activity_sid: Union[str, object] = values.unset, assignment_activity_sid: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, ) -> ApiResponse: """ Asynchronously create the TaskQueueInstance and return response metadata @@ -1036,6 +1077,7 @@ async def create_with_http_info_async( :param task_order: :param reservation_activity_sid: The SID of the Activity to assign Workers when a task is reserved for them. :param assignment_activity_sid: The SID of the Activity to assign Workers when a task is assigned to them. + :param operating_unit_sid: The SID of the Operating Unit that the new TaskQueue belongs to. :returns: ApiResponse with instance, status code, and headers """ @@ -1046,6 +1088,7 @@ async def create_with_http_info_async( task_order=task_order, reservation_activity_sid=reservation_activity_sid, assignment_activity_sid=assignment_activity_sid, + operating_unit_sid=operating_unit_sid, ) instance = TaskQueueInstance( self._version, payload, workspace_sid=self._solution["workspace_sid"] @@ -1058,6 +1101,7 @@ def stream( evaluate_worker_attributes: Union[str, object] = values.unset, worker_sid: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> Iterator[TaskQueueInstance]: @@ -1071,6 +1115,7 @@ def stream( :param str evaluate_worker_attributes: The attributes of the Workers to read. Returns the TaskQueues with Workers that match the attributes specified in this parameter. :param str worker_sid: The SID of the Worker with the TaskQueue resources to read. :param str ordering: Sorting parameter for TaskQueues + :param str operating_unit_sid: The SID of the Operating Unit with the TaskQueue to read. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -1086,6 +1131,7 @@ def stream( evaluate_worker_attributes=evaluate_worker_attributes, worker_sid=worker_sid, ordering=ordering, + operating_unit_sid=operating_unit_sid, page_size=limits["page_size"], ) @@ -1097,6 +1143,7 @@ async def stream_async( evaluate_worker_attributes: Union[str, object] = values.unset, worker_sid: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> AsyncIterator[TaskQueueInstance]: @@ -1110,6 +1157,7 @@ async def stream_async( :param str evaluate_worker_attributes: The attributes of the Workers to read. Returns the TaskQueues with Workers that match the attributes specified in this parameter. :param str worker_sid: The SID of the Worker with the TaskQueue resources to read. :param str ordering: Sorting parameter for TaskQueues + :param str operating_unit_sid: The SID of the Operating Unit with the TaskQueue to read. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -1125,6 +1173,7 @@ async def stream_async( evaluate_worker_attributes=evaluate_worker_attributes, worker_sid=worker_sid, ordering=ordering, + operating_unit_sid=operating_unit_sid, page_size=limits["page_size"], ) @@ -1136,6 +1185,7 @@ def stream_with_http_info( evaluate_worker_attributes: Union[str, object] = values.unset, worker_sid: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> tuple: @@ -1147,6 +1197,7 @@ def stream_with_http_info( :param str evaluate_worker_attributes: The attributes of the Workers to read. Returns the TaskQueues with Workers that match the attributes specified in this parameter. :param str worker_sid: The SID of the Worker with the TaskQueue resources to read. :param str ordering: Sorting parameter for TaskQueues + :param str operating_unit_sid: The SID of the Operating Unit with the TaskQueue to read. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -1162,6 +1213,7 @@ def stream_with_http_info( evaluate_worker_attributes=evaluate_worker_attributes, worker_sid=worker_sid, ordering=ordering, + operating_unit_sid=operating_unit_sid, page_size=limits["page_size"], ) @@ -1174,6 +1226,7 @@ async def stream_with_http_info_async( evaluate_worker_attributes: Union[str, object] = values.unset, worker_sid: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> tuple: @@ -1185,6 +1238,7 @@ async def stream_with_http_info_async( :param str evaluate_worker_attributes: The attributes of the Workers to read. Returns the TaskQueues with Workers that match the attributes specified in this parameter. :param str worker_sid: The SID of the Worker with the TaskQueue resources to read. :param str ordering: Sorting parameter for TaskQueues + :param str operating_unit_sid: The SID of the Operating Unit with the TaskQueue to read. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -1200,6 +1254,7 @@ async def stream_with_http_info_async( evaluate_worker_attributes=evaluate_worker_attributes, worker_sid=worker_sid, ordering=ordering, + operating_unit_sid=operating_unit_sid, page_size=limits["page_size"], ) @@ -1212,6 +1267,7 @@ def list( evaluate_worker_attributes: Union[str, object] = values.unset, worker_sid: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[TaskQueueInstance]: @@ -1224,6 +1280,7 @@ def list( :param str evaluate_worker_attributes: The attributes of the Workers to read. Returns the TaskQueues with Workers that match the attributes specified in this parameter. :param str worker_sid: The SID of the Worker with the TaskQueue resources to read. :param str ordering: Sorting parameter for TaskQueues + :param str operating_unit_sid: The SID of the Operating Unit with the TaskQueue to read. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -1239,6 +1296,7 @@ def list( evaluate_worker_attributes=evaluate_worker_attributes, worker_sid=worker_sid, ordering=ordering, + operating_unit_sid=operating_unit_sid, limit=limit, page_size=page_size, ) @@ -1250,6 +1308,7 @@ async def list_async( evaluate_worker_attributes: Union[str, object] = values.unset, worker_sid: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[TaskQueueInstance]: @@ -1262,6 +1321,7 @@ async def list_async( :param str evaluate_worker_attributes: The attributes of the Workers to read. Returns the TaskQueues with Workers that match the attributes specified in this parameter. :param str worker_sid: The SID of the Worker with the TaskQueue resources to read. :param str ordering: Sorting parameter for TaskQueues + :param str operating_unit_sid: The SID of the Operating Unit with the TaskQueue to read. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -1278,6 +1338,7 @@ async def list_async( evaluate_worker_attributes=evaluate_worker_attributes, worker_sid=worker_sid, ordering=ordering, + operating_unit_sid=operating_unit_sid, limit=limit, page_size=page_size, ) @@ -1289,6 +1350,7 @@ def list_with_http_info( evaluate_worker_attributes: Union[str, object] = values.unset, worker_sid: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> ApiResponse: @@ -1300,6 +1362,7 @@ def list_with_http_info( :param str evaluate_worker_attributes: The attributes of the Workers to read. Returns the TaskQueues with Workers that match the attributes specified in this parameter. :param str worker_sid: The SID of the Worker with the TaskQueue resources to read. :param str ordering: Sorting parameter for TaskQueues + :param str operating_unit_sid: The SID of the Operating Unit with the TaskQueue to read. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -1314,6 +1377,7 @@ def list_with_http_info( evaluate_worker_attributes=evaluate_worker_attributes, worker_sid=worker_sid, ordering=ordering, + operating_unit_sid=operating_unit_sid, limit=limit, page_size=page_size, ) @@ -1326,6 +1390,7 @@ async def list_with_http_info_async( evaluate_worker_attributes: Union[str, object] = values.unset, worker_sid: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> ApiResponse: @@ -1337,6 +1402,7 @@ async def list_with_http_info_async( :param str evaluate_worker_attributes: The attributes of the Workers to read. Returns the TaskQueues with Workers that match the attributes specified in this parameter. :param str worker_sid: The SID of the Worker with the TaskQueue resources to read. :param str ordering: Sorting parameter for TaskQueues + :param str operating_unit_sid: The SID of the Operating Unit with the TaskQueue to read. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -1351,6 +1417,7 @@ async def list_with_http_info_async( evaluate_worker_attributes=evaluate_worker_attributes, worker_sid=worker_sid, ordering=ordering, + operating_unit_sid=operating_unit_sid, limit=limit, page_size=page_size, ) @@ -1363,6 +1430,7 @@ def page( evaluate_worker_attributes: Union[str, object] = values.unset, worker_sid: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -1375,6 +1443,7 @@ def page( :param evaluate_worker_attributes: The attributes of the Workers to read. Returns the TaskQueues with Workers that match the attributes specified in this parameter. :param worker_sid: The SID of the Worker with the TaskQueue resources to read. :param ordering: Sorting parameter for TaskQueues + :param operating_unit_sid: The SID of the Operating Unit with the TaskQueue to read. :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 @@ -1387,6 +1456,7 @@ def page( "EvaluateWorkerAttributes": evaluate_worker_attributes, "WorkerSid": worker_sid, "Ordering": ordering, + "OperatingUnitSid": operating_unit_sid, "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -1408,6 +1478,7 @@ async def page_async( evaluate_worker_attributes: Union[str, object] = values.unset, worker_sid: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -1420,6 +1491,7 @@ async def page_async( :param evaluate_worker_attributes: The attributes of the Workers to read. Returns the TaskQueues with Workers that match the attributes specified in this parameter. :param worker_sid: The SID of the Worker with the TaskQueue resources to read. :param ordering: Sorting parameter for TaskQueues + :param operating_unit_sid: The SID of the Operating Unit with the TaskQueue to read. :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 @@ -1432,6 +1504,7 @@ async def page_async( "EvaluateWorkerAttributes": evaluate_worker_attributes, "WorkerSid": worker_sid, "Ordering": ordering, + "OperatingUnitSid": operating_unit_sid, "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -1453,6 +1526,7 @@ def page_with_http_info( evaluate_worker_attributes: Union[str, object] = values.unset, worker_sid: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -1465,6 +1539,7 @@ def page_with_http_info( :param evaluate_worker_attributes: The attributes of the Workers to read. Returns the TaskQueues with Workers that match the attributes specified in this parameter. :param worker_sid: The SID of the Worker with the TaskQueue resources to read. :param ordering: Sorting parameter for TaskQueues + :param operating_unit_sid: The SID of the Operating Unit with the TaskQueue to read. :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 @@ -1477,6 +1552,7 @@ def page_with_http_info( "EvaluateWorkerAttributes": evaluate_worker_attributes, "WorkerSid": worker_sid, "Ordering": ordering, + "OperatingUnitSid": operating_unit_sid, "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -1499,6 +1575,7 @@ async def page_with_http_info_async( evaluate_worker_attributes: Union[str, object] = values.unset, worker_sid: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -1511,6 +1588,7 @@ async def page_with_http_info_async( :param evaluate_worker_attributes: The attributes of the Workers to read. Returns the TaskQueues with Workers that match the attributes specified in this parameter. :param worker_sid: The SID of the Worker with the TaskQueue resources to read. :param ordering: Sorting parameter for TaskQueues + :param operating_unit_sid: The SID of the Operating Unit with the TaskQueue to read. :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 @@ -1523,6 +1601,7 @@ async def page_with_http_info_async( "EvaluateWorkerAttributes": evaluate_worker_attributes, "WorkerSid": worker_sid, "Ordering": ordering, + "OperatingUnitSid": operating_unit_sid, "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -1533,10 +1612,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = TaskQueuePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_bulk_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_bulk_real_time_statistics.py index 5273d75de..d107785f0 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_bulk_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_bulk_real_time_statistics.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union from twilio.base import deserialize, values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class TaskQueueBulkRealTimeStatisticsInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. :ivar workspace_sid: The SID of the Workspace that contains the TaskQueue. @@ -62,7 +64,6 @@ def __repr__(self) -> str: class TaskQueueBulkRealTimeStatisticsList(ListResource): - def __init__(self, version: Version, workspace_sid: str): """ Initialize the TaskQueueBulkRealTimeStatisticsList diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py index 95d45d17e..36c9b9304 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, serialize, values @@ -23,6 +24,7 @@ class TaskQueueCumulativeStatisticsInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. :ivar avg_task_acceptance_time: The average time in seconds between Task creation and acceptance. @@ -95,9 +97,9 @@ def __init__( self.wait_duration_until_canceled: Optional[Dict[str, object]] = payload.get( "wait_duration_until_canceled" ) - self.wait_duration_in_queue_until_accepted: Optional[Dict[str, object]] = ( - payload.get("wait_duration_in_queue_until_accepted") - ) + self.wait_duration_in_queue_until_accepted: Optional[ + Dict[str, object] + ] = payload.get("wait_duration_in_queue_until_accepted") self.tasks_canceled: Optional[int] = deserialize.integer( payload.get("tasks_canceled") ) @@ -259,7 +261,6 @@ def __repr__(self) -> str: class TaskQueueCumulativeStatisticsContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str, task_queue_sid: str): """ Initialize the TaskQueueCumulativeStatisticsContext @@ -492,7 +493,6 @@ def __repr__(self) -> str: class TaskQueueCumulativeStatisticsList(ListResource): - def __init__(self, version: Version, workspace_sid: str, task_queue_sid: str): """ Initialize the TaskQueueCumulativeStatisticsList diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py index c03418d21..b05e22cb0 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union from twilio.base import deserialize, values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class TaskQueueRealTimeStatisticsInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. :ivar activity_statistics: The number of current Workers by Activity. @@ -174,7 +176,6 @@ def __repr__(self) -> str: class TaskQueueRealTimeStatisticsContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str, task_queue_sid: str): """ Initialize the TaskQueueRealTimeStatisticsContext @@ -329,7 +330,6 @@ def __repr__(self) -> str: class TaskQueueRealTimeStatisticsList(ListResource): - def __init__(self, version: Version, workspace_sid: str, task_queue_sid: str): """ Initialize the TaskQueueRealTimeStatisticsList diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py index 6bdd3ecdd..e84ccaa90 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import serialize, values @@ -23,6 +24,7 @@ class TaskQueueStatisticsInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. :ivar cumulative: An object that contains the cumulative statistics for the TaskQueue. @@ -189,7 +191,6 @@ def __repr__(self) -> str: class TaskQueueStatisticsContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str, task_queue_sid: str): """ Initialize the TaskQueueStatisticsContext @@ -422,7 +423,6 @@ def __repr__(self) -> str: class TaskQueueStatisticsList(ListResource): - def __init__(self, version: Version, workspace_sid: str, task_queue_sid: str): """ Initialize the TaskQueueStatisticsList diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py index 3f3822cc1..08b562f06 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import serialize, values @@ -24,6 +25,7 @@ class TaskQueuesStatisticsInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. :ivar cumulative: An object that contains the cumulative statistics for the TaskQueues. @@ -56,7 +58,6 @@ def __repr__(self) -> str: class TaskQueuesStatisticsPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> TaskQueuesStatisticsInstance: """ Build an instance of TaskQueuesStatisticsInstance @@ -77,7 +78,6 @@ def __repr__(self) -> str: class TaskQueuesStatisticsList(ListResource): - def __init__(self, version: Version, workspace_sid: str): """ Initialize the TaskQueuesStatisticsList @@ -649,10 +649,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = TaskQueuesStatisticsPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/taskrouter/v1/workspace/worker/__init__.py b/twilio/rest/taskrouter/v1/workspace/worker/__init__.py index 4c763ff9f..290cd27a6 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/__init__.py @@ -12,6 +12,7 @@ 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 @@ -38,6 +39,7 @@ class WorkerInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. :ivar activity_name: The `friendly_name` of the Worker's current Activity. @@ -52,6 +54,10 @@ class WorkerInstance(InstanceResource): :ivar workspace_sid: The SID of the Workspace that contains the Worker. :ivar url: The absolute URL of the Worker resource. :ivar links: The URLs of related resources. + :ivar operating_unit_sid: The SID of the Operating Unit that contains the Worker. + :ivar consumed_concurrency: The number of concurrent tasks that the Worker is currently handling. + :ivar consumed_attention: The amount of attention that the Worker has consumed. + :ivar configured_concurrency: The current configured concurrency for the Worker. TaskRouter will not create any reservations with Attention Routing after the consumed concurrency for the Worker reaches the value. """ def __init__( @@ -82,6 +88,16 @@ def __init__( self.workspace_sid: Optional[str] = payload.get("workspace_sid") self.url: Optional[str] = payload.get("url") self.links: Optional[Dict[str, object]] = payload.get("links") + self.operating_unit_sid: Optional[str] = payload.get("operating_unit_sid") + self.consumed_concurrency: Optional[int] = deserialize.integer( + payload.get("consumed_concurrency") + ) + self.consumed_attention: Optional[int] = deserialize.integer( + payload.get("consumed_attention") + ) + self.configured_concurrency: Optional[int] = deserialize.integer( + payload.get("configured_concurrency") + ) self._solution = { "workspace_sid": workspace_sid, @@ -200,6 +216,8 @@ def update( attributes: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, reject_pending_reservations: Union[bool, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, + concurrency: Union[int, object] = values.unset, ) -> "WorkerInstance": """ Update the WorkerInstance @@ -209,6 +227,8 @@ def update( :param attributes: The JSON string that describes the Worker. For example: `{ \\\"email\\\": \\\"Bob@example.com\\\", \\\"phone\\\": \\\"+5095551234\\\" }`. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. Defaults to {}. :param friendly_name: A descriptive string that you create to describe the Worker. It can be up to 64 characters long. :param reject_pending_reservations: Whether to reject the Worker's pending reservations. This option is only valid if the Worker's new [Activity](https://www.twilio.com/docs/taskrouter/api/activity) resource has its `availability` property set to `False`. + :param operating_unit_sid: The SID of the Operating Unit with the Worker to update. + :param concurrency: The total number of Tasks that a Worker should handle for Attention Routing. TaskRouter creates reservations for Tasks up to the specified concurrency. To default to the Attention Profile's concurrency limit, use -1. :returns: The updated WorkerInstance """ @@ -218,6 +238,8 @@ def update( attributes=attributes, friendly_name=friendly_name, reject_pending_reservations=reject_pending_reservations, + operating_unit_sid=operating_unit_sid, + concurrency=concurrency, ) async def update_async( @@ -227,6 +249,8 @@ async def update_async( attributes: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, reject_pending_reservations: Union[bool, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, + concurrency: Union[int, object] = values.unset, ) -> "WorkerInstance": """ Asynchronous coroutine to update the WorkerInstance @@ -236,6 +260,8 @@ async def update_async( :param attributes: The JSON string that describes the Worker. For example: `{ \\\"email\\\": \\\"Bob@example.com\\\", \\\"phone\\\": \\\"+5095551234\\\" }`. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. Defaults to {}. :param friendly_name: A descriptive string that you create to describe the Worker. It can be up to 64 characters long. :param reject_pending_reservations: Whether to reject the Worker's pending reservations. This option is only valid if the Worker's new [Activity](https://www.twilio.com/docs/taskrouter/api/activity) resource has its `availability` property set to `False`. + :param operating_unit_sid: The SID of the Operating Unit with the Worker to update. + :param concurrency: The total number of Tasks that a Worker should handle for Attention Routing. TaskRouter creates reservations for Tasks up to the specified concurrency. To default to the Attention Profile's concurrency limit, use -1. :returns: The updated WorkerInstance """ @@ -245,6 +271,8 @@ async def update_async( attributes=attributes, friendly_name=friendly_name, reject_pending_reservations=reject_pending_reservations, + operating_unit_sid=operating_unit_sid, + concurrency=concurrency, ) def update_with_http_info( @@ -254,6 +282,8 @@ def update_with_http_info( attributes: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, reject_pending_reservations: Union[bool, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, + concurrency: Union[int, object] = values.unset, ) -> ApiResponse: """ Update the WorkerInstance with HTTP info @@ -263,6 +293,8 @@ def update_with_http_info( :param attributes: The JSON string that describes the Worker. For example: `{ \\\"email\\\": \\\"Bob@example.com\\\", \\\"phone\\\": \\\"+5095551234\\\" }`. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. Defaults to {}. :param friendly_name: A descriptive string that you create to describe the Worker. It can be up to 64 characters long. :param reject_pending_reservations: Whether to reject the Worker's pending reservations. This option is only valid if the Worker's new [Activity](https://www.twilio.com/docs/taskrouter/api/activity) resource has its `availability` property set to `False`. + :param operating_unit_sid: The SID of the Operating Unit with the Worker to update. + :param concurrency: The total number of Tasks that a Worker should handle for Attention Routing. TaskRouter creates reservations for Tasks up to the specified concurrency. To default to the Attention Profile's concurrency limit, use -1. :returns: ApiResponse with instance, status code, and headers """ @@ -272,6 +304,8 @@ def update_with_http_info( attributes=attributes, friendly_name=friendly_name, reject_pending_reservations=reject_pending_reservations, + operating_unit_sid=operating_unit_sid, + concurrency=concurrency, ) async def update_with_http_info_async( @@ -281,6 +315,8 @@ async def update_with_http_info_async( attributes: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, reject_pending_reservations: Union[bool, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, + concurrency: Union[int, object] = values.unset, ) -> ApiResponse: """ Asynchronous coroutine to update the WorkerInstance with HTTP info @@ -290,6 +326,8 @@ async def update_with_http_info_async( :param attributes: The JSON string that describes the Worker. For example: `{ \\\"email\\\": \\\"Bob@example.com\\\", \\\"phone\\\": \\\"+5095551234\\\" }`. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. Defaults to {}. :param friendly_name: A descriptive string that you create to describe the Worker. It can be up to 64 characters long. :param reject_pending_reservations: Whether to reject the Worker's pending reservations. This option is only valid if the Worker's new [Activity](https://www.twilio.com/docs/taskrouter/api/activity) resource has its `availability` property set to `False`. + :param operating_unit_sid: The SID of the Operating Unit with the Worker to update. + :param concurrency: The total number of Tasks that a Worker should handle for Attention Routing. TaskRouter creates reservations for Tasks up to the specified concurrency. To default to the Attention Profile's concurrency limit, use -1. :returns: ApiResponse with instance, status code, and headers """ @@ -299,6 +337,8 @@ async def update_with_http_info_async( attributes=attributes, friendly_name=friendly_name, reject_pending_reservations=reject_pending_reservations, + operating_unit_sid=operating_unit_sid, + concurrency=concurrency, ) @property @@ -333,7 +373,6 @@ def __repr__(self) -> str: class WorkerContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str, sid: str): """ Initialize the WorkerContext @@ -542,6 +581,8 @@ def _update( attributes: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, reject_pending_reservations: Union[bool, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, + concurrency: Union[int, object] = values.unset, ) -> tuple: """ Internal helper for update operation @@ -558,6 +599,8 @@ def _update( "RejectPendingReservations": serialize.boolean_to_string( reject_pending_reservations ), + "OperatingUnitSid": operating_unit_sid, + "Concurrency": concurrency, } ) headers = values.of({}) @@ -582,6 +625,8 @@ def update( attributes: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, reject_pending_reservations: Union[bool, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, + concurrency: Union[int, object] = values.unset, ) -> WorkerInstance: """ Update the WorkerInstance @@ -591,6 +636,8 @@ def update( :param attributes: The JSON string that describes the Worker. For example: `{ \\\"email\\\": \\\"Bob@example.com\\\", \\\"phone\\\": \\\"+5095551234\\\" }`. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. Defaults to {}. :param friendly_name: A descriptive string that you create to describe the Worker. It can be up to 64 characters long. :param reject_pending_reservations: Whether to reject the Worker's pending reservations. This option is only valid if the Worker's new [Activity](https://www.twilio.com/docs/taskrouter/api/activity) resource has its `availability` property set to `False`. + :param operating_unit_sid: The SID of the Operating Unit with the Worker to update. + :param concurrency: The total number of Tasks that a Worker should handle for Attention Routing. TaskRouter creates reservations for Tasks up to the specified concurrency. To default to the Attention Profile's concurrency limit, use -1. :returns: The updated WorkerInstance """ @@ -600,6 +647,8 @@ def update( attributes=attributes, friendly_name=friendly_name, reject_pending_reservations=reject_pending_reservations, + operating_unit_sid=operating_unit_sid, + concurrency=concurrency, ) return WorkerInstance( self._version, @@ -615,6 +664,8 @@ def update_with_http_info( attributes: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, reject_pending_reservations: Union[bool, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, + concurrency: Union[int, object] = values.unset, ) -> ApiResponse: """ Update the WorkerInstance and return response metadata @@ -624,6 +675,8 @@ def update_with_http_info( :param attributes: The JSON string that describes the Worker. For example: `{ \\\"email\\\": \\\"Bob@example.com\\\", \\\"phone\\\": \\\"+5095551234\\\" }`. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. Defaults to {}. :param friendly_name: A descriptive string that you create to describe the Worker. It can be up to 64 characters long. :param reject_pending_reservations: Whether to reject the Worker's pending reservations. This option is only valid if the Worker's new [Activity](https://www.twilio.com/docs/taskrouter/api/activity) resource has its `availability` property set to `False`. + :param operating_unit_sid: The SID of the Operating Unit with the Worker to update. + :param concurrency: The total number of Tasks that a Worker should handle for Attention Routing. TaskRouter creates reservations for Tasks up to the specified concurrency. To default to the Attention Profile's concurrency limit, use -1. :returns: ApiResponse with instance, status code, and headers """ @@ -633,6 +686,8 @@ def update_with_http_info( attributes=attributes, friendly_name=friendly_name, reject_pending_reservations=reject_pending_reservations, + operating_unit_sid=operating_unit_sid, + concurrency=concurrency, ) instance = WorkerInstance( self._version, @@ -649,6 +704,8 @@ async def _update_async( attributes: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, reject_pending_reservations: Union[bool, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, + concurrency: Union[int, object] = values.unset, ) -> tuple: """ Internal async helper for update operation @@ -665,6 +722,8 @@ async def _update_async( "RejectPendingReservations": serialize.boolean_to_string( reject_pending_reservations ), + "OperatingUnitSid": operating_unit_sid, + "Concurrency": concurrency, } ) headers = values.of({}) @@ -689,6 +748,8 @@ async def update_async( attributes: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, reject_pending_reservations: Union[bool, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, + concurrency: Union[int, object] = values.unset, ) -> WorkerInstance: """ Asynchronous coroutine to update the WorkerInstance @@ -698,6 +759,8 @@ async def update_async( :param attributes: The JSON string that describes the Worker. For example: `{ \\\"email\\\": \\\"Bob@example.com\\\", \\\"phone\\\": \\\"+5095551234\\\" }`. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. Defaults to {}. :param friendly_name: A descriptive string that you create to describe the Worker. It can be up to 64 characters long. :param reject_pending_reservations: Whether to reject the Worker's pending reservations. This option is only valid if the Worker's new [Activity](https://www.twilio.com/docs/taskrouter/api/activity) resource has its `availability` property set to `False`. + :param operating_unit_sid: The SID of the Operating Unit with the Worker to update. + :param concurrency: The total number of Tasks that a Worker should handle for Attention Routing. TaskRouter creates reservations for Tasks up to the specified concurrency. To default to the Attention Profile's concurrency limit, use -1. :returns: The updated WorkerInstance """ @@ -707,6 +770,8 @@ async def update_async( attributes=attributes, friendly_name=friendly_name, reject_pending_reservations=reject_pending_reservations, + operating_unit_sid=operating_unit_sid, + concurrency=concurrency, ) return WorkerInstance( self._version, @@ -722,6 +787,8 @@ async def update_with_http_info_async( attributes: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, reject_pending_reservations: Union[bool, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, + concurrency: Union[int, object] = values.unset, ) -> ApiResponse: """ Asynchronous coroutine to update the WorkerInstance and return response metadata @@ -731,6 +798,8 @@ async def update_with_http_info_async( :param attributes: The JSON string that describes the Worker. For example: `{ \\\"email\\\": \\\"Bob@example.com\\\", \\\"phone\\\": \\\"+5095551234\\\" }`. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. Defaults to {}. :param friendly_name: A descriptive string that you create to describe the Worker. It can be up to 64 characters long. :param reject_pending_reservations: Whether to reject the Worker's pending reservations. This option is only valid if the Worker's new [Activity](https://www.twilio.com/docs/taskrouter/api/activity) resource has its `availability` property set to `False`. + :param operating_unit_sid: The SID of the Operating Unit with the Worker to update. + :param concurrency: The total number of Tasks that a Worker should handle for Attention Routing. TaskRouter creates reservations for Tasks up to the specified concurrency. To default to the Attention Profile's concurrency limit, use -1. :returns: ApiResponse with instance, status code, and headers """ @@ -740,6 +809,8 @@ async def update_with_http_info_async( attributes=attributes, friendly_name=friendly_name, reject_pending_reservations=reject_pending_reservations, + operating_unit_sid=operating_unit_sid, + concurrency=concurrency, ) instance = WorkerInstance( self._version, @@ -799,7 +870,6 @@ def __repr__(self) -> str: class WorkerPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> WorkerInstance: """ Build an instance of WorkerInstance @@ -820,7 +890,6 @@ def __repr__(self) -> str: class WorkerList(ListResource): - def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkerList @@ -846,6 +915,8 @@ def _create( friendly_name: str, activity_sid: Union[str, object] = values.unset, attributes: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, + concurrency: Union[int, object] = values.unset, ) -> tuple: """ Internal helper for create operation @@ -859,6 +930,8 @@ def _create( "FriendlyName": friendly_name, "ActivitySid": activity_sid, "Attributes": attributes, + "OperatingUnitSid": operating_unit_sid, + "Concurrency": concurrency, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -876,6 +949,8 @@ def create( friendly_name: str, activity_sid: Union[str, object] = values.unset, attributes: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, + concurrency: Union[int, object] = values.unset, ) -> WorkerInstance: """ Create the WorkerInstance @@ -883,6 +958,8 @@ def create( :param friendly_name: A descriptive string that you create to describe the new Worker. It can be up to 64 characters long. :param activity_sid: The SID of a valid Activity that will describe the new Worker's initial state. See [Activities](https://www.twilio.com/docs/taskrouter/api/activity) for more information. If not provided, the new Worker's initial state is the `default_activity_sid` configured on the Workspace. :param attributes: A valid JSON string that describes the new Worker. For example: `{ \\\"email\\\": \\\"Bob@example.com\\\", \\\"phone\\\": \\\"+5095551234\\\" }`. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. Defaults to {}. + :param operating_unit_sid: The SID of the Operating Unit that the new Worker belongs to. + :param concurrency: The total number of Tasks that a Worker should handle for Attention Routing. TaskRouter creates reservations for Tasks up to the specified concurrency. To default to the Attention Profile's concurrency limit, use -1. :returns: The created WorkerInstance """ @@ -890,6 +967,8 @@ def create( friendly_name=friendly_name, activity_sid=activity_sid, attributes=attributes, + operating_unit_sid=operating_unit_sid, + concurrency=concurrency, ) return WorkerInstance( self._version, payload, workspace_sid=self._solution["workspace_sid"] @@ -900,6 +979,8 @@ def create_with_http_info( friendly_name: str, activity_sid: Union[str, object] = values.unset, attributes: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, + concurrency: Union[int, object] = values.unset, ) -> ApiResponse: """ Create the WorkerInstance and return response metadata @@ -907,6 +988,8 @@ def create_with_http_info( :param friendly_name: A descriptive string that you create to describe the new Worker. It can be up to 64 characters long. :param activity_sid: The SID of a valid Activity that will describe the new Worker's initial state. See [Activities](https://www.twilio.com/docs/taskrouter/api/activity) for more information. If not provided, the new Worker's initial state is the `default_activity_sid` configured on the Workspace. :param attributes: A valid JSON string that describes the new Worker. For example: `{ \\\"email\\\": \\\"Bob@example.com\\\", \\\"phone\\\": \\\"+5095551234\\\" }`. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. Defaults to {}. + :param operating_unit_sid: The SID of the Operating Unit that the new Worker belongs to. + :param concurrency: The total number of Tasks that a Worker should handle for Attention Routing. TaskRouter creates reservations for Tasks up to the specified concurrency. To default to the Attention Profile's concurrency limit, use -1. :returns: ApiResponse with instance, status code, and headers """ @@ -914,6 +997,8 @@ def create_with_http_info( friendly_name=friendly_name, activity_sid=activity_sid, attributes=attributes, + operating_unit_sid=operating_unit_sid, + concurrency=concurrency, ) instance = WorkerInstance( self._version, payload, workspace_sid=self._solution["workspace_sid"] @@ -925,6 +1010,8 @@ async def _create_async( friendly_name: str, activity_sid: Union[str, object] = values.unset, attributes: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, + concurrency: Union[int, object] = values.unset, ) -> tuple: """ Internal async helper for create operation @@ -938,6 +1025,8 @@ async def _create_async( "FriendlyName": friendly_name, "ActivitySid": activity_sid, "Attributes": attributes, + "OperatingUnitSid": operating_unit_sid, + "Concurrency": concurrency, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -955,6 +1044,8 @@ async def create_async( friendly_name: str, activity_sid: Union[str, object] = values.unset, attributes: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, + concurrency: Union[int, object] = values.unset, ) -> WorkerInstance: """ Asynchronously create the WorkerInstance @@ -962,6 +1053,8 @@ async def create_async( :param friendly_name: A descriptive string that you create to describe the new Worker. It can be up to 64 characters long. :param activity_sid: The SID of a valid Activity that will describe the new Worker's initial state. See [Activities](https://www.twilio.com/docs/taskrouter/api/activity) for more information. If not provided, the new Worker's initial state is the `default_activity_sid` configured on the Workspace. :param attributes: A valid JSON string that describes the new Worker. For example: `{ \\\"email\\\": \\\"Bob@example.com\\\", \\\"phone\\\": \\\"+5095551234\\\" }`. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. Defaults to {}. + :param operating_unit_sid: The SID of the Operating Unit that the new Worker belongs to. + :param concurrency: The total number of Tasks that a Worker should handle for Attention Routing. TaskRouter creates reservations for Tasks up to the specified concurrency. To default to the Attention Profile's concurrency limit, use -1. :returns: The created WorkerInstance """ @@ -969,6 +1062,8 @@ async def create_async( friendly_name=friendly_name, activity_sid=activity_sid, attributes=attributes, + operating_unit_sid=operating_unit_sid, + concurrency=concurrency, ) return WorkerInstance( self._version, payload, workspace_sid=self._solution["workspace_sid"] @@ -979,6 +1074,8 @@ async def create_with_http_info_async( friendly_name: str, activity_sid: Union[str, object] = values.unset, attributes: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, + concurrency: Union[int, object] = values.unset, ) -> ApiResponse: """ Asynchronously create the WorkerInstance and return response metadata @@ -986,6 +1083,8 @@ async def create_with_http_info_async( :param friendly_name: A descriptive string that you create to describe the new Worker. It can be up to 64 characters long. :param activity_sid: The SID of a valid Activity that will describe the new Worker's initial state. See [Activities](https://www.twilio.com/docs/taskrouter/api/activity) for more information. If not provided, the new Worker's initial state is the `default_activity_sid` configured on the Workspace. :param attributes: A valid JSON string that describes the new Worker. For example: `{ \\\"email\\\": \\\"Bob@example.com\\\", \\\"phone\\\": \\\"+5095551234\\\" }`. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. Defaults to {}. + :param operating_unit_sid: The SID of the Operating Unit that the new Worker belongs to. + :param concurrency: The total number of Tasks that a Worker should handle for Attention Routing. TaskRouter creates reservations for Tasks up to the specified concurrency. To default to the Attention Profile's concurrency limit, use -1. :returns: ApiResponse with instance, status code, and headers """ @@ -993,6 +1092,8 @@ async def create_with_http_info_async( friendly_name=friendly_name, activity_sid=activity_sid, attributes=attributes, + operating_unit_sid=operating_unit_sid, + concurrency=concurrency, ) instance = WorkerInstance( self._version, payload, workspace_sid=self._solution["workspace_sid"] @@ -1009,6 +1110,7 @@ def stream( task_queue_name: Union[str, object] = values.unset, task_queue_sid: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> Iterator[WorkerInstance]: @@ -1026,6 +1128,7 @@ def stream( :param str task_queue_name: The `friendly_name` of the TaskQueue that the Workers to read are eligible for. :param str task_queue_sid: The SID of the TaskQueue that the Workers to read are eligible for. :param str ordering: Sorting parameter for Workers + :param str operating_unit_sid: The SID of the Operating Unit with the Workers to read. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -1045,6 +1148,7 @@ def stream( task_queue_name=task_queue_name, task_queue_sid=task_queue_sid, ordering=ordering, + operating_unit_sid=operating_unit_sid, page_size=limits["page_size"], ) @@ -1060,6 +1164,7 @@ async def stream_async( task_queue_name: Union[str, object] = values.unset, task_queue_sid: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> AsyncIterator[WorkerInstance]: @@ -1077,6 +1182,7 @@ async def stream_async( :param str task_queue_name: The `friendly_name` of the TaskQueue that the Workers to read are eligible for. :param str task_queue_sid: The SID of the TaskQueue that the Workers to read are eligible for. :param str ordering: Sorting parameter for Workers + :param str operating_unit_sid: The SID of the Operating Unit with the Workers to read. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -1096,6 +1202,7 @@ async def stream_async( task_queue_name=task_queue_name, task_queue_sid=task_queue_sid, ordering=ordering, + operating_unit_sid=operating_unit_sid, page_size=limits["page_size"], ) @@ -1111,6 +1218,7 @@ def stream_with_http_info( task_queue_name: Union[str, object] = values.unset, task_queue_sid: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> tuple: @@ -1126,6 +1234,7 @@ def stream_with_http_info( :param str task_queue_name: The `friendly_name` of the TaskQueue that the Workers to read are eligible for. :param str task_queue_sid: The SID of the TaskQueue that the Workers to read are eligible for. :param str ordering: Sorting parameter for Workers + :param str operating_unit_sid: The SID of the Operating Unit with the Workers to read. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -1145,6 +1254,7 @@ def stream_with_http_info( task_queue_name=task_queue_name, task_queue_sid=task_queue_sid, ordering=ordering, + operating_unit_sid=operating_unit_sid, page_size=limits["page_size"], ) @@ -1161,6 +1271,7 @@ async def stream_with_http_info_async( task_queue_name: Union[str, object] = values.unset, task_queue_sid: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> tuple: @@ -1176,6 +1287,7 @@ async def stream_with_http_info_async( :param str task_queue_name: The `friendly_name` of the TaskQueue that the Workers to read are eligible for. :param str task_queue_sid: The SID of the TaskQueue that the Workers to read are eligible for. :param str ordering: Sorting parameter for Workers + :param str operating_unit_sid: The SID of the Operating Unit with the Workers to read. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -1195,6 +1307,7 @@ async def stream_with_http_info_async( task_queue_name=task_queue_name, task_queue_sid=task_queue_sid, ordering=ordering, + operating_unit_sid=operating_unit_sid, page_size=limits["page_size"], ) @@ -1211,6 +1324,7 @@ def list( task_queue_name: Union[str, object] = values.unset, task_queue_sid: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[WorkerInstance]: @@ -1227,6 +1341,7 @@ def list( :param str task_queue_name: The `friendly_name` of the TaskQueue that the Workers to read are eligible for. :param str task_queue_sid: The SID of the TaskQueue that the Workers to read are eligible for. :param str ordering: Sorting parameter for Workers + :param str operating_unit_sid: The SID of the Operating Unit with the Workers to read. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -1246,6 +1361,7 @@ def list( task_queue_name=task_queue_name, task_queue_sid=task_queue_sid, ordering=ordering, + operating_unit_sid=operating_unit_sid, limit=limit, page_size=page_size, ) @@ -1261,6 +1377,7 @@ async def list_async( task_queue_name: Union[str, object] = values.unset, task_queue_sid: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[WorkerInstance]: @@ -1277,6 +1394,7 @@ async def list_async( :param str task_queue_name: The `friendly_name` of the TaskQueue that the Workers to read are eligible for. :param str task_queue_sid: The SID of the TaskQueue that the Workers to read are eligible for. :param str ordering: Sorting parameter for Workers + :param str operating_unit_sid: The SID of the Operating Unit with the Workers to read. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -1297,6 +1415,7 @@ async def list_async( task_queue_name=task_queue_name, task_queue_sid=task_queue_sid, ordering=ordering, + operating_unit_sid=operating_unit_sid, limit=limit, page_size=page_size, ) @@ -1312,6 +1431,7 @@ def list_with_http_info( task_queue_name: Union[str, object] = values.unset, task_queue_sid: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> ApiResponse: @@ -1327,6 +1447,7 @@ def list_with_http_info( :param str task_queue_name: The `friendly_name` of the TaskQueue that the Workers to read are eligible for. :param str task_queue_sid: The SID of the TaskQueue that the Workers to read are eligible for. :param str ordering: Sorting parameter for Workers + :param str operating_unit_sid: The SID of the Operating Unit with the Workers to read. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -1345,6 +1466,7 @@ def list_with_http_info( task_queue_name=task_queue_name, task_queue_sid=task_queue_sid, ordering=ordering, + operating_unit_sid=operating_unit_sid, limit=limit, page_size=page_size, ) @@ -1361,6 +1483,7 @@ async def list_with_http_info_async( task_queue_name: Union[str, object] = values.unset, task_queue_sid: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> ApiResponse: @@ -1376,6 +1499,7 @@ async def list_with_http_info_async( :param str task_queue_name: The `friendly_name` of the TaskQueue that the Workers to read are eligible for. :param str task_queue_sid: The SID of the TaskQueue that the Workers to read are eligible for. :param str ordering: Sorting parameter for Workers + :param str operating_unit_sid: The SID of the Operating Unit with the Workers to read. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -1394,6 +1518,7 @@ async def list_with_http_info_async( task_queue_name=task_queue_name, task_queue_sid=task_queue_sid, ordering=ordering, + operating_unit_sid=operating_unit_sid, limit=limit, page_size=page_size, ) @@ -1410,6 +1535,7 @@ def page( task_queue_name: Union[str, object] = values.unset, task_queue_sid: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -1426,6 +1552,7 @@ def page( :param task_queue_name: The `friendly_name` of the TaskQueue that the Workers to read are eligible for. :param task_queue_sid: The SID of the TaskQueue that the Workers to read are eligible for. :param ordering: Sorting parameter for Workers + :param operating_unit_sid: The SID of the Operating Unit with the Workers to read. :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 @@ -1442,6 +1569,7 @@ def page( "TaskQueueName": task_queue_name, "TaskQueueSid": task_queue_sid, "Ordering": ordering, + "OperatingUnitSid": operating_unit_sid, "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -1467,6 +1595,7 @@ async def page_async( task_queue_name: Union[str, object] = values.unset, task_queue_sid: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -1483,6 +1612,7 @@ async def page_async( :param task_queue_name: The `friendly_name` of the TaskQueue that the Workers to read are eligible for. :param task_queue_sid: The SID of the TaskQueue that the Workers to read are eligible for. :param ordering: Sorting parameter for Workers + :param operating_unit_sid: The SID of the Operating Unit with the Workers to read. :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 @@ -1499,6 +1629,7 @@ async def page_async( "TaskQueueName": task_queue_name, "TaskQueueSid": task_queue_sid, "Ordering": ordering, + "OperatingUnitSid": operating_unit_sid, "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -1524,6 +1655,7 @@ def page_with_http_info( task_queue_name: Union[str, object] = values.unset, task_queue_sid: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -1540,6 +1672,7 @@ def page_with_http_info( :param task_queue_name: The `friendly_name` of the TaskQueue that the Workers to read are eligible for. :param task_queue_sid: The SID of the TaskQueue that the Workers to read are eligible for. :param ordering: Sorting parameter for Workers + :param operating_unit_sid: The SID of the Operating Unit with the Workers to read. :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 @@ -1556,6 +1689,7 @@ def page_with_http_info( "TaskQueueName": task_queue_name, "TaskQueueSid": task_queue_sid, "Ordering": ordering, + "OperatingUnitSid": operating_unit_sid, "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -1582,6 +1716,7 @@ async def page_with_http_info_async( task_queue_name: Union[str, object] = values.unset, task_queue_sid: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, + operating_unit_sid: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -1598,6 +1733,7 @@ async def page_with_http_info_async( :param task_queue_name: The `friendly_name` of the TaskQueue that the Workers to read are eligible for. :param task_queue_sid: The SID of the TaskQueue that the Workers to read are eligible for. :param ordering: Sorting parameter for Workers + :param operating_unit_sid: The SID of the Operating Unit with the Workers to read. :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 @@ -1614,6 +1750,7 @@ async def page_with_http_info_async( "TaskQueueName": task_queue_name, "TaskQueueSid": task_queue_sid, "Ordering": ordering, + "OperatingUnitSid": operating_unit_sid, "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -1624,10 +1761,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = WorkerPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/taskrouter/v1/workspace/worker/reservation.py b/twilio/rest/taskrouter/v1/workspace/worker/reservation.py index 3155f7efe..3ac63b175 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/reservation.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/reservation.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class ReservationInstance(InstanceResource): - class CallStatus(object): INITIATED = "initiated" RINGING = "ringing" @@ -62,6 +62,7 @@ class Status(object): :ivar workspace_sid: The SID of the Workspace that this worker is contained within. :ivar url: The absolute URL of the WorkerReservation resource. :ivar links: The URLs of related resources. + :ivar attention: The attention consumed for the reservation. """ def __init__( @@ -91,6 +92,7 @@ def __init__( self.workspace_sid: Optional[str] = payload.get("workspace_sid") self.url: Optional[str] = payload.get("url") self.links: Optional[Dict[str, object]] = payload.get("links") + self.attention: Optional[int] = deserialize.integer(payload.get("attention")) self._solution = { "workspace_sid": workspace_sid, @@ -210,6 +212,8 @@ def update( post_work_activity_sid: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, jitter_buffer_size: Union[str, object] = values.unset, ) -> "ReservationInstance": """ @@ -267,6 +271,8 @@ def update( :param post_work_activity_sid: The new worker activity SID after executing a Conference instruction. :param end_conference_on_customer_exit: Whether to end the conference when the customer leaves. :param beep_on_customer_entrance: Whether to play a notification beep when the customer joins. + :param transcribe: Whether to transcribe the call recording. The default is `false`. + :param transcription_configuration: The SID or (unique) friendly name of the transcription configuration object to use for transcribing. :param jitter_buffer_size: The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. :returns: The updated ReservationInstance @@ -324,6 +330,8 @@ def update( post_work_activity_sid=post_work_activity_sid, end_conference_on_customer_exit=end_conference_on_customer_exit, beep_on_customer_entrance=beep_on_customer_entrance, + transcribe=transcribe, + transcription_configuration=transcription_configuration, jitter_buffer_size=jitter_buffer_size, ) @@ -385,6 +393,8 @@ async def update_async( post_work_activity_sid: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, jitter_buffer_size: Union[str, object] = values.unset, ) -> "ReservationInstance": """ @@ -442,6 +452,8 @@ async def update_async( :param post_work_activity_sid: The new worker activity SID after executing a Conference instruction. :param end_conference_on_customer_exit: Whether to end the conference when the customer leaves. :param beep_on_customer_entrance: Whether to play a notification beep when the customer joins. + :param transcribe: Whether to transcribe the call recording. The default is `false`. + :param transcription_configuration: The SID or (unique) friendly name of the transcription configuration object to use for transcribing. :param jitter_buffer_size: The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. :returns: The updated ReservationInstance @@ -499,6 +511,8 @@ async def update_async( post_work_activity_sid=post_work_activity_sid, end_conference_on_customer_exit=end_conference_on_customer_exit, beep_on_customer_entrance=beep_on_customer_entrance, + transcribe=transcribe, + transcription_configuration=transcription_configuration, jitter_buffer_size=jitter_buffer_size, ) @@ -560,6 +574,8 @@ def update_with_http_info( post_work_activity_sid: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, jitter_buffer_size: Union[str, object] = values.unset, ) -> ApiResponse: """ @@ -617,6 +633,8 @@ def update_with_http_info( :param post_work_activity_sid: The new worker activity SID after executing a Conference instruction. :param end_conference_on_customer_exit: Whether to end the conference when the customer leaves. :param beep_on_customer_entrance: Whether to play a notification beep when the customer joins. + :param transcribe: Whether to transcribe the call recording. The default is `false`. + :param transcription_configuration: The SID or (unique) friendly name of the transcription configuration object to use for transcribing. :param jitter_buffer_size: The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. :returns: ApiResponse with instance, status code, and headers @@ -674,6 +692,8 @@ def update_with_http_info( post_work_activity_sid=post_work_activity_sid, end_conference_on_customer_exit=end_conference_on_customer_exit, beep_on_customer_entrance=beep_on_customer_entrance, + transcribe=transcribe, + transcription_configuration=transcription_configuration, jitter_buffer_size=jitter_buffer_size, ) @@ -735,6 +755,8 @@ async def update_with_http_info_async( post_work_activity_sid: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, jitter_buffer_size: Union[str, object] = values.unset, ) -> ApiResponse: """ @@ -792,6 +814,8 @@ async def update_with_http_info_async( :param post_work_activity_sid: The new worker activity SID after executing a Conference instruction. :param end_conference_on_customer_exit: Whether to end the conference when the customer leaves. :param beep_on_customer_entrance: Whether to play a notification beep when the customer joins. + :param transcribe: Whether to transcribe the call recording. The default is `false`. + :param transcription_configuration: The SID or (unique) friendly name of the transcription configuration object to use for transcribing. :param jitter_buffer_size: The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. :returns: ApiResponse with instance, status code, and headers @@ -849,6 +873,8 @@ async def update_with_http_info_async( post_work_activity_sid=post_work_activity_sid, end_conference_on_customer_exit=end_conference_on_customer_exit, beep_on_customer_entrance=beep_on_customer_entrance, + transcribe=transcribe, + transcription_configuration=transcription_configuration, jitter_buffer_size=jitter_buffer_size, ) @@ -863,7 +889,6 @@ def __repr__(self) -> str: class ReservationContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str, worker_sid: str, sid: str): """ Initialize the ReservationContext @@ -1041,6 +1066,8 @@ def _update( post_work_activity_sid: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, jitter_buffer_size: Union[str, object] = values.unset, ) -> tuple: """ @@ -1117,6 +1144,8 @@ def _update( "BeepOnCustomerEntrance": serialize.boolean_to_string( beep_on_customer_entrance ), + "Transcribe": serialize.boolean_to_string(transcribe), + "TranscriptionConfiguration": transcription_configuration, "JitterBufferSize": jitter_buffer_size, } ) @@ -1193,6 +1222,8 @@ def update( post_work_activity_sid: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, jitter_buffer_size: Union[str, object] = values.unset, ) -> ReservationInstance: """ @@ -1250,6 +1281,8 @@ def update( :param post_work_activity_sid: The new worker activity SID after executing a Conference instruction. :param end_conference_on_customer_exit: Whether to end the conference when the customer leaves. :param beep_on_customer_entrance: Whether to play a notification beep when the customer joins. + :param transcribe: Whether to transcribe the call recording. The default is `false`. + :param transcription_configuration: The SID or (unique) friendly name of the transcription configuration object to use for transcribing. :param jitter_buffer_size: The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. :returns: The updated ReservationInstance @@ -1307,6 +1340,8 @@ def update( post_work_activity_sid=post_work_activity_sid, end_conference_on_customer_exit=end_conference_on_customer_exit, beep_on_customer_entrance=beep_on_customer_entrance, + transcribe=transcribe, + transcription_configuration=transcription_configuration, jitter_buffer_size=jitter_buffer_size, ) return ReservationInstance( @@ -1375,6 +1410,8 @@ def update_with_http_info( post_work_activity_sid: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, jitter_buffer_size: Union[str, object] = values.unset, ) -> ApiResponse: """ @@ -1432,6 +1469,8 @@ def update_with_http_info( :param post_work_activity_sid: The new worker activity SID after executing a Conference instruction. :param end_conference_on_customer_exit: Whether to end the conference when the customer leaves. :param beep_on_customer_entrance: Whether to play a notification beep when the customer joins. + :param transcribe: Whether to transcribe the call recording. The default is `false`. + :param transcription_configuration: The SID or (unique) friendly name of the transcription configuration object to use for transcribing. :param jitter_buffer_size: The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. :returns: ApiResponse with instance, status code, and headers @@ -1489,6 +1528,8 @@ def update_with_http_info( post_work_activity_sid=post_work_activity_sid, end_conference_on_customer_exit=end_conference_on_customer_exit, beep_on_customer_entrance=beep_on_customer_entrance, + transcribe=transcribe, + transcription_configuration=transcription_configuration, jitter_buffer_size=jitter_buffer_size, ) instance = ReservationInstance( @@ -1558,6 +1599,8 @@ async def _update_async( post_work_activity_sid: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, jitter_buffer_size: Union[str, object] = values.unset, ) -> tuple: """ @@ -1634,6 +1677,8 @@ async def _update_async( "BeepOnCustomerEntrance": serialize.boolean_to_string( beep_on_customer_entrance ), + "Transcribe": serialize.boolean_to_string(transcribe), + "TranscriptionConfiguration": transcription_configuration, "JitterBufferSize": jitter_buffer_size, } ) @@ -1710,6 +1755,8 @@ async def update_async( post_work_activity_sid: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, jitter_buffer_size: Union[str, object] = values.unset, ) -> ReservationInstance: """ @@ -1767,6 +1814,8 @@ async def update_async( :param post_work_activity_sid: The new worker activity SID after executing a Conference instruction. :param end_conference_on_customer_exit: Whether to end the conference when the customer leaves. :param beep_on_customer_entrance: Whether to play a notification beep when the customer joins. + :param transcribe: Whether to transcribe the call recording. The default is `false`. + :param transcription_configuration: The SID or (unique) friendly name of the transcription configuration object to use for transcribing. :param jitter_buffer_size: The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. :returns: The updated ReservationInstance @@ -1824,6 +1873,8 @@ async def update_async( post_work_activity_sid=post_work_activity_sid, end_conference_on_customer_exit=end_conference_on_customer_exit, beep_on_customer_entrance=beep_on_customer_entrance, + transcribe=transcribe, + transcription_configuration=transcription_configuration, jitter_buffer_size=jitter_buffer_size, ) return ReservationInstance( @@ -1892,6 +1943,8 @@ async def update_with_http_info_async( post_work_activity_sid: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, + transcribe: Union[bool, object] = values.unset, + transcription_configuration: Union[str, object] = values.unset, jitter_buffer_size: Union[str, object] = values.unset, ) -> ApiResponse: """ @@ -1949,6 +2002,8 @@ async def update_with_http_info_async( :param post_work_activity_sid: The new worker activity SID after executing a Conference instruction. :param end_conference_on_customer_exit: Whether to end the conference when the customer leaves. :param beep_on_customer_entrance: Whether to play a notification beep when the customer joins. + :param transcribe: Whether to transcribe the call recording. The default is `false`. + :param transcription_configuration: The SID or (unique) friendly name of the transcription configuration object to use for transcribing. :param jitter_buffer_size: The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. :returns: ApiResponse with instance, status code, and headers @@ -2006,6 +2061,8 @@ async def update_with_http_info_async( post_work_activity_sid=post_work_activity_sid, end_conference_on_customer_exit=end_conference_on_customer_exit, beep_on_customer_entrance=beep_on_customer_entrance, + transcribe=transcribe, + transcription_configuration=transcription_configuration, jitter_buffer_size=jitter_buffer_size, ) instance = ReservationInstance( @@ -2028,7 +2085,6 @@ def __repr__(self) -> str: class ReservationPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ReservationInstance: """ Build an instance of ReservationInstance @@ -2052,7 +2108,6 @@ def __repr__(self) -> str: class ReservationList(ListResource): - def __init__(self, version: Version, workspace_sid: str, worker_sid: str): """ Initialize the ReservationList @@ -2444,10 +2499,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ReservationPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py b/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py index 60eb7ddee..9f12e4181 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class WorkerChannelInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. :ivar assigned_tasks: The total number of Tasks assigned to Worker for the TaskChannel type. @@ -219,7 +221,6 @@ def __repr__(self) -> str: class WorkerChannelContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str, worker_sid: str, sid: str): """ Initialize the WorkerChannelContext @@ -502,7 +503,6 @@ def __repr__(self) -> str: class WorkerChannelPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> WorkerChannelInstance: """ Build an instance of WorkerChannelInstance @@ -526,7 +526,6 @@ def __repr__(self) -> str: class WorkerChannelList(ListResource): - def __init__(self, version: Version, workspace_sid: str, worker_sid: str): """ Initialize the WorkerChannelList @@ -878,10 +877,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = WorkerChannelPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py index 718cdf9d5..f6e4640b1 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import serialize, values @@ -23,6 +24,7 @@ class WorkerStatisticsInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. :ivar cumulative: An object that contains the cumulative statistics for the Worker. @@ -175,7 +177,6 @@ def __repr__(self) -> str: class WorkerStatisticsContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str, worker_sid: str): """ Initialize the WorkerStatisticsContext @@ -392,7 +393,6 @@ def __repr__(self) -> str: class WorkerStatisticsList(ListResource): - def __init__(self, version: Version, workspace_sid: str, worker_sid: str): """ Initialize the WorkerStatisticsList diff --git a/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py index bcc02099b..e497c6468 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, List, Optional, Union from twilio.base import deserialize, serialize, values @@ -23,6 +24,7 @@ class WorkersCumulativeStatisticsInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. :ivar start_time: The beginning of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. @@ -201,7 +203,6 @@ def __repr__(self) -> str: class WorkersCumulativeStatisticsContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkersCumulativeStatisticsContext @@ -412,7 +413,6 @@ def __repr__(self) -> str: class WorkersCumulativeStatisticsList(ListResource): - def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkersCumulativeStatisticsList diff --git a/twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py index 4c446865e..08ac30542 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union from twilio.base import deserialize, values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class WorkersRealTimeStatisticsInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. :ivar activity_statistics: The number of current Workers by Activity. @@ -132,7 +134,6 @@ def __repr__(self) -> str: class WorkersRealTimeStatisticsContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkersRealTimeStatisticsContext @@ -281,7 +282,6 @@ def __repr__(self) -> str: class WorkersRealTimeStatisticsList(ListResource): - def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkersRealTimeStatisticsList diff --git a/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py index 8aa007fa7..8bdad52e1 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import serialize, values @@ -23,6 +24,7 @@ class WorkersStatisticsInstance(InstanceResource): + """ :ivar realtime: An object that contains the real-time statistics for the Worker. :ivar cumulative: An object that contains the cumulative statistics for the Worker. @@ -203,7 +205,6 @@ def __repr__(self) -> str: class WorkersStatisticsContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkersStatisticsContext @@ -460,7 +461,6 @@ def __repr__(self) -> str: class WorkersStatisticsList(ListResource): - def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkersStatisticsList diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py b/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py index 64e58db08..dc69b7698 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py @@ -12,6 +12,7 @@ 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 @@ -33,6 +34,7 @@ class WorkflowInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workflow resource. :ivar assignment_callback_url: The URL that we call when a task managed by the Workflow is assigned to a Worker. See Assignment Callback URL for more information. @@ -328,7 +330,6 @@ def __repr__(self) -> str: class WorkflowContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str, sid: str): """ Initialize the WorkflowContext @@ -782,7 +783,6 @@ def __repr__(self) -> str: class WorkflowPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> WorkflowInstance: """ Build an instance of WorkflowInstance @@ -803,7 +803,6 @@ def __repr__(self) -> str: class WorkflowList(ListResource): - def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkflowList @@ -1377,10 +1376,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = WorkflowPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py index 5ea359e14..c7023ec6a 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, serialize, values @@ -23,6 +24,7 @@ class WorkflowCumulativeStatisticsInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workflow resource. :ivar avg_task_acceptance_time: The average time in seconds between Task creation and acceptance. @@ -259,7 +261,6 @@ def __repr__(self) -> str: class WorkflowCumulativeStatisticsContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str, workflow_sid: str): """ Initialize the WorkflowCumulativeStatisticsContext @@ -492,7 +493,6 @@ def __repr__(self) -> str: class WorkflowCumulativeStatisticsList(ListResource): - def __init__(self, version: Version, workspace_sid: str, workflow_sid: str): """ Initialize the WorkflowCumulativeStatisticsList diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py index 815433be2..8b37374ed 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import deserialize, values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class WorkflowRealTimeStatisticsInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workflow resource. :ivar longest_task_waiting_age: The age of the longest waiting Task. @@ -154,7 +156,6 @@ def __repr__(self) -> str: class WorkflowRealTimeStatisticsContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str, workflow_sid: str): """ Initialize the WorkflowRealTimeStatisticsContext @@ -309,7 +310,6 @@ def __repr__(self) -> str: class WorkflowRealTimeStatisticsList(ListResource): - def __init__(self, version: Version, workspace_sid: str, workflow_sid: str): """ Initialize the WorkflowRealTimeStatisticsList diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py index 6b60917d1..86ba0ea3a 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import serialize, values @@ -23,6 +24,7 @@ class WorkflowStatisticsInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workflow resource. :ivar cumulative: An object that contains the cumulative statistics for the Workflow. @@ -189,7 +191,6 @@ def __repr__(self) -> str: class WorkflowStatisticsContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str, workflow_sid: str): """ Initialize the WorkflowStatisticsContext @@ -422,7 +423,6 @@ def __repr__(self) -> str: class WorkflowStatisticsList(ListResource): - def __init__(self, version: Version, workspace_sid: str, workflow_sid: str): """ Initialize the WorkflowStatisticsList diff --git a/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py index c85b319e6..1bee00186 100644 --- a/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, serialize, values @@ -23,6 +24,7 @@ class WorkspaceCumulativeStatisticsInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workspace resource. :ivar avg_task_acceptance_time: The average time in seconds between Task creation and acceptance. @@ -249,7 +251,6 @@ def __repr__(self) -> str: class WorkspaceCumulativeStatisticsContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkspaceCumulativeStatisticsContext @@ -476,7 +477,6 @@ def __repr__(self) -> str: class WorkspaceCumulativeStatisticsList(ListResource): - def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkspaceCumulativeStatisticsList diff --git a/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py index 1b2f5c3f9..15ab4732b 100644 --- a/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union from twilio.base import deserialize, values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class WorkspaceRealTimeStatisticsInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workspace resource. :ivar activity_statistics: The number of current Workers by Activity. @@ -152,7 +154,6 @@ def __repr__(self) -> str: class WorkspaceRealTimeStatisticsContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkspaceRealTimeStatisticsContext @@ -301,7 +302,6 @@ def __repr__(self) -> str: class WorkspaceRealTimeStatisticsList(ListResource): - def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkspaceRealTimeStatisticsList diff --git a/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py b/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py index d42a3f384..f285ca7a6 100644 --- a/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import serialize, values @@ -23,6 +24,7 @@ class WorkspaceStatisticsInstance(InstanceResource): + """ :ivar realtime: An object that contains the real-time statistics for the Workspace. :ivar cumulative: An object that contains the cumulative statistics for the Workspace. @@ -179,7 +181,6 @@ def __repr__(self) -> str: class WorkspaceStatisticsContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkspaceStatisticsContext @@ -402,7 +403,6 @@ def __repr__(self) -> str: class WorkspaceStatisticsList(ListResource): - def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkspaceStatisticsList diff --git a/twilio/rest/trunking/TrunkingBase.py b/twilio/rest/trunking/TrunkingBase.py index bed8f9a2a..627790454 100644 --- a/twilio/rest/trunking/TrunkingBase.py +++ b/twilio/rest/trunking/TrunkingBase.py @@ -17,7 +17,6 @@ class TrunkingBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Trunking Domain diff --git a/twilio/rest/trunking/v1/__init__.py b/twilio/rest/trunking/v1/__init__.py index af530b97c..89dc5c108 100644 --- a/twilio/rest/trunking/v1/__init__.py +++ b/twilio/rest/trunking/v1/__init__.py @@ -19,7 +19,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Trunking diff --git a/twilio/rest/trunking/v1/trunk/__init__.py b/twilio/rest/trunking/v1/trunk/__init__.py index fa5eefc10..e4cbf3f08 100644 --- a/twilio/rest/trunking/v1/trunk/__init__.py +++ b/twilio/rest/trunking/v1/trunk/__init__.py @@ -12,6 +12,7 @@ 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 @@ -29,7 +30,6 @@ class TrunkInstance(InstanceResource): - class TransferCallerId(object): FROM_TRANSFEREE = "from-transferee" FROM_TRANSFEROR = "from-transferor" @@ -77,9 +77,9 @@ def __init__( self.transfer_mode: Optional["TrunkInstance.TransferSetting"] = payload.get( "transfer_mode" ) - self.transfer_caller_id: Optional["TrunkInstance.TransferCallerId"] = ( - payload.get("transfer_caller_id") - ) + self.transfer_caller_id: Optional[ + "TrunkInstance.TransferCallerId" + ] = payload.get("transfer_caller_id") 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( @@ -386,7 +386,6 @@ def __repr__(self) -> str: class TrunkContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the TrunkContext @@ -879,7 +878,6 @@ def __repr__(self) -> str: class TrunkPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> TrunkInstance: """ Build an instance of TrunkInstance @@ -898,7 +896,6 @@ def __repr__(self) -> str: class TrunkList(ListResource): - def __init__(self, version: Version): """ Initialize the TrunkList @@ -1483,10 +1480,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = TrunkPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/trunking/v1/trunk/credential_list.py b/twilio/rest/trunking/v1/trunk/credential_list.py index bbd754e8a..4f624313f 100644 --- a/twilio/rest/trunking/v1/trunk/credential_list.py +++ b/twilio/rest/trunking/v1/trunk/credential_list.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class CredentialListInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialList resource. :ivar sid: The unique string that we created to identify the CredentialList resource. @@ -160,7 +162,6 @@ def __repr__(self) -> str: class CredentialListContext(InstanceContext): - def __init__(self, version: Version, trunk_sid: str, sid: str): """ Initialize the CredentialListContext @@ -351,7 +352,6 @@ def __repr__(self) -> str: class CredentialListPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> CredentialListInstance: """ Build an instance of CredentialListInstance @@ -372,7 +372,6 @@ def __repr__(self) -> str: class CredentialListList(ListResource): - def __init__(self, version: Version, trunk_sid: str): """ Initialize the CredentialListList @@ -828,10 +827,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CredentialListPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/trunking/v1/trunk/ip_access_control_list.py b/twilio/rest/trunking/v1/trunk/ip_access_control_list.py index 8d48ec5fa..377dc407a 100644 --- a/twilio/rest/trunking/v1/trunk/ip_access_control_list.py +++ b/twilio/rest/trunking/v1/trunk/ip_access_control_list.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class IpAccessControlListInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IpAccessControlList resource. :ivar sid: The unique string that we created to identify the IpAccessControlList resource. @@ -160,7 +162,6 @@ def __repr__(self) -> str: class IpAccessControlListContext(InstanceContext): - def __init__(self, version: Version, trunk_sid: str, sid: str): """ Initialize the IpAccessControlListContext @@ -353,7 +354,6 @@ def __repr__(self) -> str: class IpAccessControlListPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> IpAccessControlListInstance: """ Build an instance of IpAccessControlListInstance @@ -374,7 +374,6 @@ def __repr__(self) -> str: class IpAccessControlListList(ListResource): - def __init__(self, version: Version, trunk_sid: str): """ Initialize the IpAccessControlListList @@ -834,10 +833,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = IpAccessControlListPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/trunking/v1/trunk/origination_url.py b/twilio/rest/trunking/v1/trunk/origination_url.py index 7896b96a0..514bcd6f7 100644 --- a/twilio/rest/trunking/v1/trunk/origination_url.py +++ b/twilio/rest/trunking/v1/trunk/origination_url.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class OriginationUrlInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the OriginationUrl resource. :ivar sid: The unique string that we created to identify the OriginationUrl resource. @@ -276,7 +278,6 @@ def __repr__(self) -> str: class OriginationUrlContext(InstanceContext): - def __init__(self, version: Version, trunk_sid: str, sid: str): """ Initialize the OriginationUrlContext @@ -669,7 +670,6 @@ def __repr__(self) -> str: class OriginationUrlPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> OriginationUrlInstance: """ Build an instance of OriginationUrlInstance @@ -690,7 +690,6 @@ def __repr__(self) -> str: class OriginationUrlList(ListResource): - def __init__(self, version: Version, trunk_sid: str): """ Initialize the OriginationUrlList @@ -1228,10 +1227,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = OriginationUrlPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/trunking/v1/trunk/phone_number.py b/twilio/rest/trunking/v1/trunk/phone_number.py index 405cc953b..b2988bdb9 100644 --- a/twilio/rest/trunking/v1/trunk/phone_number.py +++ b/twilio/rest/trunking/v1/trunk/phone_number.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class PhoneNumberInstance(InstanceResource): - class AddressRequirement(object): NONE = "none" ANY = "any" @@ -211,7 +211,6 @@ def __repr__(self) -> str: class PhoneNumberContext(InstanceContext): - def __init__(self, version: Version, trunk_sid: str, sid: str): """ Initialize the PhoneNumberContext @@ -402,7 +401,6 @@ def __repr__(self) -> str: class PhoneNumberPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> PhoneNumberInstance: """ Build an instance of PhoneNumberInstance @@ -423,7 +421,6 @@ def __repr__(self) -> str: class PhoneNumberList(ListResource): - def __init__(self, version: Version, trunk_sid: str): """ Initialize the PhoneNumberList @@ -873,10 +870,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = PhoneNumberPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/trunking/v1/trunk/recording.py b/twilio/rest/trunking/v1/trunk/recording.py index 0886654a4..c3fc05633 100644 --- a/twilio/rest/trunking/v1/trunk/recording.py +++ b/twilio/rest/trunking/v1/trunk/recording.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,7 +23,6 @@ class RecordingInstance(InstanceResource): - class RecordingMode(object): DO_NOT_RECORD = "do-not-record" RECORD_FROM_RINGING = "record-from-ringing" @@ -184,7 +184,6 @@ def __repr__(self) -> str: class RecordingContext(InstanceContext): - def __init__(self, version: Version, trunk_sid: str): """ Initialize the RecordingContext @@ -431,7 +430,6 @@ def __repr__(self) -> str: class RecordingList(ListResource): - def __init__(self, version: Version, trunk_sid: str): """ Initialize the RecordingList diff --git a/twilio/rest/trusthub/TrusthubBase.py b/twilio/rest/trusthub/TrusthubBase.py index 97fd32f9b..f58cc7cfe 100644 --- a/twilio/rest/trusthub/TrusthubBase.py +++ b/twilio/rest/trusthub/TrusthubBase.py @@ -17,7 +17,6 @@ class TrusthubBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Trusthub Domain diff --git a/twilio/rest/trusthub/v1/__init__.py b/twilio/rest/trusthub/v1/__init__.py index 596c5ea75..2bca6fcd7 100644 --- a/twilio/rest/trusthub/v1/__init__.py +++ b/twilio/rest/trusthub/v1/__init__.py @@ -15,24 +15,41 @@ from typing import Optional from twilio.base.version import Version from twilio.base.domain import Domain +from twilio.rest.trusthub.v1.branded_calling import BrandedCallingList +from twilio.rest.trusthub.v1.bulk_regulated_items import BulkRegulatedItemsList +from twilio.rest.trusthub.v1.bundle_items_details import BundleItemsDetailsList from twilio.rest.trusthub.v1.compliance_inquiries import ComplianceInquiriesList +from twilio.rest.trusthub.v1.compliance_inquiry_individual import ( + ComplianceInquiryIndividualList, +) from twilio.rest.trusthub.v1.compliance_registration_inquiries import ( ComplianceRegistrationInquiriesList, ) +from twilio.rest.trusthub.v1.compliance_registrations_compliance_item import ( + ComplianceRegistrationsComplianceItemList, +) from twilio.rest.trusthub.v1.compliance_tollfree_inquiries import ( ComplianceTollfreeInquiriesList, ) +from twilio.rest.trusthub.v1.compliance_upgrade_individual import ( + ComplianceUpgradeIndividualList, +) from twilio.rest.trusthub.v1.customer_profiles import CustomerProfilesList +from twilio.rest.trusthub.v1.customer_profiles_provisional_copy import ( + CustomerProfilesProvisionalCopyList, +) from twilio.rest.trusthub.v1.end_user import EndUserList from twilio.rest.trusthub.v1.end_user_type import EndUserTypeList from twilio.rest.trusthub.v1.policies import PoliciesList from twilio.rest.trusthub.v1.supporting_document import SupportingDocumentList from twilio.rest.trusthub.v1.supporting_document_type import SupportingDocumentTypeList from twilio.rest.trusthub.v1.trust_products import TrustProductsList +from twilio.rest.trusthub.v1.trust_products_provisional_copy import ( + TrustProductsProvisionalCopyList, +) class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Trusthub @@ -40,20 +57,56 @@ def __init__(self, domain: Domain): :param domain: The Twilio.trusthub domain """ super().__init__(domain, "v1") + self._branded_calling: Optional[BrandedCallingList] = None + self._bulk_regulated_items: Optional[BulkRegulatedItemsList] = None + self._bundle_items_details: Optional[BundleItemsDetailsList] = None self._compliance_inquiries: Optional[ComplianceInquiriesList] = None + self._compliance_inquiry_individual: Optional[ + ComplianceInquiryIndividualList + ] = None self._compliance_registration_inquiries: Optional[ ComplianceRegistrationInquiriesList ] = None + self._compliance_registrations_compliance_item: Optional[ + ComplianceRegistrationsComplianceItemList + ] = None self._compliance_tollfree_inquiries: Optional[ ComplianceTollfreeInquiriesList ] = None + self._compliance_upgrade_individual: Optional[ + ComplianceUpgradeIndividualList + ] = None self._customer_profiles: Optional[CustomerProfilesList] = None + self._customer_profiles_provisional_copy: Optional[ + CustomerProfilesProvisionalCopyList + ] = None self._end_users: Optional[EndUserList] = None self._end_user_types: Optional[EndUserTypeList] = None self._policies: Optional[PoliciesList] = None self._supporting_documents: Optional[SupportingDocumentList] = None self._supporting_document_types: Optional[SupportingDocumentTypeList] = None self._trust_products: Optional[TrustProductsList] = None + self._trust_products_provisional_copy: Optional[ + TrustProductsProvisionalCopyList + ] = None + + @property + def branded_calling(self) -> BrandedCallingList: + if self._branded_calling is None: + self._branded_calling = BrandedCallingList(self) + return self._branded_calling + + @property + def bulk_regulated_items(self) -> BulkRegulatedItemsList: + if self._bulk_regulated_items is None: + self._bulk_regulated_items = BulkRegulatedItemsList(self) + return self._bulk_regulated_items + + @property + def bundle_items_details(self) -> BundleItemsDetailsList: + if self._bundle_items_details is None: + self._bundle_items_details = BundleItemsDetailsList(self) + return self._bundle_items_details @property def compliance_inquiries(self) -> ComplianceInquiriesList: @@ -61,6 +114,12 @@ def compliance_inquiries(self) -> ComplianceInquiriesList: self._compliance_inquiries = ComplianceInquiriesList(self) return self._compliance_inquiries + @property + def compliance_inquiry_individual(self) -> ComplianceInquiryIndividualList: + if self._compliance_inquiry_individual is None: + self._compliance_inquiry_individual = ComplianceInquiryIndividualList(self) + return self._compliance_inquiry_individual + @property def compliance_registration_inquiries(self) -> ComplianceRegistrationInquiriesList: if self._compliance_registration_inquiries is None: @@ -69,18 +128,42 @@ def compliance_registration_inquiries(self) -> ComplianceRegistrationInquiriesLi ) return self._compliance_registration_inquiries + @property + def compliance_registrations_compliance_item( + self, + ) -> ComplianceRegistrationsComplianceItemList: + if self._compliance_registrations_compliance_item is None: + self._compliance_registrations_compliance_item = ( + ComplianceRegistrationsComplianceItemList(self) + ) + return self._compliance_registrations_compliance_item + @property def compliance_tollfree_inquiries(self) -> ComplianceTollfreeInquiriesList: if self._compliance_tollfree_inquiries is None: self._compliance_tollfree_inquiries = ComplianceTollfreeInquiriesList(self) return self._compliance_tollfree_inquiries + @property + def compliance_upgrade_individual(self) -> ComplianceUpgradeIndividualList: + if self._compliance_upgrade_individual is None: + self._compliance_upgrade_individual = ComplianceUpgradeIndividualList(self) + return self._compliance_upgrade_individual + @property def customer_profiles(self) -> CustomerProfilesList: if self._customer_profiles is None: self._customer_profiles = CustomerProfilesList(self) return self._customer_profiles + @property + def customer_profiles_provisional_copy(self) -> CustomerProfilesProvisionalCopyList: + if self._customer_profiles_provisional_copy is None: + self._customer_profiles_provisional_copy = ( + CustomerProfilesProvisionalCopyList(self) + ) + return self._customer_profiles_provisional_copy + @property def end_users(self) -> EndUserList: if self._end_users is None: @@ -117,6 +200,14 @@ def trust_products(self) -> TrustProductsList: self._trust_products = TrustProductsList(self) return self._trust_products + @property + def trust_products_provisional_copy(self) -> TrustProductsProvisionalCopyList: + if self._trust_products_provisional_copy is None: + self._trust_products_provisional_copy = TrustProductsProvisionalCopyList( + self + ) + return self._trust_products_provisional_copy + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/trusthub/v1/branded_calling.py b/twilio/rest/trusthub/v1/branded_calling.py new file mode 100644 index 000000000..c755e08c5 --- /dev/null +++ b/twilio/rest/trusthub/v1/branded_calling.py @@ -0,0 +1,320 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trusthub + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from typing import Any, Dict, List, Optional, Union +from twilio.base import serialize, values +from twilio.base.api_response import ApiResponse + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class BrandedCallingInstance(InstanceResource): + + """ + :ivar inquiry_id: The unique ID used to start an embedded compliance registration session. + :ivar inquiry_session_token: The session token used to start an embedded compliance registration session. + :ivar registration_id: The Branded Calling RegistrationId. + :ivar url: The URL of this resource. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.inquiry_id: Optional[str] = payload.get("inquiry_id") + self.inquiry_session_token: Optional[str] = payload.get("inquiry_session_token") + self.registration_id: Optional[str] = payload.get("registration_id") + self.url: Optional[str] = payload.get("url") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class BrandedCallingList(ListResource): + def __init__(self, version: Version): + """ + Initialize the BrandedCallingList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/ComplianceInquiries/BrandedCalling/Initialize" + + def _create( + self, + vi_sid: str, + pn_sids: List[str], + skip_brand_use_case: Union[bool, object] = values.unset, + skip_brand_information: Union[bool, object] = values.unset, + short_display_name: Union[str, object] = values.unset, + long_display_name: Union[str, object] = values.unset, + purpose_of_call: Union[str, object] = values.unset, + legal_business_name: Union[str, object] = values.unset, + theme_set_id: Union[str, object] = values.unset, + ) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "ViSid": vi_sid, + "PnSids": serialize.map(pn_sids, lambda e: e), + "SkipBrandUseCase": serialize.boolean_to_string(skip_brand_use_case), + "SkipBrandInformation": serialize.boolean_to_string( + skip_brand_information + ), + "ShortDisplayName": short_display_name, + "LongDisplayName": long_display_name, + "PurposeOfCall": purpose_of_call, + "LegalBusinessName": legal_business_name, + "ThemeSetId": theme_set_id, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, + vi_sid: str, + pn_sids: List[str], + skip_brand_use_case: Union[bool, object] = values.unset, + skip_brand_information: Union[bool, object] = values.unset, + short_display_name: Union[str, object] = values.unset, + long_display_name: Union[str, object] = values.unset, + purpose_of_call: Union[str, object] = values.unset, + legal_business_name: Union[str, object] = values.unset, + theme_set_id: Union[str, object] = values.unset, + ) -> BrandedCallingInstance: + """ + Create the BrandedCallingInstance + + :param vi_sid: The sid of the Voice Integrity bundle that should be attached to the Branded Calling registration + :param pn_sids: List of Phone Number SIDs + :param skip_brand_use_case: Skip brand use case screen + :param skip_brand_information: Skip brand information screen + :param short_display_name: This will be the default display name on outgoing calls. Limited to 15 alphanumeric characters + :param long_display_name: This longer display name will be used on supported carriers. Limited to 32 alphanumeric characters + :param purpose_of_call: Purpose of your outbound calls + :param legal_business_name: Legal name of the business + :param theme_set_id: Theme id for styling the inquiry form. + + :returns: The created BrandedCallingInstance + """ + payload, _, _ = self._create( + vi_sid=vi_sid, + pn_sids=pn_sids, + skip_brand_use_case=skip_brand_use_case, + skip_brand_information=skip_brand_information, + short_display_name=short_display_name, + long_display_name=long_display_name, + purpose_of_call=purpose_of_call, + legal_business_name=legal_business_name, + theme_set_id=theme_set_id, + ) + return BrandedCallingInstance(self._version, payload) + + def create_with_http_info( + self, + vi_sid: str, + pn_sids: List[str], + skip_brand_use_case: Union[bool, object] = values.unset, + skip_brand_information: Union[bool, object] = values.unset, + short_display_name: Union[str, object] = values.unset, + long_display_name: Union[str, object] = values.unset, + purpose_of_call: Union[str, object] = values.unset, + legal_business_name: Union[str, object] = values.unset, + theme_set_id: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Create the BrandedCallingInstance and return response metadata + + :param vi_sid: The sid of the Voice Integrity bundle that should be attached to the Branded Calling registration + :param pn_sids: List of Phone Number SIDs + :param skip_brand_use_case: Skip brand use case screen + :param skip_brand_information: Skip brand information screen + :param short_display_name: This will be the default display name on outgoing calls. Limited to 15 alphanumeric characters + :param long_display_name: This longer display name will be used on supported carriers. Limited to 32 alphanumeric characters + :param purpose_of_call: Purpose of your outbound calls + :param legal_business_name: Legal name of the business + :param theme_set_id: Theme id for styling the inquiry form. + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create( + vi_sid=vi_sid, + pn_sids=pn_sids, + skip_brand_use_case=skip_brand_use_case, + skip_brand_information=skip_brand_information, + short_display_name=short_display_name, + long_display_name=long_display_name, + purpose_of_call=purpose_of_call, + legal_business_name=legal_business_name, + theme_set_id=theme_set_id, + ) + instance = BrandedCallingInstance(self._version, payload) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async( + self, + vi_sid: str, + pn_sids: List[str], + skip_brand_use_case: Union[bool, object] = values.unset, + skip_brand_information: Union[bool, object] = values.unset, + short_display_name: Union[str, object] = values.unset, + long_display_name: Union[str, object] = values.unset, + purpose_of_call: Union[str, object] = values.unset, + legal_business_name: Union[str, object] = values.unset, + theme_set_id: Union[str, object] = values.unset, + ) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "ViSid": vi_sid, + "PnSids": serialize.map(pn_sids, lambda e: e), + "SkipBrandUseCase": serialize.boolean_to_string(skip_brand_use_case), + "SkipBrandInformation": serialize.boolean_to_string( + skip_brand_information + ), + "ShortDisplayName": short_display_name, + "LongDisplayName": long_display_name, + "PurposeOfCall": purpose_of_call, + "LegalBusinessName": legal_business_name, + "ThemeSetId": theme_set_id, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, + vi_sid: str, + pn_sids: List[str], + skip_brand_use_case: Union[bool, object] = values.unset, + skip_brand_information: Union[bool, object] = values.unset, + short_display_name: Union[str, object] = values.unset, + long_display_name: Union[str, object] = values.unset, + purpose_of_call: Union[str, object] = values.unset, + legal_business_name: Union[str, object] = values.unset, + theme_set_id: Union[str, object] = values.unset, + ) -> BrandedCallingInstance: + """ + Asynchronously create the BrandedCallingInstance + + :param vi_sid: The sid of the Voice Integrity bundle that should be attached to the Branded Calling registration + :param pn_sids: List of Phone Number SIDs + :param skip_brand_use_case: Skip brand use case screen + :param skip_brand_information: Skip brand information screen + :param short_display_name: This will be the default display name on outgoing calls. Limited to 15 alphanumeric characters + :param long_display_name: This longer display name will be used on supported carriers. Limited to 32 alphanumeric characters + :param purpose_of_call: Purpose of your outbound calls + :param legal_business_name: Legal name of the business + :param theme_set_id: Theme id for styling the inquiry form. + + :returns: The created BrandedCallingInstance + """ + payload, _, _ = await self._create_async( + vi_sid=vi_sid, + pn_sids=pn_sids, + skip_brand_use_case=skip_brand_use_case, + skip_brand_information=skip_brand_information, + short_display_name=short_display_name, + long_display_name=long_display_name, + purpose_of_call=purpose_of_call, + legal_business_name=legal_business_name, + theme_set_id=theme_set_id, + ) + return BrandedCallingInstance(self._version, payload) + + async def create_with_http_info_async( + self, + vi_sid: str, + pn_sids: List[str], + skip_brand_use_case: Union[bool, object] = values.unset, + skip_brand_information: Union[bool, object] = values.unset, + short_display_name: Union[str, object] = values.unset, + long_display_name: Union[str, object] = values.unset, + purpose_of_call: Union[str, object] = values.unset, + legal_business_name: Union[str, object] = values.unset, + theme_set_id: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously create the BrandedCallingInstance and return response metadata + + :param vi_sid: The sid of the Voice Integrity bundle that should be attached to the Branded Calling registration + :param pn_sids: List of Phone Number SIDs + :param skip_brand_use_case: Skip brand use case screen + :param skip_brand_information: Skip brand information screen + :param short_display_name: This will be the default display name on outgoing calls. Limited to 15 alphanumeric characters + :param long_display_name: This longer display name will be used on supported carriers. Limited to 32 alphanumeric characters + :param purpose_of_call: Purpose of your outbound calls + :param legal_business_name: Legal name of the business + :param theme_set_id: Theme id for styling the inquiry form. + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + vi_sid=vi_sid, + pn_sids=pn_sids, + skip_brand_use_case=skip_brand_use_case, + skip_brand_information=skip_brand_information, + short_display_name=short_display_name, + long_display_name=long_display_name, + purpose_of_call=purpose_of_call, + legal_business_name=legal_business_name, + theme_set_id=theme_set_id, + ) + instance = BrandedCallingInstance(self._version, payload) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/trusthub/v1/bulk_regulated_items.py b/twilio/rest/trusthub/v1/bulk_regulated_items.py new file mode 100644 index 000000000..c161e0333 --- /dev/null +++ b/twilio/rest/trusthub/v1/bulk_regulated_items.py @@ -0,0 +1,156 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trusthub + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from typing import Any, Dict, Optional, Union +from twilio.base import values +from twilio.base.api_response import ApiResponse + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class BulkRegulatedItemsInstance(InstanceResource): + + """ + :ivar items: A list of objects where each object represents a created Regulated Item. Each object contains the following fields: sid, the unique string that identifies the regulated item resource; account_sid, the SID of the Account that created the resource; bundle_sid, the unique string that identifies the Bundle resource; bundle_version, the version of the Bundle resource; item_type, the type of the regulated item; item_sid, the unique string that identifies the regulated item; status, the status of the regulated item; deleted, a flag indicating whether the regulated item has been deleted (1 for deleted, 0 for not deleted); created_by, the SID of the user that created the regulated item; deleted_by, the SID of the user that deleted the regulated item, if applicable; comments, comments associated with the regulated item; date_created, the date the regulated item was created in ISO 8601 format; date_updated, the date the regulated item was updated in ISO 8601 format; date_deleted, the date the regulated item was deleted in ISO 8601 format (null if not deleted); and purpose, the purpose of the regulated item, if applicable. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.items: Optional[Dict[str, object]] = payload.get("items") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class BulkRegulatedItemsList(ListResource): + def __init__(self, version: Version): + """ + Initialize the BulkRegulatedItemsList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/BulkRegulatedItems" + + def _create(self, body: Union[object, object] = values.unset) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = body.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, body: Union[object, object] = values.unset + ) -> BulkRegulatedItemsInstance: + """ + Create the BulkRegulatedItemsInstance + + :param body: + + :returns: The created BulkRegulatedItemsInstance + """ + payload, _, _ = self._create(body=body) + return BulkRegulatedItemsInstance(self._version, payload) + + def create_with_http_info( + self, body: Union[object, object] = values.unset + ) -> ApiResponse: + """ + Create the BulkRegulatedItemsInstance and return response metadata + + :param body: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create(body=body) + instance = BulkRegulatedItemsInstance(self._version, payload) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async(self, body: Union[object, object] = values.unset) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + data = body.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, body: Union[object, object] = values.unset + ) -> BulkRegulatedItemsInstance: + """ + Asynchronously create the BulkRegulatedItemsInstance + + :param body: + + :returns: The created BulkRegulatedItemsInstance + """ + payload, _, _ = await self._create_async(body=body) + return BulkRegulatedItemsInstance(self._version, payload) + + async def create_with_http_info_async( + self, body: Union[object, object] = values.unset + ) -> ApiResponse: + """ + Asynchronously create the BulkRegulatedItemsInstance and return response metadata + + :param body: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async(body=body) + instance = BulkRegulatedItemsInstance(self._version, payload) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/trusthub/v1/bundle_items_details.py b/twilio/rest/trusthub/v1/bundle_items_details.py new file mode 100644 index 000000000..26c143595 --- /dev/null +++ b/twilio/rest/trusthub/v1/bundle_items_details.py @@ -0,0 +1,494 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trusthub + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.api_response import ApiResponse + +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 BundleItemsDetailsInstance(InstanceResource): + + """ + :ivar sid: The unique string that identifies the resource. + :ivar account_sid: The SID of the Account that created the resource. + :ivar friendly_name: A human-readable name for the resource. + :ivar type: The type of the resource. + :ivar status: The verification status of the resource. + :ivar version: The version of the resource. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar attributes: An object containing additional attributes of the resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: Optional[str] = None, + bundle_sid: Optional[str] = None, + ): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.type: Optional[str] = payload.get("type") + self.status: Optional[str] = payload.get("status") + self.version: Optional[int] = deserialize.integer(payload.get("version")) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.attributes: Optional[Dict[str, object]] = payload.get("attributes") + + self._solution = { + "account_sid": account_sid or self.account_sid, + "bundle_sid": bundle_sid or self.bundle_sid, + } + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class BundleItemsDetailsPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> BundleItemsDetailsInstance: + """ + Build an instance of BundleItemsDetailsInstance + + :param payload: Payload response from the API + """ + return BundleItemsDetailsInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + bundle_sid=self._solution["bundle_sid"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class BundleItemsDetailsList(ListResource): + def __init__(self, version: Version, account_sid: str, bundle_sid: str): + """ + Initialize the BundleItemsDetailsList + + :param version: Version that contains the resource + :param account_sid: The SID of the Account that created the Bundle resource. + :param bundle_sid: The unique string that identifies the Bundle resource. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "account_sid": account_sid, + "bundle_sid": bundle_sid, + } + self._uri = "/Accounts/{account_sid}/Bundles/{bundle_sid}/ItemsDetails".format( + **self._solution + ) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[BundleItemsDetailsInstance]: + """ + Streams BundleItemsDetailsInstance 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[BundleItemsDetailsInstance]: + """ + Asynchronously streams BundleItemsDetailsInstance 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 stream_with_http_info( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams BundleItemsDetailsInstance and returns headers from first page + + + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info(page_size=limits["page_size"]) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams BundleItemsDetailsInstance and returns headers from first page + + + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + page_size=limits["page_size"] + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[BundleItemsDetailsInstance]: + """ + Lists BundleItemsDetailsInstance 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[BundleItemsDetailsInstance]: + """ + Asynchronously lists BundleItemsDetailsInstance 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 list_with_http_info( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists BundleItemsDetailsInstance and returns headers from first page + + + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists BundleItemsDetailsInstance and returns headers from first page + + + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> BundleItemsDetailsPage: + """ + Retrieve a single page of BundleItemsDetailsInstance 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 BundleItemsDetailsInstance + """ + 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 BundleItemsDetailsPage(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, + ) -> BundleItemsDetailsPage: + """ + Asynchronously retrieve a single page of BundleItemsDetailsInstance 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 BundleItemsDetailsInstance + """ + 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 BundleItemsDetailsPage(self._version, response, self._solution) + + def page_with_http_info( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :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: ApiResponse with BundleItemsDetailsPage, status code, and headers + """ + 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, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = BundleItemsDetailsPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :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: ApiResponse with BundleItemsDetailsPage, status code, and headers + """ + 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, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = BundleItemsDetailsPage(self._version, response, self._solution) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> BundleItemsDetailsPage: + """ + Retrieve a specific page of BundleItemsDetailsInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of BundleItemsDetailsInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return BundleItemsDetailsPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> BundleItemsDetailsPage: + """ + Asynchronously retrieve a specific page of BundleItemsDetailsInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of BundleItemsDetailsInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return BundleItemsDetailsPage(self._version, response, self._solution) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/trusthub/v1/compliance_inquiries.py b/twilio/rest/trusthub/v1/compliance_inquiries.py index 8c47e8a62..66654a9e1 100644 --- a/twilio/rest/trusthub/v1/compliance_inquiries.py +++ b/twilio/rest/trusthub/v1/compliance_inquiries.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class ComplianceInquiriesInstance(InstanceResource): + """ :ivar inquiry_id: The unique ID used to start an embedded compliance registration session. :ivar inquiry_session_token: The session token used to start an embedded compliance registration session. @@ -137,7 +139,6 @@ def __repr__(self) -> str: class ComplianceInquiriesContext(InstanceContext): - def __init__(self, version: Version, customer_id: str): """ Initialize the ComplianceInquiriesContext @@ -292,7 +293,6 @@ def __repr__(self) -> str: class ComplianceInquiriesList(ListResource): - def __init__(self, version: Version): """ Initialize the ComplianceInquiriesList diff --git a/twilio/rest/trusthub/v1/compliance_inquiry_individual.py b/twilio/rest/trusthub/v1/compliance_inquiry_individual.py new file mode 100644 index 000000000..48f33accf --- /dev/null +++ b/twilio/rest/trusthub/v1/compliance_inquiry_individual.py @@ -0,0 +1,220 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trusthub + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from typing import Any, Dict, Optional, Union +from twilio.base import values +from twilio.base.api_response import ApiResponse + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class ComplianceInquiryIndividualInstance(InstanceResource): + + """ + :ivar inquiry_id: The unique ID used to start an embedded compliance registration session. + :ivar inquiry_session_token: The session token used to start an embedded compliance registration session. + :ivar customer_id: + :ivar url: The URL of this resource. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.inquiry_id: Optional[str] = payload.get("inquiry_id") + self.inquiry_session_token: Optional[str] = payload.get("inquiry_session_token") + self.customer_id: Optional[str] = payload.get("customer_id") + self.url: Optional[str] = payload.get("url") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class ComplianceInquiryIndividualList(ListResource): + def __init__(self, version: Version): + """ + Initialize the ComplianceInquiryIndividualList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/ComplianceInquiries/Customers/Individual/Initialize" + + def _create( + self, + notification_email: Union[str, object] = values.unset, + theme_set_id: Union[str, object] = values.unset, + primary_profile_sid: Union[str, object] = values.unset, + ) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "NotificationEmail": notification_email, + "ThemeSetId": theme_set_id, + "PrimaryProfileSid": primary_profile_sid, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, + notification_email: Union[str, object] = values.unset, + theme_set_id: Union[str, object] = values.unset, + primary_profile_sid: Union[str, object] = values.unset, + ) -> ComplianceInquiryIndividualInstance: + """ + Create the ComplianceInquiryIndividualInstance + + :param notification_email: The email address that approval status updates will be sent to. If not specified, the email address associated with your primary customer profile will be used. + :param theme_set_id: Theme id for styling the inquiry form. + :param primary_profile_sid: The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile. + + :returns: The created ComplianceInquiryIndividualInstance + """ + payload, _, _ = self._create( + notification_email=notification_email, + theme_set_id=theme_set_id, + primary_profile_sid=primary_profile_sid, + ) + return ComplianceInquiryIndividualInstance(self._version, payload) + + def create_with_http_info( + self, + notification_email: Union[str, object] = values.unset, + theme_set_id: Union[str, object] = values.unset, + primary_profile_sid: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Create the ComplianceInquiryIndividualInstance and return response metadata + + :param notification_email: The email address that approval status updates will be sent to. If not specified, the email address associated with your primary customer profile will be used. + :param theme_set_id: Theme id for styling the inquiry form. + :param primary_profile_sid: The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile. + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create( + notification_email=notification_email, + theme_set_id=theme_set_id, + primary_profile_sid=primary_profile_sid, + ) + instance = ComplianceInquiryIndividualInstance(self._version, payload) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async( + self, + notification_email: Union[str, object] = values.unset, + theme_set_id: Union[str, object] = values.unset, + primary_profile_sid: Union[str, object] = values.unset, + ) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "NotificationEmail": notification_email, + "ThemeSetId": theme_set_id, + "PrimaryProfileSid": primary_profile_sid, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, + notification_email: Union[str, object] = values.unset, + theme_set_id: Union[str, object] = values.unset, + primary_profile_sid: Union[str, object] = values.unset, + ) -> ComplianceInquiryIndividualInstance: + """ + Asynchronously create the ComplianceInquiryIndividualInstance + + :param notification_email: The email address that approval status updates will be sent to. If not specified, the email address associated with your primary customer profile will be used. + :param theme_set_id: Theme id for styling the inquiry form. + :param primary_profile_sid: The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile. + + :returns: The created ComplianceInquiryIndividualInstance + """ + payload, _, _ = await self._create_async( + notification_email=notification_email, + theme_set_id=theme_set_id, + primary_profile_sid=primary_profile_sid, + ) + return ComplianceInquiryIndividualInstance(self._version, payload) + + async def create_with_http_info_async( + self, + notification_email: Union[str, object] = values.unset, + theme_set_id: Union[str, object] = values.unset, + primary_profile_sid: Union[str, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously create the ComplianceInquiryIndividualInstance and return response metadata + + :param notification_email: The email address that approval status updates will be sent to. If not specified, the email address associated with your primary customer profile will be used. + :param theme_set_id: Theme id for styling the inquiry form. + :param primary_profile_sid: The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile. + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + notification_email=notification_email, + theme_set_id=theme_set_id, + primary_profile_sid=primary_profile_sid, + ) + instance = ComplianceInquiryIndividualInstance(self._version, payload) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/trusthub/v1/compliance_registration_inquiries.py b/twilio/rest/trusthub/v1/compliance_registration_inquiries.py index 933fedbfc..dc1450b2f 100644 --- a/twilio/rest/trusthub/v1/compliance_registration_inquiries.py +++ b/twilio/rest/trusthub/v1/compliance_registration_inquiries.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -22,7 +23,6 @@ class ComplianceRegistrationInquiriesInstance(InstanceResource): - class BusinessIdentityType(object): DIRECT_CUSTOMER = "direct_customer" ISV_RESELLER_OR_PARTNER = "isv_reseller_or_partner" @@ -170,7 +170,6 @@ def __repr__(self) -> str: class ComplianceRegistrationInquiriesContext(InstanceContext): - def __init__(self, version: Version, registration_id: str): """ Initialize the ComplianceRegistrationInquiriesContext @@ -339,7 +338,6 @@ def __repr__(self) -> str: class ComplianceRegistrationInquiriesList(ListResource): - def __init__(self, version: Version): """ Initialize the ComplianceRegistrationInquiriesList diff --git a/twilio/rest/trusthub/v1/compliance_registrations_compliance_item.py b/twilio/rest/trusthub/v1/compliance_registrations_compliance_item.py new file mode 100644 index 000000000..bfcf201c7 --- /dev/null +++ b/twilio/rest/trusthub/v1/compliance_registrations_compliance_item.py @@ -0,0 +1,1006 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trusthub + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.api_response import ApiResponse +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 ComplianceRegistrationsComplianceItemInstance(InstanceResource): + + """ + :ivar sid: + :ivar registration_id: + :ivar account_sid: + :ivar type: + :ivar resource_sid: + :ivar date_created: + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + registration_id: Optional[str] = None, + sid: Optional[str] = None, + ): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.registration_id: Optional[str] = payload.get("registration_id") + self.account_sid: Optional[str] = payload.get("account_sid") + self.type: Optional[str] = payload.get("type") + self.resource_sid: Optional[str] = payload.get("resource_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.url: Optional[str] = payload.get("url") + + self._solution = { + "registration_id": registration_id or self.registration_id, + "sid": sid or self.sid, + } + self._context: Optional[ComplianceRegistrationsComplianceItemContext] = None + + @property + def _proxy(self) -> "ComplianceRegistrationsComplianceItemContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: ComplianceRegistrationsComplianceItemContext for this ComplianceRegistrationsComplianceItemInstance + """ + if self._context is None: + self._context = ComplianceRegistrationsComplianceItemContext( + self._version, + registration_id=self._solution["registration_id"], + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the ComplianceRegistrationsComplianceItemInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the ComplianceRegistrationsComplianceItemInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the ComplianceRegistrationsComplianceItemInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return self._proxy.delete_with_http_info() + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the ComplianceRegistrationsComplianceItemInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return await self._proxy.delete_with_http_info_async() + + def fetch(self) -> "ComplianceRegistrationsComplianceItemInstance": + """ + Fetch the ComplianceRegistrationsComplianceItemInstance + + + :returns: The fetched ComplianceRegistrationsComplianceItemInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "ComplianceRegistrationsComplianceItemInstance": + """ + Asynchronous coroutine to fetch the ComplianceRegistrationsComplianceItemInstance + + + :returns: The fetched ComplianceRegistrationsComplianceItemInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the ComplianceRegistrationsComplianceItemInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the ComplianceRegistrationsComplianceItemInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_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 ComplianceRegistrationsComplianceItemContext(InstanceContext): + def __init__(self, version: Version, registration_id: str, sid: str): + """ + Initialize the ComplianceRegistrationsComplianceItemContext + + :param version: Version that contains the resource + :param registration_id: + :param sid: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "registration_id": registration_id, + "sid": sid, + } + self._uri = "/Compliance/Registrations/{registration_id}/ResourceAssignments/{sid}".format( + **self._solution + ) + + def _delete(self) -> tuple: + """ + Internal helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + return self._version.delete_with_response_info( + method="DELETE", uri=self._uri, headers=headers + ) + + def delete(self) -> bool: + """ + Deletes the ComplianceRegistrationsComplianceItemInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = self._delete() + return success + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the ComplianceRegistrationsComplianceItemInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = self._delete() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + async def _delete_async(self) -> tuple: + """ + Internal async helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + return await self._version.delete_with_response_info_async( + method="DELETE", uri=self._uri, headers=headers + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the ComplianceRegistrationsComplianceItemInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = await self._delete_async() + return success + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the ComplianceRegistrationsComplianceItemInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = await self._delete_async() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> ComplianceRegistrationsComplianceItemInstance: + """ + Fetch the ComplianceRegistrationsComplianceItemInstance + + + :returns: The fetched ComplianceRegistrationsComplianceItemInstance + """ + payload, _, _ = self._fetch() + return ComplianceRegistrationsComplianceItemInstance( + self._version, + payload, + registration_id=self._solution["registration_id"], + sid=self._solution["sid"], + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the ComplianceRegistrationsComplianceItemInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = ComplianceRegistrationsComplianceItemInstance( + self._version, + payload, + registration_id=self._solution["registration_id"], + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> ComplianceRegistrationsComplianceItemInstance: + """ + Asynchronous coroutine to fetch the ComplianceRegistrationsComplianceItemInstance + + + :returns: The fetched ComplianceRegistrationsComplianceItemInstance + """ + payload, _, _ = await self._fetch_async() + return ComplianceRegistrationsComplianceItemInstance( + self._version, + payload, + registration_id=self._solution["registration_id"], + sid=self._solution["sid"], + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the ComplianceRegistrationsComplianceItemInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = ComplianceRegistrationsComplianceItemInstance( + self._version, + payload, + registration_id=self._solution["registration_id"], + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format( + context + ) + + +class ComplianceRegistrationsComplianceItemPage(Page): + def get_instance( + self, payload: Dict[str, Any] + ) -> ComplianceRegistrationsComplianceItemInstance: + """ + Build an instance of ComplianceRegistrationsComplianceItemInstance + + :param payload: Payload response from the API + """ + return ComplianceRegistrationsComplianceItemInstance( + self._version, payload, registration_id=self._solution["registration_id"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class ComplianceRegistrationsComplianceItemList(ListResource): + def __init__(self, version: Version, registration_id: str): + """ + Initialize the ComplianceRegistrationsComplianceItemList + + :param version: Version that contains the resource + :param registration_id: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "registration_id": registration_id, + } + self._uri = ( + "/Compliance/Registrations/{registration_id}/ResourceAssignments".format( + **self._solution + ) + ) + + def _create(self, type: str, resource_sid: str) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "Type": type, + "ResourceSid": resource_sid, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create( + self, type: str, resource_sid: str + ) -> ComplianceRegistrationsComplianceItemInstance: + """ + Create the ComplianceRegistrationsComplianceItemInstance + + :param type: + :param resource_sid: + + :returns: The created ComplianceRegistrationsComplianceItemInstance + """ + payload, _, _ = self._create(type=type, resource_sid=resource_sid) + return ComplianceRegistrationsComplianceItemInstance( + self._version, payload, registration_id=self._solution["registration_id"] + ) + + def create_with_http_info(self, type: str, resource_sid: str) -> ApiResponse: + """ + Create the ComplianceRegistrationsComplianceItemInstance and return response metadata + + :param type: + :param resource_sid: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create( + type=type, resource_sid=resource_sid + ) + instance = ComplianceRegistrationsComplianceItemInstance( + self._version, payload, registration_id=self._solution["registration_id"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async(self, type: str, resource_sid: str) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of( + { + "Type": type, + "ResourceSid": resource_sid, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async( + self, type: str, resource_sid: str + ) -> ComplianceRegistrationsComplianceItemInstance: + """ + Asynchronously create the ComplianceRegistrationsComplianceItemInstance + + :param type: + :param resource_sid: + + :returns: The created ComplianceRegistrationsComplianceItemInstance + """ + payload, _, _ = await self._create_async(type=type, resource_sid=resource_sid) + return ComplianceRegistrationsComplianceItemInstance( + self._version, payload, registration_id=self._solution["registration_id"] + ) + + async def create_with_http_info_async( + self, type: str, resource_sid: str + ) -> ApiResponse: + """ + Asynchronously create the ComplianceRegistrationsComplianceItemInstance and return response metadata + + :param type: + :param resource_sid: + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async( + type=type, resource_sid=resource_sid + ) + instance = ComplianceRegistrationsComplianceItemInstance( + self._version, payload, registration_id=self._solution["registration_id"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def stream( + self, + resource_sid: Union[str, object] = values.unset, + resource_sids: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[ComplianceRegistrationsComplianceItemInstance]: + """ + Streams ComplianceRegistrationsComplianceItemInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str resource_sid: + :param str resource_sids: + :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( + resource_sid=resource_sid, + resource_sids=resource_sids, + page_size=limits["page_size"], + ) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + resource_sid: Union[str, object] = values.unset, + resource_sids: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[ComplianceRegistrationsComplianceItemInstance]: + """ + Asynchronously streams ComplianceRegistrationsComplianceItemInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str resource_sid: + :param str resource_sids: + :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( + resource_sid=resource_sid, + resource_sids=resource_sids, + page_size=limits["page_size"], + ) + + return self._version.stream_async(page, limits["limit"]) + + def stream_with_http_info( + self, + resource_sid: Union[str, object] = values.unset, + resource_sids: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams ComplianceRegistrationsComplianceItemInstance and returns headers from first page + + + :param str resource_sid: + :param str resource_sids: + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info( + resource_sid=resource_sid, + resource_sids=resource_sids, + page_size=limits["page_size"], + ) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + resource_sid: Union[str, object] = values.unset, + resource_sids: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams ComplianceRegistrationsComplianceItemInstance and returns headers from first page + + + :param str resource_sid: + :param str resource_sids: + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + resource_sid=resource_sid, + resource_sids=resource_sids, + page_size=limits["page_size"], + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + resource_sid: Union[str, object] = values.unset, + resource_sids: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[ComplianceRegistrationsComplianceItemInstance]: + """ + Lists ComplianceRegistrationsComplianceItemInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str resource_sid: + :param str resource_sids: + :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( + resource_sid=resource_sid, + resource_sids=resource_sids, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + resource_sid: Union[str, object] = values.unset, + resource_sids: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[ComplianceRegistrationsComplianceItemInstance]: + """ + Asynchronously lists ComplianceRegistrationsComplianceItemInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str resource_sid: + :param str resource_sids: + :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( + resource_sid=resource_sid, + resource_sids=resource_sids, + limit=limit, + page_size=page_size, + ) + ] + + def list_with_http_info( + self, + resource_sid: Union[str, object] = values.unset, + resource_sids: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists ComplianceRegistrationsComplianceItemInstance and returns headers from first page + + + :param str resource_sid: + :param str resource_sids: + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + resource_sid=resource_sid, + resource_sids=resource_sids, + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + resource_sid: Union[str, object] = values.unset, + resource_sids: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists ComplianceRegistrationsComplianceItemInstance and returns headers from first page + + + :param str resource_sid: + :param str resource_sids: + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + resource_sid=resource_sid, + resource_sids=resource_sids, + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + resource_sid: Union[str, object] = values.unset, + resource_sids: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ComplianceRegistrationsComplianceItemPage: + """ + Retrieve a single page of ComplianceRegistrationsComplianceItemInstance records from the API. + Request is executed immediately + + :param resource_sid: + :param resource_sids: + :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 ComplianceRegistrationsComplianceItemInstance + """ + data = values.of( + { + "ResourceSid": resource_sid, + "ResourceSids": resource_sids, + "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 ComplianceRegistrationsComplianceItemPage( + self._version, response, self._solution + ) + + async def page_async( + self, + resource_sid: Union[str, object] = values.unset, + resource_sids: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ComplianceRegistrationsComplianceItemPage: + """ + Asynchronously retrieve a single page of ComplianceRegistrationsComplianceItemInstance records from the API. + Request is executed immediately + + :param resource_sid: + :param resource_sids: + :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 ComplianceRegistrationsComplianceItemInstance + """ + data = values.of( + { + "ResourceSid": resource_sid, + "ResourceSids": resource_sids, + "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 ComplianceRegistrationsComplianceItemPage( + self._version, response, self._solution + ) + + def page_with_http_info( + self, + resource_sid: Union[str, object] = values.unset, + resource_sids: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :param resource_sid: + :param resource_sids: + :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: ApiResponse with ComplianceRegistrationsComplianceItemPage, status code, and headers + """ + data = values.of( + { + "ResourceSid": resource_sid, + "ResourceSids": resource_sids, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = ComplianceRegistrationsComplianceItemPage( + self._version, response, self._solution + ) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + resource_sid: Union[str, object] = values.unset, + resource_sids: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :param resource_sid: + :param resource_sids: + :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: ApiResponse with ComplianceRegistrationsComplianceItemPage, status code, and headers + """ + data = values.of( + { + "ResourceSid": resource_sid, + "ResourceSids": resource_sids, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = ComplianceRegistrationsComplianceItemPage( + self._version, response, self._solution + ) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> ComplianceRegistrationsComplianceItemPage: + """ + Retrieve a specific page of ComplianceRegistrationsComplianceItemInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ComplianceRegistrationsComplianceItemInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return ComplianceRegistrationsComplianceItemPage( + self._version, response, self._solution + ) + + async def get_page_async( + self, target_url: str + ) -> ComplianceRegistrationsComplianceItemPage: + """ + Asynchronously retrieve a specific page of ComplianceRegistrationsComplianceItemInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ComplianceRegistrationsComplianceItemInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return ComplianceRegistrationsComplianceItemPage( + self._version, response, self._solution + ) + + def get( + self, registration_id: str, sid: str + ) -> ComplianceRegistrationsComplianceItemContext: + """ + Constructs a ComplianceRegistrationsComplianceItemContext + + :param registration_id: + :param sid: + """ + return ComplianceRegistrationsComplianceItemContext( + self._version, registration_id=registration_id, sid=sid + ) + + def __call__( + self, registration_id: str, sid: str + ) -> ComplianceRegistrationsComplianceItemContext: + """ + Constructs a ComplianceRegistrationsComplianceItemContext + + :param registration_id: + :param sid: + """ + return ComplianceRegistrationsComplianceItemContext( + self._version, registration_id=registration_id, sid=sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/trusthub/v1/compliance_tollfree_inquiries.py b/twilio/rest/trusthub/v1/compliance_tollfree_inquiries.py index 691594bd4..b1a3c37a8 100644 --- a/twilio/rest/trusthub/v1/compliance_tollfree_inquiries.py +++ b/twilio/rest/trusthub/v1/compliance_tollfree_inquiries.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -22,7 +23,6 @@ class ComplianceTollfreeInquiriesInstance(InstanceResource): - class BusinessType(object): PRIVATE_PROFIT = "PRIVATE_PROFIT" PUBLIC_PROFIT = "PUBLIC_PROFIT" @@ -63,7 +63,6 @@ def __repr__(self) -> str: class ComplianceTollfreeInquiriesList(ListResource): - def __init__(self, version: Version): """ Initialize the ComplianceTollfreeInquiriesList diff --git a/twilio/rest/trusthub/v1/compliance_upgrade_individual.py b/twilio/rest/trusthub/v1/compliance_upgrade_individual.py new file mode 100644 index 000000000..1ac0b4a5b --- /dev/null +++ b/twilio/rest/trusthub/v1/compliance_upgrade_individual.py @@ -0,0 +1,267 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trusthub + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from typing import Any, Dict, Optional +from twilio.base import values +from twilio.base.api_response import ApiResponse +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 ComplianceUpgradeIndividualInstance(InstanceResource): + + """ + :ivar upgraded_bundle_sid: The SID of the upgraded bundle + :ivar customer_type: The type of customer, which is 'business' after upgrade + :ivar account_sid: The SID of the account associated with the customer + :ivar customer_id: + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + customer_id: Optional[str] = None, + ): + super().__init__(version) + + self.upgraded_bundle_sid: Optional[str] = payload.get("upgraded_bundle_sid") + self.customer_type: Optional[str] = payload.get("customer_type") + self.account_sid: Optional[str] = payload.get("account_sid") + self.customer_id: Optional[str] = payload.get("customer_id") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "customer_id": customer_id or self.customer_id, + } + self._context: Optional[ComplianceUpgradeIndividualContext] = None + + @property + def _proxy(self) -> "ComplianceUpgradeIndividualContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: ComplianceUpgradeIndividualContext for this ComplianceUpgradeIndividualInstance + """ + if self._context is None: + self._context = ComplianceUpgradeIndividualContext( + self._version, + customer_id=self._solution["customer_id"], + ) + return self._context + + def update(self) -> "ComplianceUpgradeIndividualInstance": + """ + Update the ComplianceUpgradeIndividualInstance + + + :returns: The updated ComplianceUpgradeIndividualInstance + """ + return self._proxy.update() + + async def update_async(self) -> "ComplianceUpgradeIndividualInstance": + """ + Asynchronous coroutine to update the ComplianceUpgradeIndividualInstance + + + :returns: The updated ComplianceUpgradeIndividualInstance + """ + return await self._proxy.update_async() + + def update_with_http_info(self) -> ApiResponse: + """ + Update the ComplianceUpgradeIndividualInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.update_with_http_info() + + async def update_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to update the ComplianceUpgradeIndividualInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.update_with_http_info_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 ComplianceUpgradeIndividualContext(InstanceContext): + def __init__(self, version: Version, customer_id: str): + """ + Initialize the ComplianceUpgradeIndividualContext + + :param version: Version that contains the resource + :param customer_id: The CustomerID of the individual customer profile to be upgraded + """ + super().__init__(version) + + # Path Solution + self._solution = { + "customer_id": customer_id, + } + self._uri = "/Compliance/Customers/{customer_id}/Individual/Upgrade".format( + **self._solution + ) + + def _update(self) -> tuple: + """ + Internal helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of({}) + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.update_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def update(self) -> ComplianceUpgradeIndividualInstance: + """ + Update the ComplianceUpgradeIndividualInstance + + + :returns: The updated ComplianceUpgradeIndividualInstance + """ + payload, _, _ = self._update() + return ComplianceUpgradeIndividualInstance( + self._version, payload, customer_id=self._solution["customer_id"] + ) + + def update_with_http_info(self) -> ApiResponse: + """ + Update the ComplianceUpgradeIndividualInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._update() + instance = ComplianceUpgradeIndividualInstance( + self._version, payload, customer_id=self._solution["customer_id"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _update_async(self) -> tuple: + """ + Internal async helper for update operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of({}) + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.update_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def update_async(self) -> ComplianceUpgradeIndividualInstance: + """ + Asynchronous coroutine to update the ComplianceUpgradeIndividualInstance + + + :returns: The updated ComplianceUpgradeIndividualInstance + """ + payload, _, _ = await self._update_async() + return ComplianceUpgradeIndividualInstance( + self._version, payload, customer_id=self._solution["customer_id"] + ) + + async def update_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to update the ComplianceUpgradeIndividualInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._update_async() + instance = ComplianceUpgradeIndividualInstance( + self._version, payload, customer_id=self._solution["customer_id"] + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format( + context + ) + + +class ComplianceUpgradeIndividualList(ListResource): + def __init__(self, version: Version): + """ + Initialize the ComplianceUpgradeIndividualList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, customer_id: str) -> ComplianceUpgradeIndividualContext: + """ + Constructs a ComplianceUpgradeIndividualContext + + :param customer_id: The CustomerID of the individual customer profile to be upgraded + """ + return ComplianceUpgradeIndividualContext( + self._version, customer_id=customer_id + ) + + def __call__(self, customer_id: str) -> ComplianceUpgradeIndividualContext: + """ + Constructs a ComplianceUpgradeIndividualContext + + :param customer_id: The CustomerID of the individual customer profile to be upgraded + """ + return ComplianceUpgradeIndividualContext( + self._version, customer_id=customer_id + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/trusthub/v1/customer_profiles/__init__.py b/twilio/rest/trusthub/v1/customer_profiles/__init__.py index 5ee332dbd..25a18b112 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/__init__.py +++ b/twilio/rest/trusthub/v1/customer_profiles/__init__.py @@ -12,6 +12,7 @@ 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 @@ -33,7 +34,6 @@ class CustomerProfilesInstance(InstanceResource): - class Status(object): DRAFT = "draft" PENDING_REVIEW = "pending-review" @@ -306,7 +306,6 @@ def __repr__(self) -> str: class CustomerProfilesContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the CustomerProfilesContext @@ -719,7 +718,6 @@ def __repr__(self) -> str: class CustomerProfilesPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> CustomerProfilesInstance: """ Build an instance of CustomerProfilesInstance @@ -738,7 +736,6 @@ def __repr__(self) -> str: class CustomerProfilesList(ListResource): - def __init__(self, version: Version): """ Initialize the CustomerProfilesList @@ -1361,10 +1358,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CustomerProfilesPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.py b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.py index eacbce10e..a752f989a 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.py +++ b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class CustomerProfilesChannelEndpointAssignmentInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Item Assignment resource. :ivar customer_profile_sid: The unique string that we created to identify the CustomerProfile resource. @@ -160,7 +162,6 @@ def __repr__(self) -> str: class CustomerProfilesChannelEndpointAssignmentContext(InstanceContext): - def __init__(self, version: Version, customer_profile_sid: str, sid: str): """ Initialize the CustomerProfilesChannelEndpointAssignmentContext @@ -355,7 +356,6 @@ def __repr__(self) -> str: class CustomerProfilesChannelEndpointAssignmentPage(Page): - def get_instance( self, payload: Dict[str, Any] ) -> CustomerProfilesChannelEndpointAssignmentInstance: @@ -380,7 +380,6 @@ def __repr__(self) -> str: class CustomerProfilesChannelEndpointAssignmentList(ListResource): - def __init__(self, version: Version, customer_profile_sid: str): """ Initialize the CustomerProfilesChannelEndpointAssignmentList @@ -950,10 +949,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CustomerProfilesChannelEndpointAssignmentPage( self._version, response, self._solution diff --git a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.py b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.py index c319183bd..f318da955 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.py +++ b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class CustomerProfilesEntityAssignmentsInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Item Assignment resource. :ivar customer_profile_sid: The unique string that we created to identify the CustomerProfile resource. @@ -160,7 +162,6 @@ def __repr__(self) -> str: class CustomerProfilesEntityAssignmentsContext(InstanceContext): - def __init__(self, version: Version, customer_profile_sid: str, sid: str): """ Initialize the CustomerProfilesEntityAssignmentsContext @@ -359,7 +360,6 @@ def __repr__(self) -> str: class CustomerProfilesEntityAssignmentsPage(Page): - def get_instance( self, payload: Dict[str, Any] ) -> CustomerProfilesEntityAssignmentsInstance: @@ -384,7 +384,6 @@ def __repr__(self) -> str: class CustomerProfilesEntityAssignmentsList(ListResource): - def __init__(self, version: Version, customer_profile_sid: str): """ Initialize the CustomerProfilesEntityAssignmentsList @@ -886,10 +885,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CustomerProfilesEntityAssignmentsPage( self._version, response, self._solution diff --git a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.py b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.py index ea31d46bd..1061beecc 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.py +++ b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class CustomerProfilesEvaluationsInstance(InstanceResource): - class Status(object): COMPLIANT = "compliant" NONCOMPLIANT = "noncompliant" @@ -53,9 +53,9 @@ def __init__( self.account_sid: Optional[str] = payload.get("account_sid") self.policy_sid: Optional[str] = payload.get("policy_sid") self.customer_profile_sid: Optional[str] = payload.get("customer_profile_sid") - self.status: Optional["CustomerProfilesEvaluationsInstance.Status"] = ( - payload.get("status") - ) + self.status: Optional[ + "CustomerProfilesEvaluationsInstance.Status" + ] = payload.get("status") self.results: Optional[List[Dict[str, object]]] = payload.get("results") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") @@ -133,7 +133,6 @@ def __repr__(self) -> str: class CustomerProfilesEvaluationsContext(InstanceContext): - def __init__(self, version: Version, customer_profile_sid: str, sid: str): """ Initialize the CustomerProfilesEvaluationsContext @@ -260,7 +259,6 @@ def __repr__(self) -> str: class CustomerProfilesEvaluationsPage(Page): - def get_instance( self, payload: Dict[str, Any] ) -> CustomerProfilesEvaluationsInstance: @@ -285,7 +283,6 @@ def __repr__(self) -> str: class CustomerProfilesEvaluationsList(ListResource): - def __init__(self, version: Version, customer_profile_sid: str): """ Initialize the CustomerProfilesEvaluationsList @@ -745,10 +742,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CustomerProfilesEvaluationsPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/trusthub/v1/customer_profiles_provisional_copy.py b/twilio/rest/trusthub/v1/customer_profiles_provisional_copy.py new file mode 100644 index 000000000..b2c262e41 --- /dev/null +++ b/twilio/rest/trusthub/v1/customer_profiles_provisional_copy.py @@ -0,0 +1,422 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trusthub + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from datetime import datetime +from typing import Any, Dict, Optional +from twilio.base import deserialize, values +from twilio.base.api_response import ApiResponse +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 CustomerProfilesProvisionalCopyInstance(InstanceResource): + + """ + :ivar customer_profile_sid: The unique SID identifier of the Customer Profile. + :ivar account_sid: The unique SID identifier of the Account. + :ivar policy_sid: The unique string of a policy that is associated to the Customer-Profile resource. + :ivar friendly_name: A human readable description of this resource, up to 64 characters. + :ivar status: The verification status of the Customer-Profile resource. + :ivar email: The email address that will receive updates when the Customer-Profile resource changes status. + :ivar status_callback: The URL we call to inform your application of status changes. + :ivar valid_until: The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. + :ivar date_created: The date that this Customer Profiles Provisional Copy was created, given in ISO 8601 format. + :ivar date_updated: The date that this Customer Profiles Provisional Copy was updated, given in ISO 8601 format. + :ivar url: The URL of this resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + customer_profile_sid: Optional[str] = None, + ): + super().__init__(version) + + self.customer_profile_sid: Optional[str] = payload.get("customer_profile_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.policy_sid: Optional[str] = payload.get("policy_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.status: Optional[str] = payload.get("status") + self.email: Optional[str] = payload.get("email") + self.status_callback: Optional[str] = payload.get("status_callback") + self.valid_until: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("valid_until") + ) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") + + self._solution = { + "customer_profile_sid": customer_profile_sid or self.customer_profile_sid, + } + self._context: Optional[CustomerProfilesProvisionalCopyContext] = None + + @property + def _proxy(self) -> "CustomerProfilesProvisionalCopyContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: CustomerProfilesProvisionalCopyContext for this CustomerProfilesProvisionalCopyInstance + """ + if self._context is None: + self._context = CustomerProfilesProvisionalCopyContext( + self._version, + customer_profile_sid=self._solution["customer_profile_sid"], + ) + return self._context + + def create(self) -> "CustomerProfilesProvisionalCopyInstance": + """ + Create the CustomerProfilesProvisionalCopyInstance + + + :returns: The created CustomerProfilesProvisionalCopyInstance + """ + return self._proxy.create() + + async def create_async(self) -> "CustomerProfilesProvisionalCopyInstance": + """ + Asynchronous coroutine to create the CustomerProfilesProvisionalCopyInstance + + + :returns: The created CustomerProfilesProvisionalCopyInstance + """ + return await self._proxy.create_async() + + def create_with_http_info(self) -> ApiResponse: + """ + Create the CustomerProfilesProvisionalCopyInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.create_with_http_info() + + async def create_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to create the CustomerProfilesProvisionalCopyInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.create_with_http_info_async() + + def fetch(self) -> "CustomerProfilesProvisionalCopyInstance": + """ + Fetch the CustomerProfilesProvisionalCopyInstance + + + :returns: The fetched CustomerProfilesProvisionalCopyInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "CustomerProfilesProvisionalCopyInstance": + """ + Asynchronous coroutine to fetch the CustomerProfilesProvisionalCopyInstance + + + :returns: The fetched CustomerProfilesProvisionalCopyInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the CustomerProfilesProvisionalCopyInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the CustomerProfilesProvisionalCopyInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_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 CustomerProfilesProvisionalCopyContext(InstanceContext): + def __init__(self, version: Version, customer_profile_sid: str): + """ + Initialize the CustomerProfilesProvisionalCopyContext + + :param version: Version that contains the resource + :param customer_profile_sid: The unique SID identifier of the Customer Profile. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "customer_profile_sid": customer_profile_sid, + } + self._uri = "/CustomerProfiles/{customer_profile_sid}/ProvisionalCopy".format( + **self._solution + ) + + def _create(self) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of({}) + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create(self) -> CustomerProfilesProvisionalCopyInstance: + """ + Create the CustomerProfilesProvisionalCopyInstance + + + :returns: The created CustomerProfilesProvisionalCopyInstance + """ + payload, _, _ = self._create() + return CustomerProfilesProvisionalCopyInstance( + self._version, + payload, + customer_profile_sid=self._solution["customer_profile_sid"], + ) + + def create_with_http_info(self) -> ApiResponse: + """ + Create the CustomerProfilesProvisionalCopyInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create() + instance = CustomerProfilesProvisionalCopyInstance( + self._version, + payload, + customer_profile_sid=self._solution["customer_profile_sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async(self) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of({}) + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async(self) -> CustomerProfilesProvisionalCopyInstance: + """ + Asynchronous coroutine to create the CustomerProfilesProvisionalCopyInstance + + + :returns: The created CustomerProfilesProvisionalCopyInstance + """ + payload, _, _ = await self._create_async() + return CustomerProfilesProvisionalCopyInstance( + self._version, + payload, + customer_profile_sid=self._solution["customer_profile_sid"], + ) + + async def create_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to create the CustomerProfilesProvisionalCopyInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async() + instance = CustomerProfilesProvisionalCopyInstance( + self._version, + payload, + customer_profile_sid=self._solution["customer_profile_sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> CustomerProfilesProvisionalCopyInstance: + """ + Fetch the CustomerProfilesProvisionalCopyInstance + + + :returns: The fetched CustomerProfilesProvisionalCopyInstance + """ + payload, _, _ = self._fetch() + return CustomerProfilesProvisionalCopyInstance( + self._version, + payload, + customer_profile_sid=self._solution["customer_profile_sid"], + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the CustomerProfilesProvisionalCopyInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = CustomerProfilesProvisionalCopyInstance( + self._version, + payload, + customer_profile_sid=self._solution["customer_profile_sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> CustomerProfilesProvisionalCopyInstance: + """ + Asynchronous coroutine to fetch the CustomerProfilesProvisionalCopyInstance + + + :returns: The fetched CustomerProfilesProvisionalCopyInstance + """ + payload, _, _ = await self._fetch_async() + return CustomerProfilesProvisionalCopyInstance( + self._version, + payload, + customer_profile_sid=self._solution["customer_profile_sid"], + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the CustomerProfilesProvisionalCopyInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = CustomerProfilesProvisionalCopyInstance( + self._version, + payload, + customer_profile_sid=self._solution["customer_profile_sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format( + context + ) + + +class CustomerProfilesProvisionalCopyList(ListResource): + def __init__(self, version: Version): + """ + Initialize the CustomerProfilesProvisionalCopyList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, customer_profile_sid: str) -> CustomerProfilesProvisionalCopyContext: + """ + Constructs a CustomerProfilesProvisionalCopyContext + + :param customer_profile_sid: The unique SID identifier of the Customer Profile. + """ + return CustomerProfilesProvisionalCopyContext( + self._version, customer_profile_sid=customer_profile_sid + ) + + def __call__( + self, customer_profile_sid: str + ) -> CustomerProfilesProvisionalCopyContext: + """ + Constructs a CustomerProfilesProvisionalCopyContext + + :param customer_profile_sid: The unique SID identifier of the Customer Profile. + """ + return CustomerProfilesProvisionalCopyContext( + self._version, customer_profile_sid=customer_profile_sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/trusthub/v1/end_user.py b/twilio/rest/trusthub/v1/end_user.py index 003569563..833b7732e 100644 --- a/twilio/rest/trusthub/v1/end_user.py +++ b/twilio/rest/trusthub/v1/end_user.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class EndUserInstance(InstanceResource): + """ :ivar sid: The unique string created by Twilio to identify the End User resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the End User resource. @@ -228,7 +230,6 @@ def __repr__(self) -> str: class EndUserContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the EndUserContext @@ -541,7 +542,6 @@ def __repr__(self) -> str: class EndUserPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> EndUserInstance: """ Build an instance of EndUserInstance @@ -560,7 +560,6 @@ def __repr__(self) -> str: class EndUserList(ListResource): - def __init__(self, version: Version): """ Initialize the EndUserList @@ -1045,10 +1044,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = EndUserPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/trusthub/v1/end_user_type.py b/twilio/rest/trusthub/v1/end_user_type.py index 1df255b72..e172caf92 100644 --- a/twilio/rest/trusthub/v1/end_user_type.py +++ b/twilio/rest/trusthub/v1/end_user_type.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class EndUserTypeInstance(InstanceResource): + """ :ivar sid: The unique string that identifies the End-User Type resource. :ivar friendly_name: A human-readable description that is assigned to describe the End-User Type resource. Examples can include first name, last name, email, business name, etc @@ -109,7 +111,6 @@ def __repr__(self) -> str: class EndUserTypeContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the EndUserTypeContext @@ -226,7 +227,6 @@ def __repr__(self) -> str: class EndUserTypePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> EndUserTypeInstance: """ Build an instance of EndUserTypeInstance @@ -245,7 +245,6 @@ def __repr__(self) -> str: class EndUserTypeList(ListResource): - def __init__(self, version: Version): """ Initialize the EndUserTypeList @@ -588,10 +587,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = EndUserTypePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/trusthub/v1/policies.py b/twilio/rest/trusthub/v1/policies.py index 5bc285d0f..a3f92ae2f 100644 --- a/twilio/rest/trusthub/v1/policies.py +++ b/twilio/rest/trusthub/v1/policies.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class PoliciesInstance(InstanceResource): + """ :ivar sid: The unique string that identifies the Policy resource. :ivar friendly_name: A human-readable description that is assigned to describe the Policy resource. Examples can include Primary Customer profile policy @@ -107,7 +109,6 @@ def __repr__(self) -> str: class PoliciesContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the PoliciesContext @@ -224,7 +225,6 @@ def __repr__(self) -> str: class PoliciesPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> PoliciesInstance: """ Build an instance of PoliciesInstance @@ -243,7 +243,6 @@ def __repr__(self) -> str: class PoliciesList(ListResource): - def __init__(self, version: Version): """ Initialize the PoliciesList @@ -586,10 +585,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = PoliciesPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/trusthub/v1/supporting_document.py b/twilio/rest/trusthub/v1/supporting_document.py index 8354e34a6..c828cb225 100644 --- a/twilio/rest/trusthub/v1/supporting_document.py +++ b/twilio/rest/trusthub/v1/supporting_document.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class SupportingDocumentInstance(InstanceResource): - class Status(object): DRAFT = "DRAFT" PENDING_REVIEW = "PENDING_REVIEW" @@ -243,7 +243,6 @@ def __repr__(self) -> str: class SupportingDocumentContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the SupportingDocumentContext @@ -564,7 +563,6 @@ def __repr__(self) -> str: class SupportingDocumentPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SupportingDocumentInstance: """ Build an instance of SupportingDocumentInstance @@ -583,7 +581,6 @@ def __repr__(self) -> str: class SupportingDocumentList(ListResource): - def __init__(self, version: Version): """ Initialize the SupportingDocumentList @@ -1068,10 +1065,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SupportingDocumentPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/trusthub/v1/supporting_document_type.py b/twilio/rest/trusthub/v1/supporting_document_type.py index 8980c79d5..ef2c4c9db 100644 --- a/twilio/rest/trusthub/v1/supporting_document_type.py +++ b/twilio/rest/trusthub/v1/supporting_document_type.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class SupportingDocumentTypeInstance(InstanceResource): + """ :ivar sid: The unique string that identifies the Supporting Document Type resource. :ivar friendly_name: A human-readable description of the Supporting Document Type resource. @@ -109,7 +111,6 @@ def __repr__(self) -> str: class SupportingDocumentTypeContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the SupportingDocumentTypeContext @@ -226,7 +227,6 @@ def __repr__(self) -> str: class SupportingDocumentTypePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SupportingDocumentTypeInstance: """ Build an instance of SupportingDocumentTypeInstance @@ -245,7 +245,6 @@ def __repr__(self) -> str: class SupportingDocumentTypeList(ListResource): - def __init__(self, version: Version): """ Initialize the SupportingDocumentTypeList @@ -588,10 +587,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SupportingDocumentTypePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/trusthub/v1/trust_products/__init__.py b/twilio/rest/trusthub/v1/trust_products/__init__.py index faa66d886..d9efc17ea 100644 --- a/twilio/rest/trusthub/v1/trust_products/__init__.py +++ b/twilio/rest/trusthub/v1/trust_products/__init__.py @@ -12,6 +12,7 @@ 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 @@ -33,7 +34,6 @@ class TrustProductsInstance(InstanceResource): - class Status(object): DRAFT = "draft" PENDING_REVIEW = "pending-review" @@ -304,7 +304,6 @@ def __repr__(self) -> str: class TrustProductsContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the TrustProductsContext @@ -709,7 +708,6 @@ def __repr__(self) -> str: class TrustProductsPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> TrustProductsInstance: """ Build an instance of TrustProductsInstance @@ -728,7 +726,6 @@ def __repr__(self) -> str: class TrustProductsList(ListResource): - def __init__(self, version: Version): """ Initialize the TrustProductsList @@ -1351,10 +1348,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = TrustProductsPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.py b/twilio/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.py index 59488f257..a38699a49 100644 --- a/twilio/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.py +++ b/twilio/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class TrustProductsChannelEndpointAssignmentInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Item Assignment resource. :ivar trust_product_sid: The unique string that we created to identify the CustomerProfile resource. @@ -160,7 +162,6 @@ def __repr__(self) -> str: class TrustProductsChannelEndpointAssignmentContext(InstanceContext): - def __init__(self, version: Version, trust_product_sid: str, sid: str): """ Initialize the TrustProductsChannelEndpointAssignmentContext @@ -355,7 +356,6 @@ def __repr__(self) -> str: class TrustProductsChannelEndpointAssignmentPage(Page): - def get_instance( self, payload: Dict[str, Any] ) -> TrustProductsChannelEndpointAssignmentInstance: @@ -380,7 +380,6 @@ def __repr__(self) -> str: class TrustProductsChannelEndpointAssignmentList(ListResource): - def __init__(self, version: Version, trust_product_sid: str): """ Initialize the TrustProductsChannelEndpointAssignmentList @@ -952,10 +951,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = TrustProductsChannelEndpointAssignmentPage( self._version, response, self._solution diff --git a/twilio/rest/trusthub/v1/trust_products/trust_products_entity_assignments.py b/twilio/rest/trusthub/v1/trust_products/trust_products_entity_assignments.py index c027f9f83..2dd612dd5 100644 --- a/twilio/rest/trusthub/v1/trust_products/trust_products_entity_assignments.py +++ b/twilio/rest/trusthub/v1/trust_products/trust_products_entity_assignments.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class TrustProductsEntityAssignmentsInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Item Assignment resource. :ivar trust_product_sid: The unique string that we created to identify the TrustProduct resource. @@ -158,7 +160,6 @@ def __repr__(self) -> str: class TrustProductsEntityAssignmentsContext(InstanceContext): - def __init__(self, version: Version, trust_product_sid: str, sid: str): """ Initialize the TrustProductsEntityAssignmentsContext @@ -353,7 +354,6 @@ def __repr__(self) -> str: class TrustProductsEntityAssignmentsPage(Page): - def get_instance( self, payload: Dict[str, Any] ) -> TrustProductsEntityAssignmentsInstance: @@ -378,7 +378,6 @@ def __repr__(self) -> str: class TrustProductsEntityAssignmentsList(ListResource): - def __init__(self, version: Version, trust_product_sid: str): """ Initialize the TrustProductsEntityAssignmentsList @@ -880,10 +879,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = TrustProductsEntityAssignmentsPage( self._version, response, self._solution diff --git a/twilio/rest/trusthub/v1/trust_products/trust_products_evaluations.py b/twilio/rest/trusthub/v1/trust_products/trust_products_evaluations.py index 1c13c7e7b..837220a12 100644 --- a/twilio/rest/trusthub/v1/trust_products/trust_products_evaluations.py +++ b/twilio/rest/trusthub/v1/trust_products/trust_products_evaluations.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class TrustProductsEvaluationsInstance(InstanceResource): - class Status(object): COMPLIANT = "compliant" NONCOMPLIANT = "noncompliant" @@ -133,7 +133,6 @@ def __repr__(self) -> str: class TrustProductsEvaluationsContext(InstanceContext): - def __init__(self, version: Version, trust_product_sid: str, sid: str): """ Initialize the TrustProductsEvaluationsContext @@ -258,7 +257,6 @@ def __repr__(self) -> str: class TrustProductsEvaluationsPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> TrustProductsEvaluationsInstance: """ Build an instance of TrustProductsEvaluationsInstance @@ -281,7 +279,6 @@ def __repr__(self) -> str: class TrustProductsEvaluationsList(ListResource): - def __init__(self, version: Version, trust_product_sid: str): """ Initialize the TrustProductsEvaluationsList @@ -739,10 +736,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = TrustProductsEvaluationsPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/trusthub/v1/trust_products_provisional_copy.py b/twilio/rest/trusthub/v1/trust_products_provisional_copy.py new file mode 100644 index 000000000..cb2a3a5ad --- /dev/null +++ b/twilio/rest/trusthub/v1/trust_products_provisional_copy.py @@ -0,0 +1,420 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trusthub + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from datetime import datetime +from typing import Any, Dict, Optional +from twilio.base import deserialize, values +from twilio.base.api_response import ApiResponse +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 TrustProductsProvisionalCopyInstance(InstanceResource): + + """ + :ivar trust_product_sid: The unique SID identifier of the Trust Product. + :ivar account_sid: The unique SID identifier of the Account. + :ivar policy_sid: The unique SID identifier of the Policy. + :ivar friendly_name: A human readable description of this resource, up to 64 characters. + :ivar status: The verification status of the Customer-Profile resource. + :ivar email: The email address that will receive updates when the trust product resource changes status. + :ivar status_callback: The URL we call to inform your application of status changes. + :ivar valid_until: The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. + :ivar date_created: The date that this Trust Products Provisional Copy was created, given in ISO 8601 format. + :ivar date_updated: The date that this Trust Products Provisional Copy was updated, given in ISO 8601 format. + :ivar url: The URL of this resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + trust_product_sid: Optional[str] = None, + ): + super().__init__(version) + + self.trust_product_sid: Optional[str] = payload.get("trust_product_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.policy_sid: Optional[str] = payload.get("policy_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.status: Optional[str] = payload.get("status") + self.email: Optional[str] = payload.get("email") + self.status_callback: Optional[str] = payload.get("status_callback") + self.valid_until: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("valid_until") + ) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") + + self._solution = { + "trust_product_sid": trust_product_sid or self.trust_product_sid, + } + self._context: Optional[TrustProductsProvisionalCopyContext] = None + + @property + def _proxy(self) -> "TrustProductsProvisionalCopyContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: TrustProductsProvisionalCopyContext for this TrustProductsProvisionalCopyInstance + """ + if self._context is None: + self._context = TrustProductsProvisionalCopyContext( + self._version, + trust_product_sid=self._solution["trust_product_sid"], + ) + return self._context + + def create(self) -> "TrustProductsProvisionalCopyInstance": + """ + Create the TrustProductsProvisionalCopyInstance + + + :returns: The created TrustProductsProvisionalCopyInstance + """ + return self._proxy.create() + + async def create_async(self) -> "TrustProductsProvisionalCopyInstance": + """ + Asynchronous coroutine to create the TrustProductsProvisionalCopyInstance + + + :returns: The created TrustProductsProvisionalCopyInstance + """ + return await self._proxy.create_async() + + def create_with_http_info(self) -> ApiResponse: + """ + Create the TrustProductsProvisionalCopyInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.create_with_http_info() + + async def create_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to create the TrustProductsProvisionalCopyInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.create_with_http_info_async() + + def fetch(self) -> "TrustProductsProvisionalCopyInstance": + """ + Fetch the TrustProductsProvisionalCopyInstance + + + :returns: The fetched TrustProductsProvisionalCopyInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "TrustProductsProvisionalCopyInstance": + """ + Asynchronous coroutine to fetch the TrustProductsProvisionalCopyInstance + + + :returns: The fetched TrustProductsProvisionalCopyInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the TrustProductsProvisionalCopyInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the TrustProductsProvisionalCopyInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_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 TrustProductsProvisionalCopyContext(InstanceContext): + def __init__(self, version: Version, trust_product_sid: str): + """ + Initialize the TrustProductsProvisionalCopyContext + + :param version: Version that contains the resource + :param trust_product_sid: The unique SID identifier of the Trust Product. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "trust_product_sid": trust_product_sid, + } + self._uri = "/TrustProducts/{trust_product_sid}/ProvisionalCopy".format( + **self._solution + ) + + def _create(self) -> tuple: + """ + Internal helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of({}) + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.create_with_response_info( + method="POST", uri=self._uri, data=data, headers=headers + ) + + def create(self) -> TrustProductsProvisionalCopyInstance: + """ + Create the TrustProductsProvisionalCopyInstance + + + :returns: The created TrustProductsProvisionalCopyInstance + """ + payload, _, _ = self._create() + return TrustProductsProvisionalCopyInstance( + self._version, + payload, + trust_product_sid=self._solution["trust_product_sid"], + ) + + def create_with_http_info(self) -> ApiResponse: + """ + Create the TrustProductsProvisionalCopyInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._create() + instance = TrustProductsProvisionalCopyInstance( + self._version, + payload, + trust_product_sid=self._solution["trust_product_sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _create_async(self) -> tuple: + """ + Internal async helper for create operation + + Returns: + tuple: (payload, status_code, headers) + """ + + data = values.of({}) + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.create_with_response_info_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + async def create_async(self) -> TrustProductsProvisionalCopyInstance: + """ + Asynchronous coroutine to create the TrustProductsProvisionalCopyInstance + + + :returns: The created TrustProductsProvisionalCopyInstance + """ + payload, _, _ = await self._create_async() + return TrustProductsProvisionalCopyInstance( + self._version, + payload, + trust_product_sid=self._solution["trust_product_sid"], + ) + + async def create_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to create the TrustProductsProvisionalCopyInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._create_async() + instance = TrustProductsProvisionalCopyInstance( + self._version, + payload, + trust_product_sid=self._solution["trust_product_sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> TrustProductsProvisionalCopyInstance: + """ + Fetch the TrustProductsProvisionalCopyInstance + + + :returns: The fetched TrustProductsProvisionalCopyInstance + """ + payload, _, _ = self._fetch() + return TrustProductsProvisionalCopyInstance( + self._version, + payload, + trust_product_sid=self._solution["trust_product_sid"], + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the TrustProductsProvisionalCopyInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = TrustProductsProvisionalCopyInstance( + self._version, + payload, + trust_product_sid=self._solution["trust_product_sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> TrustProductsProvisionalCopyInstance: + """ + Asynchronous coroutine to fetch the TrustProductsProvisionalCopyInstance + + + :returns: The fetched TrustProductsProvisionalCopyInstance + """ + payload, _, _ = await self._fetch_async() + return TrustProductsProvisionalCopyInstance( + self._version, + payload, + trust_product_sid=self._solution["trust_product_sid"], + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the TrustProductsProvisionalCopyInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = TrustProductsProvisionalCopyInstance( + self._version, + payload, + trust_product_sid=self._solution["trust_product_sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format( + context + ) + + +class TrustProductsProvisionalCopyList(ListResource): + def __init__(self, version: Version): + """ + Initialize the TrustProductsProvisionalCopyList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, trust_product_sid: str) -> TrustProductsProvisionalCopyContext: + """ + Constructs a TrustProductsProvisionalCopyContext + + :param trust_product_sid: The unique SID identifier of the Trust Product. + """ + return TrustProductsProvisionalCopyContext( + self._version, trust_product_sid=trust_product_sid + ) + + def __call__(self, trust_product_sid: str) -> TrustProductsProvisionalCopyContext: + """ + Constructs a TrustProductsProvisionalCopyContext + + :param trust_product_sid: The unique SID identifier of the Trust Product. + """ + return TrustProductsProvisionalCopyContext( + self._version, trust_product_sid=trust_product_sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/verify/VerifyBase.py b/twilio/rest/verify/VerifyBase.py index 076f06314..8977a5043 100644 --- a/twilio/rest/verify/VerifyBase.py +++ b/twilio/rest/verify/VerifyBase.py @@ -17,7 +17,6 @@ class VerifyBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Verify Domain diff --git a/twilio/rest/verify/v2/__init__.py b/twilio/rest/verify/v2/__init__.py index 01bee13b0..c4f94aea3 100644 --- a/twilio/rest/verify/v2/__init__.py +++ b/twilio/rest/verify/v2/__init__.py @@ -26,7 +26,6 @@ class V2(Version): - def __init__(self, domain: Domain): """ Initialize the V2 version of Verify diff --git a/twilio/rest/verify/v2/form.py b/twilio/rest/verify/v2/form.py index 1376ef8ba..75a62dd68 100644 --- a/twilio/rest/verify/v2/form.py +++ b/twilio/rest/verify/v2/form.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,7 +23,6 @@ class FormInstance(InstanceResource): - class FormTypes(object): FORM_PUSH = "form-push" @@ -113,7 +113,6 @@ def __repr__(self) -> str: class FormContext(InstanceContext): - def __init__(self, version: Version, form_type: "FormInstance.FormTypes"): """ Initialize the FormContext @@ -230,7 +229,6 @@ def __repr__(self) -> str: class FormList(ListResource): - def __init__(self, version: Version): """ Initialize the FormList diff --git a/twilio/rest/verify/v2/safelist.py b/twilio/rest/verify/v2/safelist.py index a7f301ad7..98badf7af 100644 --- a/twilio/rest/verify/v2/safelist.py +++ b/twilio/rest/verify/v2/safelist.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class SafelistInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the SafeList resource. :ivar phone_number: The phone number in SafeList. @@ -143,7 +145,6 @@ def __repr__(self) -> str: class SafelistContext(InstanceContext): - def __init__(self, version: Version, phone_number: str): """ Initialize the SafelistContext @@ -328,7 +329,6 @@ def __repr__(self) -> str: class SafelistList(ListResource): - def __init__(self, version: Version): """ Initialize the SafelistList diff --git a/twilio/rest/verify/v2/service/__init__.py b/twilio/rest/verify/v2/service/__init__.py index 23f22e634..4868eb244 100644 --- a/twilio/rest/verify/v2/service/__init__.py +++ b/twilio/rest/verify/v2/service/__init__.py @@ -12,6 +12,7 @@ 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 @@ -37,6 +38,7 @@ class ServiceInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the Service resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. @@ -47,6 +49,7 @@ class ServiceInstance(InstanceResource): :ivar skip_sms_to_landlines: Whether to skip sending SMS verifications to landlines. Requires `lookup_enabled`. :ivar dtmf_input_required: Whether to ask the user to press a number before delivering the verify code in a phone call. :ivar tts_name: The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. + :ivar mailer_sid: Mailer SID associated to the verify service. Used for creating Verifications via the email channel. :ivar do_not_share_warning_enabled: Whether to add a security warning at the end of an SMS verification body. Disabled by default and applies only to SMS. Example SMS body: `Your AppName verification code is: 1234. Don’t share this code with anyone; our employees will never ask for the code` :ivar custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. :ivar push: Configurations for the Push factors (channel) created under this Service. @@ -79,6 +82,7 @@ def __init__( ) self.dtmf_input_required: Optional[bool] = payload.get("dtmf_input_required") self.tts_name: Optional[str] = payload.get("tts_name") + self.mailer_sid: Optional[str] = payload.get("mailer_sid") self.do_not_share_warning_enabled: Optional[bool] = payload.get( "do_not_share_warning_enabled" ) @@ -201,6 +205,7 @@ def update( dtmf_input_required: Union[bool, object] = values.unset, tts_name: Union[str, object] = values.unset, psd2_enabled: Union[bool, object] = values.unset, + mailer_sid: Union[str, object] = values.unset, do_not_share_warning_enabled: Union[bool, object] = values.unset, custom_code_enabled: Union[bool, object] = values.unset, push_include_date: Union[bool, object] = values.unset, @@ -231,6 +236,7 @@ def update( :param dtmf_input_required: Whether to ask the user to press a number before delivering the verify code in a phone call. :param tts_name: The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. :param psd2_enabled: Whether to pass PSD2 transaction parameters when starting a verification. + :param mailer_sid: Mailer SID associated to the verify service. Used for creating Verifications via the email channel. :param do_not_share_warning_enabled: Whether to add a privacy warning at the end of an SMS. **Disabled by default and applies only for SMS.** :param custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. :param push_include_date: Optional configuration for the Push factors. If true, include the date in the Challenge's response. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. **Deprecated** do not use this parameter. @@ -261,6 +267,7 @@ def update( dtmf_input_required=dtmf_input_required, tts_name=tts_name, psd2_enabled=psd2_enabled, + mailer_sid=mailer_sid, do_not_share_warning_enabled=do_not_share_warning_enabled, custom_code_enabled=custom_code_enabled, push_include_date=push_include_date, @@ -291,6 +298,7 @@ async def update_async( dtmf_input_required: Union[bool, object] = values.unset, tts_name: Union[str, object] = values.unset, psd2_enabled: Union[bool, object] = values.unset, + mailer_sid: Union[str, object] = values.unset, do_not_share_warning_enabled: Union[bool, object] = values.unset, custom_code_enabled: Union[bool, object] = values.unset, push_include_date: Union[bool, object] = values.unset, @@ -321,6 +329,7 @@ async def update_async( :param dtmf_input_required: Whether to ask the user to press a number before delivering the verify code in a phone call. :param tts_name: The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. :param psd2_enabled: Whether to pass PSD2 transaction parameters when starting a verification. + :param mailer_sid: Mailer SID associated to the verify service. Used for creating Verifications via the email channel. :param do_not_share_warning_enabled: Whether to add a privacy warning at the end of an SMS. **Disabled by default and applies only for SMS.** :param custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. :param push_include_date: Optional configuration for the Push factors. If true, include the date in the Challenge's response. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. **Deprecated** do not use this parameter. @@ -351,6 +360,7 @@ async def update_async( dtmf_input_required=dtmf_input_required, tts_name=tts_name, psd2_enabled=psd2_enabled, + mailer_sid=mailer_sid, do_not_share_warning_enabled=do_not_share_warning_enabled, custom_code_enabled=custom_code_enabled, push_include_date=push_include_date, @@ -381,6 +391,7 @@ def update_with_http_info( dtmf_input_required: Union[bool, object] = values.unset, tts_name: Union[str, object] = values.unset, psd2_enabled: Union[bool, object] = values.unset, + mailer_sid: Union[str, object] = values.unset, do_not_share_warning_enabled: Union[bool, object] = values.unset, custom_code_enabled: Union[bool, object] = values.unset, push_include_date: Union[bool, object] = values.unset, @@ -411,6 +422,7 @@ def update_with_http_info( :param dtmf_input_required: Whether to ask the user to press a number before delivering the verify code in a phone call. :param tts_name: The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. :param psd2_enabled: Whether to pass PSD2 transaction parameters when starting a verification. + :param mailer_sid: Mailer SID associated to the verify service. Used for creating Verifications via the email channel. :param do_not_share_warning_enabled: Whether to add a privacy warning at the end of an SMS. **Disabled by default and applies only for SMS.** :param custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. :param push_include_date: Optional configuration for the Push factors. If true, include the date in the Challenge's response. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. **Deprecated** do not use this parameter. @@ -441,6 +453,7 @@ def update_with_http_info( dtmf_input_required=dtmf_input_required, tts_name=tts_name, psd2_enabled=psd2_enabled, + mailer_sid=mailer_sid, do_not_share_warning_enabled=do_not_share_warning_enabled, custom_code_enabled=custom_code_enabled, push_include_date=push_include_date, @@ -471,6 +484,7 @@ async def update_with_http_info_async( dtmf_input_required: Union[bool, object] = values.unset, tts_name: Union[str, object] = values.unset, psd2_enabled: Union[bool, object] = values.unset, + mailer_sid: Union[str, object] = values.unset, do_not_share_warning_enabled: Union[bool, object] = values.unset, custom_code_enabled: Union[bool, object] = values.unset, push_include_date: Union[bool, object] = values.unset, @@ -501,6 +515,7 @@ async def update_with_http_info_async( :param dtmf_input_required: Whether to ask the user to press a number before delivering the verify code in a phone call. :param tts_name: The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. :param psd2_enabled: Whether to pass PSD2 transaction parameters when starting a verification. + :param mailer_sid: Mailer SID associated to the verify service. Used for creating Verifications via the email channel. :param do_not_share_warning_enabled: Whether to add a privacy warning at the end of an SMS. **Disabled by default and applies only for SMS.** :param custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. :param push_include_date: Optional configuration for the Push factors. If true, include the date in the Challenge's response. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. **Deprecated** do not use this parameter. @@ -531,6 +546,7 @@ async def update_with_http_info_async( dtmf_input_required=dtmf_input_required, tts_name=tts_name, psd2_enabled=psd2_enabled, + mailer_sid=mailer_sid, do_not_share_warning_enabled=do_not_share_warning_enabled, custom_code_enabled=custom_code_enabled, push_include_date=push_include_date, @@ -640,7 +656,6 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -835,6 +850,7 @@ def _update( dtmf_input_required: Union[bool, object] = values.unset, tts_name: Union[str, object] = values.unset, psd2_enabled: Union[bool, object] = values.unset, + mailer_sid: Union[str, object] = values.unset, do_not_share_warning_enabled: Union[bool, object] = values.unset, custom_code_enabled: Union[bool, object] = values.unset, push_include_date: Union[bool, object] = values.unset, @@ -873,6 +889,7 @@ def _update( "DtmfInputRequired": serialize.boolean_to_string(dtmf_input_required), "TtsName": tts_name, "Psd2Enabled": serialize.boolean_to_string(psd2_enabled), + "MailerSid": mailer_sid, "DoNotShareWarningEnabled": serialize.boolean_to_string( do_not_share_warning_enabled ), @@ -917,6 +934,7 @@ def update( dtmf_input_required: Union[bool, object] = values.unset, tts_name: Union[str, object] = values.unset, psd2_enabled: Union[bool, object] = values.unset, + mailer_sid: Union[str, object] = values.unset, do_not_share_warning_enabled: Union[bool, object] = values.unset, custom_code_enabled: Union[bool, object] = values.unset, push_include_date: Union[bool, object] = values.unset, @@ -947,6 +965,7 @@ def update( :param dtmf_input_required: Whether to ask the user to press a number before delivering the verify code in a phone call. :param tts_name: The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. :param psd2_enabled: Whether to pass PSD2 transaction parameters when starting a verification. + :param mailer_sid: Mailer SID associated to the verify service. Used for creating Verifications via the email channel. :param do_not_share_warning_enabled: Whether to add a privacy warning at the end of an SMS. **Disabled by default and applies only for SMS.** :param custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. :param push_include_date: Optional configuration for the Push factors. If true, include the date in the Challenge's response. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. **Deprecated** do not use this parameter. @@ -977,6 +996,7 @@ def update( dtmf_input_required=dtmf_input_required, tts_name=tts_name, psd2_enabled=psd2_enabled, + mailer_sid=mailer_sid, do_not_share_warning_enabled=do_not_share_warning_enabled, custom_code_enabled=custom_code_enabled, push_include_date=push_include_date, @@ -1008,6 +1028,7 @@ def update_with_http_info( dtmf_input_required: Union[bool, object] = values.unset, tts_name: Union[str, object] = values.unset, psd2_enabled: Union[bool, object] = values.unset, + mailer_sid: Union[str, object] = values.unset, do_not_share_warning_enabled: Union[bool, object] = values.unset, custom_code_enabled: Union[bool, object] = values.unset, push_include_date: Union[bool, object] = values.unset, @@ -1038,6 +1059,7 @@ def update_with_http_info( :param dtmf_input_required: Whether to ask the user to press a number before delivering the verify code in a phone call. :param tts_name: The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. :param psd2_enabled: Whether to pass PSD2 transaction parameters when starting a verification. + :param mailer_sid: Mailer SID associated to the verify service. Used for creating Verifications via the email channel. :param do_not_share_warning_enabled: Whether to add a privacy warning at the end of an SMS. **Disabled by default and applies only for SMS.** :param custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. :param push_include_date: Optional configuration for the Push factors. If true, include the date in the Challenge's response. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. **Deprecated** do not use this parameter. @@ -1068,6 +1090,7 @@ def update_with_http_info( dtmf_input_required=dtmf_input_required, tts_name=tts_name, psd2_enabled=psd2_enabled, + mailer_sid=mailer_sid, do_not_share_warning_enabled=do_not_share_warning_enabled, custom_code_enabled=custom_code_enabled, push_include_date=push_include_date, @@ -1100,6 +1123,7 @@ async def _update_async( dtmf_input_required: Union[bool, object] = values.unset, tts_name: Union[str, object] = values.unset, psd2_enabled: Union[bool, object] = values.unset, + mailer_sid: Union[str, object] = values.unset, do_not_share_warning_enabled: Union[bool, object] = values.unset, custom_code_enabled: Union[bool, object] = values.unset, push_include_date: Union[bool, object] = values.unset, @@ -1138,6 +1162,7 @@ async def _update_async( "DtmfInputRequired": serialize.boolean_to_string(dtmf_input_required), "TtsName": tts_name, "Psd2Enabled": serialize.boolean_to_string(psd2_enabled), + "MailerSid": mailer_sid, "DoNotShareWarningEnabled": serialize.boolean_to_string( do_not_share_warning_enabled ), @@ -1182,6 +1207,7 @@ async def update_async( dtmf_input_required: Union[bool, object] = values.unset, tts_name: Union[str, object] = values.unset, psd2_enabled: Union[bool, object] = values.unset, + mailer_sid: Union[str, object] = values.unset, do_not_share_warning_enabled: Union[bool, object] = values.unset, custom_code_enabled: Union[bool, object] = values.unset, push_include_date: Union[bool, object] = values.unset, @@ -1212,6 +1238,7 @@ async def update_async( :param dtmf_input_required: Whether to ask the user to press a number before delivering the verify code in a phone call. :param tts_name: The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. :param psd2_enabled: Whether to pass PSD2 transaction parameters when starting a verification. + :param mailer_sid: Mailer SID associated to the verify service. Used for creating Verifications via the email channel. :param do_not_share_warning_enabled: Whether to add a privacy warning at the end of an SMS. **Disabled by default and applies only for SMS.** :param custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. :param push_include_date: Optional configuration for the Push factors. If true, include the date in the Challenge's response. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. **Deprecated** do not use this parameter. @@ -1242,6 +1269,7 @@ async def update_async( dtmf_input_required=dtmf_input_required, tts_name=tts_name, psd2_enabled=psd2_enabled, + mailer_sid=mailer_sid, do_not_share_warning_enabled=do_not_share_warning_enabled, custom_code_enabled=custom_code_enabled, push_include_date=push_include_date, @@ -1273,6 +1301,7 @@ async def update_with_http_info_async( dtmf_input_required: Union[bool, object] = values.unset, tts_name: Union[str, object] = values.unset, psd2_enabled: Union[bool, object] = values.unset, + mailer_sid: Union[str, object] = values.unset, do_not_share_warning_enabled: Union[bool, object] = values.unset, custom_code_enabled: Union[bool, object] = values.unset, push_include_date: Union[bool, object] = values.unset, @@ -1303,6 +1332,7 @@ async def update_with_http_info_async( :param dtmf_input_required: Whether to ask the user to press a number before delivering the verify code in a phone call. :param tts_name: The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. :param psd2_enabled: Whether to pass PSD2 transaction parameters when starting a verification. + :param mailer_sid: Mailer SID associated to the verify service. Used for creating Verifications via the email channel. :param do_not_share_warning_enabled: Whether to add a privacy warning at the end of an SMS. **Disabled by default and applies only for SMS.** :param custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. :param push_include_date: Optional configuration for the Push factors. If true, include the date in the Challenge's response. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. **Deprecated** do not use this parameter. @@ -1333,6 +1363,7 @@ async def update_with_http_info_async( dtmf_input_required=dtmf_input_required, tts_name=tts_name, psd2_enabled=psd2_enabled, + mailer_sid=mailer_sid, do_not_share_warning_enabled=do_not_share_warning_enabled, custom_code_enabled=custom_code_enabled, push_include_date=push_include_date, @@ -1499,7 +1530,6 @@ def __repr__(self) -> str: class ServicePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -1518,7 +1548,6 @@ def __repr__(self) -> str: class ServiceList(ListResource): - def __init__(self, version: Version): """ Initialize the ServiceList @@ -1539,6 +1568,7 @@ def _create( dtmf_input_required: Union[bool, object] = values.unset, tts_name: Union[str, object] = values.unset, psd2_enabled: Union[bool, object] = values.unset, + mailer_sid: Union[str, object] = values.unset, do_not_share_warning_enabled: Union[bool, object] = values.unset, custom_code_enabled: Union[bool, object] = values.unset, push_include_date: Union[bool, object] = values.unset, @@ -1577,6 +1607,7 @@ def _create( "DtmfInputRequired": serialize.boolean_to_string(dtmf_input_required), "TtsName": tts_name, "Psd2Enabled": serialize.boolean_to_string(psd2_enabled), + "MailerSid": mailer_sid, "DoNotShareWarningEnabled": serialize.boolean_to_string( do_not_share_warning_enabled ), @@ -1621,6 +1652,7 @@ def create( dtmf_input_required: Union[bool, object] = values.unset, tts_name: Union[str, object] = values.unset, psd2_enabled: Union[bool, object] = values.unset, + mailer_sid: Union[str, object] = values.unset, do_not_share_warning_enabled: Union[bool, object] = values.unset, custom_code_enabled: Union[bool, object] = values.unset, push_include_date: Union[bool, object] = values.unset, @@ -1651,6 +1683,7 @@ def create( :param dtmf_input_required: Whether to ask the user to press a number before delivering the verify code in a phone call. :param tts_name: The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. :param psd2_enabled: Whether to pass PSD2 transaction parameters when starting a verification. + :param mailer_sid: Mailer SID associated to the verify service. Used for creating Verifications via the email channel. :param do_not_share_warning_enabled: Whether to add a security warning at the end of an SMS verification body. Disabled by default and applies only to SMS. Example SMS body: `Your AppName verification code is: 1234. Don’t share this code with anyone; our employees will never ask for the code` :param custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. :param push_include_date: Optional configuration for the Push factors. If true, include the date in the Challenge's response. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. **Deprecated** do not use this parameter. This timestamp value is the same one as the one found in `date_created`, please use that one instead. @@ -1681,6 +1714,7 @@ def create( dtmf_input_required=dtmf_input_required, tts_name=tts_name, psd2_enabled=psd2_enabled, + mailer_sid=mailer_sid, do_not_share_warning_enabled=do_not_share_warning_enabled, custom_code_enabled=custom_code_enabled, push_include_date=push_include_date, @@ -1712,6 +1746,7 @@ def create_with_http_info( dtmf_input_required: Union[bool, object] = values.unset, tts_name: Union[str, object] = values.unset, psd2_enabled: Union[bool, object] = values.unset, + mailer_sid: Union[str, object] = values.unset, do_not_share_warning_enabled: Union[bool, object] = values.unset, custom_code_enabled: Union[bool, object] = values.unset, push_include_date: Union[bool, object] = values.unset, @@ -1742,6 +1777,7 @@ def create_with_http_info( :param dtmf_input_required: Whether to ask the user to press a number before delivering the verify code in a phone call. :param tts_name: The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. :param psd2_enabled: Whether to pass PSD2 transaction parameters when starting a verification. + :param mailer_sid: Mailer SID associated to the verify service. Used for creating Verifications via the email channel. :param do_not_share_warning_enabled: Whether to add a security warning at the end of an SMS verification body. Disabled by default and applies only to SMS. Example SMS body: `Your AppName verification code is: 1234. Don’t share this code with anyone; our employees will never ask for the code` :param custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. :param push_include_date: Optional configuration for the Push factors. If true, include the date in the Challenge's response. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. **Deprecated** do not use this parameter. This timestamp value is the same one as the one found in `date_created`, please use that one instead. @@ -1772,6 +1808,7 @@ def create_with_http_info( dtmf_input_required=dtmf_input_required, tts_name=tts_name, psd2_enabled=psd2_enabled, + mailer_sid=mailer_sid, do_not_share_warning_enabled=do_not_share_warning_enabled, custom_code_enabled=custom_code_enabled, push_include_date=push_include_date, @@ -1804,6 +1841,7 @@ async def _create_async( dtmf_input_required: Union[bool, object] = values.unset, tts_name: Union[str, object] = values.unset, psd2_enabled: Union[bool, object] = values.unset, + mailer_sid: Union[str, object] = values.unset, do_not_share_warning_enabled: Union[bool, object] = values.unset, custom_code_enabled: Union[bool, object] = values.unset, push_include_date: Union[bool, object] = values.unset, @@ -1842,6 +1880,7 @@ async def _create_async( "DtmfInputRequired": serialize.boolean_to_string(dtmf_input_required), "TtsName": tts_name, "Psd2Enabled": serialize.boolean_to_string(psd2_enabled), + "MailerSid": mailer_sid, "DoNotShareWarningEnabled": serialize.boolean_to_string( do_not_share_warning_enabled ), @@ -1886,6 +1925,7 @@ async def create_async( dtmf_input_required: Union[bool, object] = values.unset, tts_name: Union[str, object] = values.unset, psd2_enabled: Union[bool, object] = values.unset, + mailer_sid: Union[str, object] = values.unset, do_not_share_warning_enabled: Union[bool, object] = values.unset, custom_code_enabled: Union[bool, object] = values.unset, push_include_date: Union[bool, object] = values.unset, @@ -1916,6 +1956,7 @@ async def create_async( :param dtmf_input_required: Whether to ask the user to press a number before delivering the verify code in a phone call. :param tts_name: The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. :param psd2_enabled: Whether to pass PSD2 transaction parameters when starting a verification. + :param mailer_sid: Mailer SID associated to the verify service. Used for creating Verifications via the email channel. :param do_not_share_warning_enabled: Whether to add a security warning at the end of an SMS verification body. Disabled by default and applies only to SMS. Example SMS body: `Your AppName verification code is: 1234. Don’t share this code with anyone; our employees will never ask for the code` :param custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. :param push_include_date: Optional configuration for the Push factors. If true, include the date in the Challenge's response. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. **Deprecated** do not use this parameter. This timestamp value is the same one as the one found in `date_created`, please use that one instead. @@ -1946,6 +1987,7 @@ async def create_async( dtmf_input_required=dtmf_input_required, tts_name=tts_name, psd2_enabled=psd2_enabled, + mailer_sid=mailer_sid, do_not_share_warning_enabled=do_not_share_warning_enabled, custom_code_enabled=custom_code_enabled, push_include_date=push_include_date, @@ -1977,6 +2019,7 @@ async def create_with_http_info_async( dtmf_input_required: Union[bool, object] = values.unset, tts_name: Union[str, object] = values.unset, psd2_enabled: Union[bool, object] = values.unset, + mailer_sid: Union[str, object] = values.unset, do_not_share_warning_enabled: Union[bool, object] = values.unset, custom_code_enabled: Union[bool, object] = values.unset, push_include_date: Union[bool, object] = values.unset, @@ -2007,6 +2050,7 @@ async def create_with_http_info_async( :param dtmf_input_required: Whether to ask the user to press a number before delivering the verify code in a phone call. :param tts_name: The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. :param psd2_enabled: Whether to pass PSD2 transaction parameters when starting a verification. + :param mailer_sid: Mailer SID associated to the verify service. Used for creating Verifications via the email channel. :param do_not_share_warning_enabled: Whether to add a security warning at the end of an SMS verification body. Disabled by default and applies only to SMS. Example SMS body: `Your AppName verification code is: 1234. Don’t share this code with anyone; our employees will never ask for the code` :param custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. :param push_include_date: Optional configuration for the Push factors. If true, include the date in the Challenge's response. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. **Deprecated** do not use this parameter. This timestamp value is the same one as the one found in `date_created`, please use that one instead. @@ -2037,6 +2081,7 @@ async def create_with_http_info_async( dtmf_input_required=dtmf_input_required, tts_name=tts_name, psd2_enabled=psd2_enabled, + mailer_sid=mailer_sid, do_not_share_warning_enabled=do_not_share_warning_enabled, custom_code_enabled=custom_code_enabled, push_include_date=push_include_date, @@ -2391,10 +2436,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ServicePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/verify/v2/service/access_token.py b/twilio/rest/verify/v2/service/access_token.py index 9959ea424..e7080b2bd 100644 --- a/twilio/rest/verify/v2/service/access_token.py +++ b/twilio/rest/verify/v2/service/access_token.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, values @@ -23,7 +24,6 @@ class AccessTokenInstance(InstanceResource): - class FactorTypes(object): PUSH = "push" @@ -133,7 +133,6 @@ def __repr__(self) -> str: class AccessTokenContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the AccessTokenContext @@ -258,7 +257,6 @@ def __repr__(self) -> str: class AccessTokenList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the AccessTokenList diff --git a/twilio/rest/verify/v2/service/approve_challenge.py b/twilio/rest/verify/v2/service/approve_challenge.py index 8681908a1..6b4c3ccf9 100644 --- a/twilio/rest/verify/v2/service/approve_challenge.py +++ b/twilio/rest/verify/v2/service/approve_challenge.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional from twilio.base import deserialize, values @@ -23,7 +24,6 @@ class ApproveChallengeInstance(InstanceResource): - class ApprovePasskeysChallengeRequest(object): """ :ivar id: A [base64url](https://base64.guru/standards/base64url) encoded representation of `rawId`. @@ -34,12 +34,11 @@ class ApprovePasskeysChallengeRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.id: Optional[str] = payload.get("id") self.raw_id: Optional[str] = payload.get("raw_id") - self.authenticator_attachment: Optional["ApproveChallengeInstance.str"] = ( - payload.get("authenticator_attachment") - ) + self.authenticator_attachment: Optional[ + "ApproveChallengeInstance.str" + ] = payload.get("authenticator_attachment") self.type: Optional["ApproveChallengeInstance.str"] = payload.get("type") self.response: Optional[ ApproveChallengeList.ApprovePasskeysChallengeRequestResponse @@ -51,9 +50,9 @@ def to_dict(self): "raw_id": self.raw_id, "authenticator_attachment": self.authenticator_attachment, "type": self.type, - "response": ( - self.response.to_dict() if self.response is not None else None - ), + "response": self.response.to_dict() + if self.response is not None + else None, } class ApprovePasskeysChallengeRequestResponse(object): @@ -65,7 +64,6 @@ class ApprovePasskeysChallengeRequestResponse(object): """ def __init__(self, payload: Dict[str, Any]): - self.authenticator_data: Optional[str] = payload.get("authenticator_data") self.client_data_json: Optional[str] = payload.get("client_data_json") self.signature: Optional[str] = payload.get("signature") @@ -147,7 +145,6 @@ def __repr__(self) -> str: class ApproveChallengeList(ListResource): - class ApprovePasskeysChallengeRequest(object): """ :ivar id: A [base64url](https://base64.guru/standards/base64url) encoded representation of `rawId`. @@ -158,12 +155,11 @@ class ApprovePasskeysChallengeRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.id: Optional[str] = payload.get("id") self.raw_id: Optional[str] = payload.get("raw_id") - self.authenticator_attachment: Optional["ApproveChallengeInstance.str"] = ( - payload.get("authenticator_attachment") - ) + self.authenticator_attachment: Optional[ + "ApproveChallengeInstance.str" + ] = payload.get("authenticator_attachment") self.type: Optional["ApproveChallengeInstance.str"] = payload.get("type") self.response: Optional[ ApproveChallengeList.ApprovePasskeysChallengeRequestResponse @@ -175,9 +171,9 @@ def to_dict(self): "raw_id": self.raw_id, "authenticator_attachment": self.authenticator_attachment, "type": self.type, - "response": ( - self.response.to_dict() if self.response is not None else None - ), + "response": self.response.to_dict() + if self.response is not None + else None, } class ApprovePasskeysChallengeRequestResponse(object): @@ -189,7 +185,6 @@ class ApprovePasskeysChallengeRequestResponse(object): """ def __init__(self, payload: Dict[str, Any]): - self.authenticator_data: Optional[str] = payload.get("authenticator_data") self.client_data_json: Optional[str] = payload.get("client_data_json") self.signature: Optional[str] = payload.get("signature") diff --git a/twilio/rest/verify/v2/service/entity/__init__.py b/twilio/rest/verify/v2/service/entity/__init__.py index e05a3b88c..a715b90de 100644 --- a/twilio/rest/verify/v2/service/entity/__init__.py +++ b/twilio/rest/verify/v2/service/entity/__init__.py @@ -12,6 +12,7 @@ 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 @@ -27,6 +28,7 @@ class EntityInstance(InstanceResource): + """ :ivar sid: A 34 character string that uniquely identifies this Entity. :ivar identity: The unique external identifier for the Entity of the Service. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. @@ -186,7 +188,6 @@ def __repr__(self) -> str: class EntityContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, identity: str): """ Initialize the EntityContext @@ -422,7 +423,6 @@ def __repr__(self) -> str: class EntityPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> EntityInstance: """ Build an instance of EntityInstance @@ -443,7 +443,6 @@ def __repr__(self) -> str: class EntityList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the EntityList @@ -891,10 +890,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = EntityPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/verify/v2/service/entity/challenge/__init__.py b/twilio/rest/verify/v2/service/entity/challenge/__init__.py index 1e6428a78..478dceb23 100644 --- a/twilio/rest/verify/v2/service/entity/challenge/__init__.py +++ b/twilio/rest/verify/v2/service/entity/challenge/__init__.py @@ -12,6 +12,7 @@ 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 @@ -25,7 +26,6 @@ class ChallengeInstance(InstanceResource): - class ChallengeReasons(object): NONE = "none" NOT_NEEDED = "not_needed" @@ -98,9 +98,9 @@ def __init__( self.status: Optional["ChallengeInstance.ChallengeStatuses"] = payload.get( "status" ) - self.responded_reason: Optional["ChallengeInstance.ChallengeReasons"] = ( - payload.get("responded_reason") - ) + self.responded_reason: Optional[ + "ChallengeInstance.ChallengeReasons" + ] = payload.get("responded_reason") self.details: Optional[Dict[str, object]] = payload.get("details") self.hidden_details: Optional[Dict[str, object]] = payload.get("hidden_details") self.metadata: Optional[Dict[str, object]] = payload.get("metadata") @@ -260,7 +260,6 @@ def __repr__(self) -> str: class ChallengeContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, identity: str, sid: str): """ Initialize the ChallengeContext @@ -561,7 +560,6 @@ def __repr__(self) -> str: class ChallengePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ChallengeInstance: """ Build an instance of ChallengeInstance @@ -585,7 +583,6 @@ def __repr__(self) -> str: class ChallengeList(ListResource): - def __init__(self, version: Version, service_sid: str, identity: str): """ Initialize the ChallengeList @@ -1273,10 +1270,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ChallengePage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/verify/v2/service/entity/challenge/notification.py b/twilio/rest/verify/v2/service/entity/challenge/notification.py index 4250597da..fda1d3f55 100644 --- a/twilio/rest/verify/v2/service/entity/challenge/notification.py +++ b/twilio/rest/verify/v2/service/entity/challenge/notification.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, values @@ -23,6 +24,7 @@ class NotificationInstance(InstanceResource): + """ :ivar sid: A 34 character string that uniquely identifies this Notification. :ivar account_sid: The unique SID identifier of the Account. @@ -74,7 +76,6 @@ def __repr__(self) -> str: class NotificationList(ListResource): - def __init__( self, version: Version, service_sid: str, identity: str, challenge_sid: str ): diff --git a/twilio/rest/verify/v2/service/entity/factor.py b/twilio/rest/verify/v2/service/entity/factor.py index 6a07ebe3f..4e3499241 100644 --- a/twilio/rest/verify/v2/service/entity/factor.py +++ b/twilio/rest/verify/v2/service/entity/factor.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class FactorInstance(InstanceResource): - class FactorStatuses(object): UNVERIFIED = "unverified" VERIFIED = "verified" @@ -348,7 +348,6 @@ def __repr__(self) -> str: class FactorContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, identity: str, sid: str): """ Initialize the FactorContext @@ -817,7 +816,6 @@ def __repr__(self) -> str: class FactorPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> FactorInstance: """ Build an instance of FactorInstance @@ -841,7 +839,6 @@ def __repr__(self) -> str: class FactorList(ListResource): - def __init__(self, version: Version, service_sid: str, identity: str): """ Initialize the FactorList @@ -1193,10 +1190,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = FactorPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/verify/v2/service/entity/new_factor.py b/twilio/rest/verify/v2/service/entity/new_factor.py index 79184c0e7..ad0bb6768 100644 --- a/twilio/rest/verify/v2/service/entity/new_factor.py +++ b/twilio/rest/verify/v2/service/entity/new_factor.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, serialize, values @@ -23,7 +24,6 @@ class NewFactorInstance(InstanceResource): - class FactorStatuses(object): UNVERIFIED = "unverified" VERIFIED = "verified" @@ -106,7 +106,6 @@ def __repr__(self) -> str: class NewFactorList(ListResource): - def __init__(self, version: Version, service_sid: str, identity: str): """ Initialize the NewFactorList diff --git a/twilio/rest/verify/v2/service/messaging_configuration.py b/twilio/rest/verify/v2/service/messaging_configuration.py index 898078739..02176f981 100644 --- a/twilio/rest/verify/v2/service/messaging_configuration.py +++ b/twilio/rest/verify/v2/service/messaging_configuration.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class MessagingConfigurationInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/verify/api/service) that the resource is associated with. @@ -212,7 +214,6 @@ def __repr__(self) -> str: class MessagingConfigurationContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, country: str): """ Initialize the MessagingConfigurationContext @@ -527,7 +528,6 @@ def __repr__(self) -> str: class MessagingConfigurationPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> MessagingConfigurationInstance: """ Build an instance of MessagingConfigurationInstance @@ -548,7 +548,6 @@ def __repr__(self) -> str: class MessagingConfigurationList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the MessagingConfigurationList @@ -1020,10 +1019,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = MessagingConfigurationPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/verify/v2/service/new_challenge.py b/twilio/rest/verify/v2/service/new_challenge.py index 26ade638b..627057091 100644 --- a/twilio/rest/verify/v2/service/new_challenge.py +++ b/twilio/rest/verify/v2/service/new_challenge.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional from twilio.base import deserialize, values @@ -23,7 +24,6 @@ class NewChallengeInstance(InstanceResource): - class CreatePasskeysChallengeRequest(object): """ :ivar identity: @@ -31,7 +31,6 @@ class CreatePasskeysChallengeRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.identity: Optional[str] = payload.get("identity") self.factor_sid: Optional[str] = payload.get("factor_sid") @@ -181,7 +180,6 @@ def __repr__(self) -> str: class NewChallengeContext(InstanceContext): - class CreatePasskeysChallengeRequest(object): """ :ivar identity: @@ -189,7 +187,6 @@ class CreatePasskeysChallengeRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.identity: Optional[str] = payload.get("identity") self.factor_sid: Optional[str] = payload.get("factor_sid") @@ -339,7 +336,6 @@ def __repr__(self) -> str: class NewChallengeList(ListResource): - class CreatePasskeysChallengeRequest(object): """ :ivar identity: @@ -347,7 +343,6 @@ class CreatePasskeysChallengeRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.identity: Optional[str] = payload.get("identity") self.factor_sid: Optional[str] = payload.get("factor_sid") diff --git a/twilio/rest/verify/v2/service/new_factor.py b/twilio/rest/verify/v2/service/new_factor.py index d6a14ed9a..1a0159995 100644 --- a/twilio/rest/verify/v2/service/new_factor.py +++ b/twilio/rest/verify/v2/service/new_factor.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, List, Optional from twilio.base import deserialize, values @@ -23,7 +24,6 @@ class NewFactorInstance(InstanceResource): - class CreateNewPasskeysFactorRequest(object): """ :ivar friendly_name: @@ -32,7 +32,6 @@ class CreateNewPasskeysFactorRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.friendly_name: Optional[str] = payload.get("friendly_name") self.identity: Optional[str] = payload.get("identity") self.config: Optional[ @@ -55,27 +54,24 @@ class CreateNewPasskeysFactorRequestConfig(object): """ def __init__(self, payload: Dict[str, Any]): - self.relying_party: Optional[ NewFactorList.CreateNewPasskeysFactorRequestConfigRelyingParty ] = payload.get("relying_party") - self.authenticator_attachment: Optional["NewFactorInstance.str"] = ( - payload.get("authenticator_attachment") - ) - self.discoverable_credentials: Optional["NewFactorInstance.str"] = ( - payload.get("discoverable_credentials") - ) + self.authenticator_attachment: Optional[ + "NewFactorInstance.str" + ] = payload.get("authenticator_attachment") + self.discoverable_credentials: Optional[ + "NewFactorInstance.str" + ] = payload.get("discoverable_credentials") self.user_verification: Optional["NewFactorInstance.str"] = payload.get( "user_verification" ) def to_dict(self): return { - "relying_party": ( - self.relying_party.to_dict() - if self.relying_party is not None - else None - ), + "relying_party": self.relying_party.to_dict() + if self.relying_party is not None + else None, "authenticator_attachment": self.authenticator_attachment, "discoverable_credentials": self.discoverable_credentials, "user_verification": self.user_verification, @@ -89,7 +85,6 @@ class CreateNewPasskeysFactorRequestConfigRelyingParty(object): """ def __init__(self, payload: Dict[str, Any]): - self.id: Optional[str] = payload.get("id") self.name: Optional[str] = payload.get("name") self.origins: Optional[List[str]] = payload.get("origins") @@ -157,7 +152,6 @@ def __repr__(self) -> str: class NewFactorList(ListResource): - class CreateNewPasskeysFactorRequest(object): """ :ivar friendly_name: @@ -166,7 +160,6 @@ class CreateNewPasskeysFactorRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.friendly_name: Optional[str] = payload.get("friendly_name") self.identity: Optional[str] = payload.get("identity") self.config: Optional[ @@ -189,27 +182,24 @@ class CreateNewPasskeysFactorRequestConfig(object): """ def __init__(self, payload: Dict[str, Any]): - self.relying_party: Optional[ NewFactorList.CreateNewPasskeysFactorRequestConfigRelyingParty ] = payload.get("relying_party") - self.authenticator_attachment: Optional["NewFactorInstance.str"] = ( - payload.get("authenticator_attachment") - ) - self.discoverable_credentials: Optional["NewFactorInstance.str"] = ( - payload.get("discoverable_credentials") - ) + self.authenticator_attachment: Optional[ + "NewFactorInstance.str" + ] = payload.get("authenticator_attachment") + self.discoverable_credentials: Optional[ + "NewFactorInstance.str" + ] = payload.get("discoverable_credentials") self.user_verification: Optional["NewFactorInstance.str"] = payload.get( "user_verification" ) def to_dict(self): return { - "relying_party": ( - self.relying_party.to_dict() - if self.relying_party is not None - else None - ), + "relying_party": self.relying_party.to_dict() + if self.relying_party is not None + else None, "authenticator_attachment": self.authenticator_attachment, "discoverable_credentials": self.discoverable_credentials, "user_verification": self.user_verification, @@ -223,7 +213,6 @@ class CreateNewPasskeysFactorRequestConfigRelyingParty(object): """ def __init__(self, payload: Dict[str, Any]): - self.id: Optional[str] = payload.get("id") self.name: Optional[str] = payload.get("name") self.origins: Optional[List[str]] = payload.get("origins") diff --git a/twilio/rest/verify/v2/service/new_verify_factor.py b/twilio/rest/verify/v2/service/new_verify_factor.py index 5d32c3d08..5a0715b35 100644 --- a/twilio/rest/verify/v2/service/new_verify_factor.py +++ b/twilio/rest/verify/v2/service/new_verify_factor.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, List, Optional from twilio.base import deserialize, values @@ -23,7 +24,6 @@ class NewVerifyFactorInstance(InstanceResource): - class VerifyPasskeysFactorRequest(object): """ :ivar id: A [base64url](https://base64.guru/standards/base64url) encoded representation of `rawId`. @@ -34,12 +34,11 @@ class VerifyPasskeysFactorRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.id: Optional[str] = payload.get("id") self.raw_id: Optional[str] = payload.get("raw_id") - self.authenticator_attachment: Optional["NewVerifyFactorInstance.str"] = ( - payload.get("authenticator_attachment") - ) + self.authenticator_attachment: Optional[ + "NewVerifyFactorInstance.str" + ] = payload.get("authenticator_attachment") self.type: Optional["NewVerifyFactorInstance.str"] = payload.get("type") self.response: Optional[ NewVerifyFactorList.VerifyPasskeysFactorRequestResponse @@ -51,9 +50,9 @@ def to_dict(self): "raw_id": self.raw_id, "authenticator_attachment": self.authenticator_attachment, "type": self.type, - "response": ( - self.response.to_dict() if self.response is not None else None - ), + "response": self.response.to_dict() + if self.response is not None + else None, } class VerifyPasskeysFactorRequestResponse(object): @@ -64,7 +63,6 @@ class VerifyPasskeysFactorRequestResponse(object): """ def __init__(self, payload: Dict[str, Any]): - self.attestation_object: Optional[str] = payload.get("attestation_object") self.client_data_json: Optional[str] = payload.get("client_data_json") self.transports: Optional[List[Enumstr]] = payload.get("transports") @@ -128,7 +126,6 @@ def __repr__(self) -> str: class NewVerifyFactorList(ListResource): - class VerifyPasskeysFactorRequest(object): """ :ivar id: A [base64url](https://base64.guru/standards/base64url) encoded representation of `rawId`. @@ -139,12 +136,11 @@ class VerifyPasskeysFactorRequest(object): """ def __init__(self, payload: Dict[str, Any]): - self.id: Optional[str] = payload.get("id") self.raw_id: Optional[str] = payload.get("raw_id") - self.authenticator_attachment: Optional["NewVerifyFactorInstance.str"] = ( - payload.get("authenticator_attachment") - ) + self.authenticator_attachment: Optional[ + "NewVerifyFactorInstance.str" + ] = payload.get("authenticator_attachment") self.type: Optional["NewVerifyFactorInstance.str"] = payload.get("type") self.response: Optional[ NewVerifyFactorList.VerifyPasskeysFactorRequestResponse @@ -156,9 +152,9 @@ def to_dict(self): "raw_id": self.raw_id, "authenticator_attachment": self.authenticator_attachment, "type": self.type, - "response": ( - self.response.to_dict() if self.response is not None else None - ), + "response": self.response.to_dict() + if self.response is not None + else None, } class VerifyPasskeysFactorRequestResponse(object): @@ -169,7 +165,6 @@ class VerifyPasskeysFactorRequestResponse(object): """ def __init__(self, payload: Dict[str, Any]): - self.attestation_object: Optional[str] = payload.get("attestation_object") self.client_data_json: Optional[str] = payload.get("client_data_json") self.transports: Optional[List[Enumstr]] = payload.get("transports") diff --git a/twilio/rest/verify/v2/service/rate_limit/__init__.py b/twilio/rest/verify/v2/service/rate_limit/__init__.py index d5e047454..0ff7ed605 100644 --- a/twilio/rest/verify/v2/service/rate_limit/__init__.py +++ b/twilio/rest/verify/v2/service/rate_limit/__init__.py @@ -12,6 +12,7 @@ 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 @@ -25,6 +26,7 @@ class RateLimitInstance(InstanceResource): + """ :ivar sid: A 34 character string that uniquely identifies this Rate Limit. :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/verify/api/service) the resource is associated with. @@ -228,7 +230,6 @@ def __repr__(self) -> str: class RateLimitContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the RateLimitContext @@ -558,7 +559,6 @@ def __repr__(self) -> str: class RateLimitPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> RateLimitInstance: """ Build an instance of RateLimitInstance @@ -579,7 +579,6 @@ def __repr__(self) -> str: class RateLimitList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the RateLimitList @@ -1051,10 +1050,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = RateLimitPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/verify/v2/service/rate_limit/bucket.py b/twilio/rest/verify/v2/service/rate_limit/bucket.py index 2b866327a..f093a7ddd 100644 --- a/twilio/rest/verify/v2/service/rate_limit/bucket.py +++ b/twilio/rest/verify/v2/service/rate_limit/bucket.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class BucketInstance(InstanceResource): + """ :ivar sid: A 34 character string that uniquely identifies this Bucket. :ivar rate_limit_sid: The Twilio-provided string that uniquely identifies the Rate Limit resource. @@ -239,7 +241,6 @@ def __repr__(self) -> str: class BucketContext(InstanceContext): - def __init__( self, version: Version, service_sid: str, rate_limit_sid: str, sid: str ): @@ -590,7 +591,6 @@ def __repr__(self) -> str: class BucketPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> BucketInstance: """ Build an instance of BucketInstance @@ -614,7 +614,6 @@ def __repr__(self) -> str: class BucketList(ListResource): - def __init__(self, version: Version, service_sid: str, rate_limit_sid: str): """ Initialize the BucketList @@ -1088,10 +1087,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = BucketPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/verify/v2/service/verification.py b/twilio/rest/verify/v2/service/verification.py index 9c94d3040..0ae8b83b5 100644 --- a/twilio/rest/verify/v2/service/verification.py +++ b/twilio/rest/verify/v2/service/verification.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, List, Optional, Union from twilio.base import deserialize, serialize, values @@ -23,7 +24,6 @@ class VerificationInstance(InstanceResource): - class Channel(object): SMS = "sms" CALL = "call" @@ -211,7 +211,6 @@ def __repr__(self) -> str: class VerificationContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the VerificationContext @@ -454,7 +453,6 @@ def __repr__(self) -> str: class VerificationList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the VerificationList diff --git a/twilio/rest/verify/v2/service/verification_check.py b/twilio/rest/verify/v2/service/verification_check.py index b80c8d6d4..04c116e1a 100644 --- a/twilio/rest/verify/v2/service/verification_check.py +++ b/twilio/rest/verify/v2/service/verification_check.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, List, Optional, Union from twilio.base import deserialize, values @@ -23,7 +24,6 @@ class VerificationCheckInstance(InstanceResource): - class Channel(object): SMS = "sms" CALL = "call" @@ -85,7 +85,6 @@ def __repr__(self) -> str: class VerificationCheckList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the VerificationCheckList diff --git a/twilio/rest/verify/v2/service/webhook.py b/twilio/rest/verify/v2/service/webhook.py index 5a2753f88..7e7f6de64 100644 --- a/twilio/rest/verify/v2/service/webhook.py +++ b/twilio/rest/verify/v2/service/webhook.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class WebhookInstance(InstanceResource): - class Methods(object): GET = "GET" POST = "POST" @@ -293,7 +293,6 @@ def __repr__(self) -> str: class WebhookContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the WebhookContext @@ -686,7 +685,6 @@ def __repr__(self) -> str: class WebhookPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> WebhookInstance: """ Build an instance of WebhookInstance @@ -707,7 +705,6 @@ def __repr__(self) -> str: class WebhookList(ListResource): - def __init__(self, version: Version, service_sid: str): """ Initialize the WebhookList @@ -1245,10 +1242,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = WebhookPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/verify/v2/template.py b/twilio/rest/verify/v2/template.py index 49b295f85..1bc1317fa 100644 --- a/twilio/rest/verify/v2/template.py +++ b/twilio/rest/verify/v2/template.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class TemplateInstance(InstanceResource): + """ :ivar sid: A 34 character string that uniquely identifies a Verification Template. :ivar account_sid: The unique SID identifier of the Account. @@ -51,7 +53,6 @@ def __repr__(self) -> str: class TemplatePage(Page): - def get_instance(self, payload: Dict[str, Any]) -> TemplateInstance: """ Build an instance of TemplateInstance @@ -70,7 +71,6 @@ def __repr__(self) -> str: class TemplateList(ListResource): - def __init__(self, version: Version): """ Initialize the TemplateList @@ -449,10 +449,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = TemplatePage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/verify/v2/verification_attempt.py b/twilio/rest/verify/v2/verification_attempt.py index 476f47bac..cb0cadcf0 100644 --- a/twilio/rest/verify/v2/verification_attempt.py +++ b/twilio/rest/verify/v2/verification_attempt.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class VerificationAttemptInstance(InstanceResource): - class Channels(object): SMS = "sms" CALL = "call" @@ -142,7 +142,6 @@ def __repr__(self) -> str: class VerificationAttemptContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the VerificationAttemptContext @@ -259,7 +258,6 @@ def __repr__(self) -> str: class VerificationAttemptPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> VerificationAttemptInstance: """ Build an instance of VerificationAttemptInstance @@ -278,7 +276,6 @@ def __repr__(self) -> str: class VerificationAttemptList(ListResource): - def __init__(self, version: Version): """ Initialize the VerificationAttemptList @@ -939,10 +936,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = VerificationAttemptPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/verify/v2/verification_attempts_summary.py b/twilio/rest/verify/v2/verification_attempts_summary.py index 0f226478b..3ae657255 100644 --- a/twilio/rest/verify/v2/verification_attempts_summary.py +++ b/twilio/rest/verify/v2/verification_attempts_summary.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional, Union from twilio.base import deserialize, serialize, values @@ -23,7 +24,6 @@ class VerificationAttemptsSummaryInstance(InstanceResource): - class Channels(object): SMS = "sms" CALL = "call" @@ -211,7 +211,6 @@ def __repr__(self) -> str: class VerificationAttemptsSummaryContext(InstanceContext): - def __init__(self, version: Version): """ Initialize the VerificationAttemptsSummaryContext @@ -453,7 +452,6 @@ def __repr__(self) -> str: class VerificationAttemptsSummaryList(ListResource): - def __init__(self, version: Version): """ Initialize the VerificationAttemptsSummaryList diff --git a/twilio/rest/video/VideoBase.py b/twilio/rest/video/VideoBase.py index 0d2cf7e36..2a2534566 100644 --- a/twilio/rest/video/VideoBase.py +++ b/twilio/rest/video/VideoBase.py @@ -17,7 +17,6 @@ class VideoBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Video Domain diff --git a/twilio/rest/video/v1/__init__.py b/twilio/rest/video/v1/__init__.py index 0667596a3..9cd9fcf35 100644 --- a/twilio/rest/video/v1/__init__.py +++ b/twilio/rest/video/v1/__init__.py @@ -24,7 +24,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Video diff --git a/twilio/rest/video/v1/composition.py b/twilio/rest/video/v1/composition.py index af5b5b480..669d60ba1 100644 --- a/twilio/rest/video/v1/composition.py +++ b/twilio/rest/video/v1/composition.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class CompositionInstance(InstanceResource): - class Format(object): MP4 = "mp4" WEBM = "webm" @@ -56,6 +56,7 @@ class Status(object): :ivar media_external_location: The URL of the media file associated with the composition when stored externally. See [External S3 Compositions](/docs/video/api/external-s3-compositions) for more details. :ivar status_callback: The URL called using the `status_callback_method` to send status information on every composition event. :ivar status_callback_method: The HTTP method used to call `status_callback`. Can be: `POST` or `GET`, defaults to `POST`. + :ivar encryption_key: :ivar url: The absolute URL of the resource. :ivar links: The URL of the media file associated with the composition. """ @@ -96,6 +97,7 @@ def __init__( self.status_callback_method: Optional[str] = payload.get( "status_callback_method" ) + self.encryption_key: Optional[str] = payload.get("encryption_key") self.url: Optional[str] = payload.get("url") self.links: Optional[Dict[str, object]] = payload.get("links") @@ -202,7 +204,6 @@ def __repr__(self) -> str: class CompositionContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the CompositionContext @@ -387,7 +388,6 @@ def __repr__(self) -> str: class CompositionPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> CompositionInstance: """ Build an instance of CompositionInstance @@ -406,7 +406,6 @@ def __repr__(self) -> str: class CompositionList(ListResource): - def __init__(self, version: Version): """ Initialize the CompositionList @@ -1149,10 +1148,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CompositionPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/video/v1/composition_hook.py b/twilio/rest/video/v1/composition_hook.py index bd93377a5..d343fef18 100644 --- a/twilio/rest/video/v1/composition_hook.py +++ b/twilio/rest/video/v1/composition_hook.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class CompositionHookInstance(InstanceResource): - class Format(object): MP4 = "mp4" WEBM = "webm" @@ -347,7 +347,6 @@ def __repr__(self) -> str: class CompositionHookContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the CompositionHookContext @@ -806,7 +805,6 @@ def __repr__(self) -> str: class CompositionHookPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> CompositionHookInstance: """ Build an instance of CompositionHookInstance @@ -825,7 +823,6 @@ def __repr__(self) -> str: class CompositionHookList(ListResource): - def __init__(self, version: Version): """ Initialize the CompositionHookList @@ -1584,10 +1581,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CompositionHookPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/video/v1/composition_settings.py b/twilio/rest/video/v1/composition_settings.py index ec04358b3..69a1a362f 100644 --- a/twilio/rest/video/v1/composition_settings.py +++ b/twilio/rest/video/v1/composition_settings.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class CompositionSettingsInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CompositionSettings resource. :ivar friendly_name: The string that you assigned to describe the resource and that will be shown in the console @@ -228,7 +230,6 @@ def __repr__(self) -> str: class CompositionSettingsContext(InstanceContext): - def __init__(self, version: Version): """ Initialize the CompositionSettingsContext @@ -534,7 +535,6 @@ def __repr__(self) -> str: class CompositionSettingsList(ListResource): - def __init__(self, version: Version): """ Initialize the CompositionSettingsList diff --git a/twilio/rest/video/v1/recording.py b/twilio/rest/video/v1/recording.py index ebbe0a124..1cd025197 100644 --- a/twilio/rest/video/v1/recording.py +++ b/twilio/rest/video/v1/recording.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class RecordingInstance(InstanceResource): - class Codec(object): VP8 = "VP8" H264 = "H264" @@ -50,6 +50,8 @@ class Type(object): :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource. :ivar status: :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_deleted: + :ivar date_updated: :ivar sid: The unique string that we created to identify the Recording resource. :ivar source_sid: The SID of the recording source. For a Room Recording, this value is a `track_sid`. :ivar size: The size of the recorded track, in bytes. @@ -64,6 +66,7 @@ class Type(object): :ivar media_external_location: The URL of the media file associated with the recording when stored externally. See [External S3 Recordings](/docs/video/api/external-s3-recordings) for more details. :ivar status_callback: The URL called using the `status_callback_method` to send status information on every recording event. :ivar status_callback_method: The HTTP method used to call `status_callback`. Can be: `POST` or `GET`, defaults to `POST`. + :ivar encryption_key: :ivar links: The URLs of related resources. """ @@ -77,6 +80,12 @@ def __init__( self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) + self.date_deleted: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_deleted") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) self.sid: Optional[str] = payload.get("sid") self.source_sid: Optional[str] = payload.get("source_sid") self.size: Optional[int] = payload.get("size") @@ -97,6 +106,7 @@ def __init__( self.status_callback_method: Optional[str] = payload.get( "status_callback_method" ) + self.encryption_key: Optional[str] = payload.get("encryption_key") self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { @@ -202,7 +212,6 @@ def __repr__(self) -> str: class RecordingContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the RecordingContext @@ -387,7 +396,6 @@ def __repr__(self) -> str: class RecordingPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> RecordingInstance: """ Build an instance of RecordingInstance @@ -406,7 +414,6 @@ def __repr__(self) -> str: class RecordingList(ListResource): - def __init__(self, version: Version): """ Initialize the RecordingList @@ -971,10 +978,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = RecordingPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/video/v1/recording_settings.py b/twilio/rest/video/v1/recording_settings.py index ce2373eb9..412edd8a5 100644 --- a/twilio/rest/video/v1/recording_settings.py +++ b/twilio/rest/video/v1/recording_settings.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class RecordingSettingsInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RecordingSettings resource. :ivar friendly_name: The string that you assigned to describe the resource and show the user in the console @@ -228,7 +230,6 @@ def __repr__(self) -> str: class RecordingSettingsContext(InstanceContext): - def __init__(self, version: Version): """ Initialize the RecordingSettingsContext @@ -534,7 +535,6 @@ def __repr__(self) -> str: class RecordingSettingsList(ListResource): - def __init__(self, version: Version): """ Initialize the RecordingSettingsList diff --git a/twilio/rest/video/v1/room/__init__.py b/twilio/rest/video/v1/room/__init__.py index 9a1bcefa4..2b4ecee51 100644 --- a/twilio/rest/video/v1/room/__init__.py +++ b/twilio/rest/video/v1/room/__init__.py @@ -12,6 +12,7 @@ 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 @@ -28,7 +29,6 @@ class RoomInstance(InstanceResource): - class RoomStatus(object): IN_PROGRESS = "in-progress" COMPLETED = "completed" @@ -268,7 +268,6 @@ def __repr__(self) -> str: class RoomContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the RoomContext @@ -532,7 +531,6 @@ def __repr__(self) -> str: class RoomPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> RoomInstance: """ Build an instance of RoomInstance @@ -551,7 +549,6 @@ def __repr__(self) -> str: class RoomList(ListResource): - def __init__(self, version: Version): """ Initialize the RoomList @@ -1430,10 +1427,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = RoomPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/video/v1/room/participant/__init__.py b/twilio/rest/video/v1/room/participant/__init__.py index 451351eeb..ef4dd70ef 100644 --- a/twilio/rest/video/v1/room/participant/__init__.py +++ b/twilio/rest/video/v1/room/participant/__init__.py @@ -12,6 +12,7 @@ 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 @@ -28,7 +29,6 @@ class ParticipantInstance(InstanceResource): - class Status(object): CONNECTED = "connected" DISCONNECTED = "disconnected" @@ -232,7 +232,6 @@ def __repr__(self) -> str: class ParticipantContext(InstanceContext): - def __init__(self, version: Version, room_sid: str, sid: str): """ Initialize the ParticipantContext @@ -536,7 +535,6 @@ def __repr__(self) -> str: class ParticipantPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ParticipantInstance: """ Build an instance of ParticipantInstance @@ -557,7 +555,6 @@ def __repr__(self) -> str: class ParticipantList(ListResource): - def __init__(self, version: Version, room_sid: str): """ Initialize the ParticipantList @@ -1055,10 +1052,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ParticipantPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/video/v1/room/participant/anonymize.py b/twilio/rest/video/v1/room/participant/anonymize.py index 90a242340..303eb2611 100644 --- a/twilio/rest/video/v1/room/participant/anonymize.py +++ b/twilio/rest/video/v1/room/participant/anonymize.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, Optional from twilio.base import deserialize, values @@ -23,7 +24,6 @@ class AnonymizeInstance(InstanceResource): - class Status(object): CONNECTED = "connected" DISCONNECTED = "disconnected" @@ -136,7 +136,6 @@ def __repr__(self) -> str: class AnonymizeContext(InstanceContext): - def __init__(self, version: Version, room_sid: str, sid: str): """ Initialize the AnonymizeContext @@ -263,7 +262,6 @@ def __repr__(self) -> str: class AnonymizeList(ListResource): - def __init__(self, version: Version, room_sid: str, sid: str): """ Initialize the AnonymizeList diff --git a/twilio/rest/video/v1/room/participant/published_track.py b/twilio/rest/video/v1/room/participant/published_track.py index 8969c8a16..e30674295 100644 --- a/twilio/rest/video/v1/room/participant/published_track.py +++ b/twilio/rest/video/v1/room/participant/published_track.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class PublishedTrackInstance(InstanceResource): - class Kind(object): AUDIO = "audio" VIDEO = "video" @@ -137,7 +137,6 @@ def __repr__(self) -> str: class PublishedTrackContext(InstanceContext): - def __init__(self, version: Version, room_sid: str, participant_sid: str, sid: str): """ Initialize the PublishedTrackContext @@ -268,7 +267,6 @@ def __repr__(self) -> str: class PublishedTrackPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> PublishedTrackInstance: """ Build an instance of PublishedTrackInstance @@ -292,7 +290,6 @@ def __repr__(self) -> str: class PublishedTrackList(ListResource): - def __init__(self, version: Version, room_sid: str, participant_sid: str): """ Initialize the PublishedTrackList @@ -646,10 +643,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = PublishedTrackPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/video/v1/room/participant/subscribe_rules.py b/twilio/rest/video/v1/room/participant/subscribe_rules.py index f13f7e647..7fa5e0f04 100644 --- a/twilio/rest/video/v1/room/participant/subscribe_rules.py +++ b/twilio/rest/video/v1/room/participant/subscribe_rules.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, List, Optional, Union from twilio.base import deserialize, serialize, values @@ -23,6 +24,7 @@ class SubscribeRulesInstance(InstanceResource): + """ :ivar participant_sid: The SID of the Participant resource for the Subscribe Rules. :ivar room_sid: The SID of the Room resource for the Subscribe Rules @@ -66,7 +68,6 @@ def __repr__(self) -> str: class SubscribeRulesList(ListResource): - def __init__(self, version: Version, room_sid: str, participant_sid: str): """ Initialize the SubscribeRulesList diff --git a/twilio/rest/video/v1/room/participant/subscribed_track.py b/twilio/rest/video/v1/room/participant/subscribed_track.py index 6a96ebe05..1a5476c9c 100644 --- a/twilio/rest/video/v1/room/participant/subscribed_track.py +++ b/twilio/rest/video/v1/room/participant/subscribed_track.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class SubscribedTrackInstance(InstanceResource): - class Kind(object): AUDIO = "audio" VIDEO = "video" @@ -139,7 +139,6 @@ def __repr__(self) -> str: class SubscribedTrackContext(InstanceContext): - def __init__(self, version: Version, room_sid: str, participant_sid: str, sid: str): """ Initialize the SubscribedTrackContext @@ -270,7 +269,6 @@ def __repr__(self) -> str: class SubscribedTrackPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SubscribedTrackInstance: """ Build an instance of SubscribedTrackInstance @@ -294,7 +292,6 @@ def __repr__(self) -> str: class SubscribedTrackList(ListResource): - def __init__(self, version: Version, room_sid: str, participant_sid: str): """ Initialize the SubscribedTrackList @@ -648,10 +645,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SubscribedTrackPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/video/v1/room/recording_rules.py b/twilio/rest/video/v1/room/recording_rules.py index d399cd03d..0dacf9c2c 100644 --- a/twilio/rest/video/v1/room/recording_rules.py +++ b/twilio/rest/video/v1/room/recording_rules.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, List, Optional, Union from twilio.base import deserialize, serialize, values @@ -23,6 +24,7 @@ class RecordingRulesInstance(InstanceResource): + """ :ivar room_sid: The SID of the Room resource for the Recording Rules :ivar rules: A collection of Recording Rules that describe how to include or exclude matching tracks for recording @@ -57,7 +59,6 @@ def __repr__(self) -> str: class RecordingRulesList(ListResource): - def __init__(self, version: Version, room_sid: str): """ Initialize the RecordingRulesList diff --git a/twilio/rest/video/v1/room/room_recording.py b/twilio/rest/video/v1/room/room_recording.py index 59b229c43..560b0474b 100644 --- a/twilio/rest/video/v1/room/room_recording.py +++ b/twilio/rest/video/v1/room/room_recording.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class RoomRecordingInstance(InstanceResource): - class Codec(object): VP8 = "VP8" H264 = "H264" @@ -50,6 +50,8 @@ class Type(object): :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RoomRecording resource. :ivar status: :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_deleted: + :ivar date_updated: :ivar sid: The unique string that we created to identify the RoomRecording resource. :ivar source_sid: The SID of the recording source. For a Room Recording, this value is a `track_sid`. :ivar size: The size of the recorded track in bytes. @@ -62,6 +64,7 @@ class Type(object): :ivar track_name: The name that was given to the source track of the recording. If no name is given, the `source_sid` is used. :ivar offset: The time in milliseconds elapsed between an arbitrary point in time, common to all group rooms, and the moment when the source room of this track started. This information provides a synchronization mechanism for recordings belonging to the same room. :ivar media_external_location: The URL of the media file associated with the recording when stored externally. See [External S3 Recordings](/docs/video/api/external-s3-recordings) for more details. + :ivar encryption_key: :ivar room_sid: The SID of the Room resource the recording is associated with. :ivar links: The URLs of related resources. """ @@ -80,6 +83,12 @@ def __init__( self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) + self.date_deleted: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_deleted") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) self.sid: Optional[str] = payload.get("sid") self.source_sid: Optional[str] = payload.get("source_sid") self.size: Optional[int] = payload.get("size") @@ -96,6 +105,7 @@ def __init__( self.media_external_location: Optional[str] = payload.get( "media_external_location" ) + self.encryption_key: Optional[str] = payload.get("encryption_key") self.room_sid: Optional[str] = payload.get("room_sid") self.links: Optional[Dict[str, object]] = payload.get("links") @@ -204,7 +214,6 @@ def __repr__(self) -> str: class RoomRecordingContext(InstanceContext): - def __init__(self, version: Version, room_sid: str, sid: str): """ Initialize the RoomRecordingContext @@ -395,7 +404,6 @@ def __repr__(self) -> str: class RoomRecordingPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> RoomRecordingInstance: """ Build an instance of RoomRecordingInstance @@ -416,7 +424,6 @@ def __repr__(self) -> str: class RoomRecordingList(ListResource): - def __init__(self, version: Version, room_sid: str): """ Initialize the RoomRecordingList @@ -914,10 +921,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = RoomRecordingPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/video/v1/room/transcriptions.py b/twilio/rest/video/v1/room/transcriptions.py index 1c31b6c8b..1d640e51c 100644 --- a/twilio/rest/video/v1/room/transcriptions.py +++ b/twilio/rest/video/v1/room/transcriptions.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class TranscriptionsInstance(InstanceResource): - class Status(object): STARTED = "started" STOPPED = "stopped" @@ -216,7 +216,6 @@ def __repr__(self) -> str: class TranscriptionsContext(InstanceContext): - def __init__(self, version: Version, room_sid: str, ttid: str): """ Initialize the TranscriptionsContext @@ -487,7 +486,6 @@ def __repr__(self) -> str: class TranscriptionsPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> TranscriptionsInstance: """ Build an instance of TranscriptionsInstance @@ -508,7 +506,6 @@ def __repr__(self) -> str: class TranscriptionsList(ListResource): - def __init__(self, version: Version, room_sid: str): """ Initialize the TranscriptionsList @@ -968,10 +965,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = TranscriptionsPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/voice/VoiceBase.py b/twilio/rest/voice/VoiceBase.py index 4394ab1a2..21a11ce35 100644 --- a/twilio/rest/voice/VoiceBase.py +++ b/twilio/rest/voice/VoiceBase.py @@ -17,7 +17,6 @@ class VoiceBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Voice Domain diff --git a/twilio/rest/voice/v1/__init__.py b/twilio/rest/voice/v1/__init__.py index 75c0c7fc7..e836988a8 100644 --- a/twilio/rest/voice/v1/__init__.py +++ b/twilio/rest/voice/v1/__init__.py @@ -20,11 +20,11 @@ from twilio.rest.voice.v1.connection_policy import ConnectionPolicyList from twilio.rest.voice.v1.dialing_permissions import DialingPermissionsList from twilio.rest.voice.v1.ip_record import IpRecordList +from twilio.rest.voice.v1.recording import RecordingList from twilio.rest.voice.v1.source_ip_mapping import SourceIpMappingList class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Voice @@ -37,6 +37,7 @@ def __init__(self, domain: Domain): self._connection_policies: Optional[ConnectionPolicyList] = None self._dialing_permissions: Optional[DialingPermissionsList] = None self._ip_records: Optional[IpRecordList] = None + self._recordings: Optional[RecordingList] = None self._source_ip_mappings: Optional[SourceIpMappingList] = None @property @@ -69,6 +70,12 @@ def ip_records(self) -> IpRecordList: self._ip_records = IpRecordList(self) return self._ip_records + @property + def recordings(self) -> RecordingList: + if self._recordings is None: + self._recordings = RecordingList(self) + return self._recordings + @property def source_ip_mappings(self) -> SourceIpMappingList: if self._source_ip_mappings is None: diff --git a/twilio/rest/voice/v1/archived_call.py b/twilio/rest/voice/v1/archived_call.py index 090f21d45..0b164c759 100644 --- a/twilio/rest/voice/v1/archived_call.py +++ b/twilio/rest/voice/v1/archived_call.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import date from twilio.base import values from twilio.base.api_response import ApiResponse @@ -22,7 +23,6 @@ class ArchivedCallContext(InstanceContext): - def __init__(self, version: Version, date: date, sid: str): """ Initialize the ArchivedCallContext @@ -119,7 +119,6 @@ def __repr__(self) -> str: class ArchivedCallList(ListResource): - def __init__(self, version: Version): """ Initialize the ArchivedCallList diff --git a/twilio/rest/voice/v1/byoc_trunk.py b/twilio/rest/voice/v1/byoc_trunk.py index 9370d3e2a..03146dbde 100644 --- a/twilio/rest/voice/v1/byoc_trunk.py +++ b/twilio/rest/voice/v1/byoc_trunk.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class ByocTrunkInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the BYOC Trunk resource. :ivar sid: The unique string that that we created to identify the BYOC Trunk resource. @@ -340,7 +342,6 @@ def __repr__(self) -> str: class ByocTrunkContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the ByocTrunkContext @@ -787,7 +788,6 @@ def __repr__(self) -> str: class ByocTrunkPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ByocTrunkInstance: """ Build an instance of ByocTrunkInstance @@ -806,7 +806,6 @@ def __repr__(self) -> str: class ByocTrunkList(ListResource): - def __init__(self, version: Version): """ Initialize the ByocTrunkList @@ -1411,10 +1410,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ByocTrunkPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/voice/v1/connection_policy/__init__.py b/twilio/rest/voice/v1/connection_policy/__init__.py index 039c6fb83..27297be02 100644 --- a/twilio/rest/voice/v1/connection_policy/__init__.py +++ b/twilio/rest/voice/v1/connection_policy/__init__.py @@ -12,6 +12,7 @@ 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 @@ -27,6 +28,7 @@ class ConnectionPolicyInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Connection Policy resource. :ivar sid: The unique string that we created to identify the Connection Policy resource. @@ -220,7 +222,6 @@ def __repr__(self) -> str: class ConnectionPolicyContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the ConnectionPolicyContext @@ -531,7 +532,6 @@ def __repr__(self) -> str: class ConnectionPolicyPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ConnectionPolicyInstance: """ Build an instance of ConnectionPolicyInstance @@ -550,7 +550,6 @@ def __repr__(self) -> str: class ConnectionPolicyList(ListResource): - def __init__(self, version: Version): """ Initialize the ConnectionPolicyList @@ -997,10 +996,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ConnectionPolicyPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/voice/v1/connection_policy/connection_policy_target.py b/twilio/rest/voice/v1/connection_policy/connection_policy_target.py index 5e3d7bae4..5cd60a041 100644 --- a/twilio/rest/voice/v1/connection_policy/connection_policy_target.py +++ b/twilio/rest/voice/v1/connection_policy/connection_policy_target.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class ConnectionPolicyTargetInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Target resource. :ivar connection_policy_sid: The SID of the Connection Policy that owns the Target. @@ -276,7 +278,6 @@ def __repr__(self) -> str: class ConnectionPolicyTargetContext(InstanceContext): - def __init__(self, version: Version, connection_policy_sid: str, sid: str): """ Initialize the ConnectionPolicyTargetContext @@ -671,7 +672,6 @@ def __repr__(self) -> str: class ConnectionPolicyTargetPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ConnectionPolicyTargetInstance: """ Build an instance of ConnectionPolicyTargetInstance @@ -694,7 +694,6 @@ def __repr__(self) -> str: class ConnectionPolicyTargetList(ListResource): - def __init__(self, version: Version, connection_policy_sid: str): """ Initialize the ConnectionPolicyTargetList @@ -1242,10 +1241,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = ConnectionPolicyTargetPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/voice/v1/dialing_permissions/__init__.py b/twilio/rest/voice/v1/dialing_permissions/__init__.py index 2346430ad..2de126841 100644 --- a/twilio/rest/voice/v1/dialing_permissions/__init__.py +++ b/twilio/rest/voice/v1/dialing_permissions/__init__.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Optional @@ -26,7 +27,6 @@ class DialingPermissionsList(ListResource): - def __init__(self, version: Version): """ Initialize the DialingPermissionsList diff --git a/twilio/rest/voice/v1/dialing_permissions/bulk_country_update.py b/twilio/rest/voice/v1/dialing_permissions/bulk_country_update.py index fc4a80d63..7830b386c 100644 --- a/twilio/rest/voice/v1/dialing_permissions/bulk_country_update.py +++ b/twilio/rest/voice/v1/dialing_permissions/bulk_country_update.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class BulkCountryUpdateInstance(InstanceResource): + """ :ivar update_count: The number of countries updated :ivar update_request: A bulk update request to change voice dialing country permissions stored as a URL-encoded, JSON array of update objects. For example : `[ { \"iso_code\": \"GB\", \"low_risk_numbers_enabled\": \"true\", \"high_risk_special_numbers_enabled\":\"true\", \"high_risk_tollfraud_numbers_enabled\": \"false\" } ]` @@ -46,7 +48,6 @@ def __repr__(self) -> str: class BulkCountryUpdateList(ListResource): - def __init__(self, version: Version): """ Initialize the BulkCountryUpdateList diff --git a/twilio/rest/voice/v1/dialing_permissions/country/__init__.py b/twilio/rest/voice/v1/dialing_permissions/country/__init__.py index 82342b563..9e427b1ad 100644 --- a/twilio/rest/voice/v1/dialing_permissions/country/__init__.py +++ b/twilio/rest/voice/v1/dialing_permissions/country/__init__.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -26,6 +27,7 @@ class CountryInstance(InstanceResource): + """ :ivar iso_code: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). :ivar name: The name of the country. @@ -133,7 +135,6 @@ def __repr__(self) -> str: class CountryContext(InstanceContext): - def __init__(self, version: Version, iso_code: str): """ Initialize the CountryContext @@ -264,7 +265,6 @@ def __repr__(self) -> str: class CountryPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> CountryInstance: """ Build an instance of CountryInstance @@ -283,7 +283,6 @@ def __repr__(self) -> str: class CountryList(ListResource): - def __init__(self, version: Version): """ Initialize the CountryList @@ -872,10 +871,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CountryPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/voice/v1/dialing_permissions/country/highrisk_special_prefix.py b/twilio/rest/voice/v1/dialing_permissions/country/highrisk_special_prefix.py index 270ddcc66..85b6f7033 100644 --- a/twilio/rest/voice/v1/dialing_permissions/country/highrisk_special_prefix.py +++ b/twilio/rest/voice/v1/dialing_permissions/country/highrisk_special_prefix.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.api_response import ApiResponse @@ -23,6 +24,7 @@ class HighriskSpecialPrefixInstance(InstanceResource): + """ :ivar prefix: A prefix is a contiguous number range for a block of E.164 numbers that includes the E.164 assigned country code. For example, a North American Numbering Plan prefix like `+1510720` written like `+1(510) 720` matches all numbers inclusive from `+1(510) 720-0000` to `+1(510) 720-9999`. """ @@ -47,7 +49,6 @@ def __repr__(self) -> str: class HighriskSpecialPrefixPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> HighriskSpecialPrefixInstance: """ Build an instance of HighriskSpecialPrefixInstance @@ -68,7 +69,6 @@ def __repr__(self) -> str: class HighriskSpecialPrefixList(ListResource): - def __init__(self, version: Version, iso_code: str): """ Initialize the HighriskSpecialPrefixList @@ -420,10 +420,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = HighriskSpecialPrefixPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/voice/v1/dialing_permissions/settings.py b/twilio/rest/voice/v1/dialing_permissions/settings.py index e1787b3ce..021a699f1 100644 --- a/twilio/rest/voice/v1/dialing_permissions/settings.py +++ b/twilio/rest/voice/v1/dialing_permissions/settings.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from typing import Any, Dict, Optional, Union from twilio.base import serialize, values from twilio.base.api_response import ApiResponse @@ -22,6 +23,7 @@ class SettingsInstance(InstanceResource): + """ :ivar dialing_permissions_inheritance: `true` if the sub-account will inherit voice dialing permissions from the Master Project; otherwise `false`. :ivar url: The absolute URL of this resource. @@ -154,7 +156,6 @@ def __repr__(self) -> str: class SettingsContext(InstanceContext): - def __init__(self, version: Version): """ Initialize the SettingsContext @@ -378,7 +379,6 @@ def __repr__(self) -> str: class SettingsList(ListResource): - def __init__(self, version: Version): """ Initialize the SettingsList diff --git a/twilio/rest/voice/v1/ip_record.py b/twilio/rest/voice/v1/ip_record.py index 4dbc1eca7..75df9733a 100644 --- a/twilio/rest/voice/v1/ip_record.py +++ b/twilio/rest/voice/v1/ip_record.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class IpRecordInstance(InstanceResource): + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IP Record resource. :ivar sid: The unique string that we created to identify the IP Record resource. @@ -214,7 +216,6 @@ def __repr__(self) -> str: class IpRecordContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the IpRecordContext @@ -503,7 +504,6 @@ def __repr__(self) -> str: class IpRecordPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> IpRecordInstance: """ Build an instance of IpRecordInstance @@ -522,7 +522,6 @@ def __repr__(self) -> str: class IpRecordList(ListResource): - def __init__(self, version: Version): """ Initialize the IpRecordList @@ -1015,10 +1014,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = IpRecordPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/voice/v1/recording.py b/twilio/rest/voice/v1/recording.py new file mode 100644 index 000000000..014b3e810 --- /dev/null +++ b/twilio/rest/voice/v1/recording.py @@ -0,0 +1,985 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Voice + 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.api_response import ApiResponse +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 RecordingInstance(InstanceResource): + class Source(object): + DIALVERB = "DialVerb" + CONFERENCE = "Conference" + OUTBOUNDAPI = "OutboundAPI" + TRUNKING = "Trunking" + RECORDVERB = "RecordVerb" + STARTCALLRECORDINGAPI = "StartCallRecordingAPI" + STARTCONFERENCERECORDINGAPI = "StartConferenceRecordingAPI" + + class Status(object): + IN_PROGRESS = "in-progress" + PAUSED = "paused" + STOPPED = "stopped" + PROCESSING = "processing" + COMPLETED = "completed" + ABSENT = "absent" + + """ + :ivar account_sid: + :ivar call_sid: + :ivar conference_sid: + :ivar date_created: + :ivar date_updated: + :ivar start_time: + :ivar duration: + :ivar sid: + :ivar price: + :ivar price_unit: + :ivar status: + :ivar channels: + :ivar source: + :ivar error_code: + :ivar url: + :ivar links: + :ivar encryption_details: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.call_sid: Optional[str] = payload.get("call_sid") + self.conference_sid: Optional[str] = payload.get("conference_sid") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.start_time: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("start_time") + ) + self.duration: Optional[str] = payload.get("duration") + self.sid: Optional[str] = payload.get("sid") + self.price: Optional[str] = payload.get("price") + self.price_unit: Optional[str] = payload.get("price_unit") + self.status: Optional["RecordingInstance.Status"] = payload.get("status") + self.channels: Optional[int] = deserialize.integer(payload.get("channels")) + self.source: Optional["RecordingInstance.Source"] = payload.get("source") + self.error_code: Optional[int] = deserialize.integer(payload.get("error_code")) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.encryption_details: Optional[Dict[str, object]] = payload.get( + "encryption_details" + ) + + self._solution = { + "sid": sid or self.sid, + } + self._context: Optional[RecordingContext] = None + + @property + def _proxy(self) -> "RecordingContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: RecordingContext for this RecordingInstance + """ + if self._context is None: + self._context = RecordingContext( + self._version, + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the RecordingInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the RecordingInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the RecordingInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return self._proxy.delete_with_http_info() + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the RecordingInstance with HTTP info + + + :returns: ApiResponse with success boolean, status code, and headers + """ + return await self._proxy.delete_with_http_info_async() + + def fetch(self) -> "RecordingInstance": + """ + Fetch the RecordingInstance + + + :returns: The fetched RecordingInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "RecordingInstance": + """ + Asynchronous coroutine to fetch the RecordingInstance + + + :returns: The fetched RecordingInstance + """ + return await self._proxy.fetch_async() + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the RecordingInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return self._proxy.fetch_with_http_info() + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the RecordingInstance with HTTP info + + + :returns: ApiResponse with instance, status code, and headers + """ + return await self._proxy.fetch_with_http_info_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 RecordingContext(InstanceContext): + def __init__(self, version: Version, sid: str): + """ + Initialize the RecordingContext + + :param version: Version that contains the resource + :param sid: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "sid": sid, + } + self._uri = "/Recordings/{sid}".format(**self._solution) + + def _delete(self) -> tuple: + """ + Internal helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + return self._version.delete_with_response_info( + method="DELETE", uri=self._uri, headers=headers + ) + + def delete(self) -> bool: + """ + Deletes the RecordingInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = self._delete() + return success + + def delete_with_http_info(self) -> ApiResponse: + """ + Deletes the RecordingInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = self._delete() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + async def _delete_async(self) -> tuple: + """ + Internal async helper for delete operation + + Returns: + tuple: (success_boolean, status_code, headers) + """ + + headers = values.of({}) + + return await self._version.delete_with_response_info_async( + method="DELETE", uri=self._uri, headers=headers + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the RecordingInstance + + + :returns: True if delete succeeds, False otherwise + """ + success, _, _ = await self._delete_async() + return success + + async def delete_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine that deletes the RecordingInstance and return response metadata + + + :returns: ApiResponse with success boolean, status code, and headers + """ + success, status_code, headers = await self._delete_async() + return ApiResponse(data=success, status_code=status_code, headers=headers) + + def _fetch(self) -> tuple: + """ + Internal helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.fetch_with_response_info( + method="GET", uri=self._uri, headers=headers + ) + + def fetch(self) -> RecordingInstance: + """ + Fetch the RecordingInstance + + + :returns: The fetched RecordingInstance + """ + payload, _, _ = self._fetch() + return RecordingInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + def fetch_with_http_info(self) -> ApiResponse: + """ + Fetch the RecordingInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = self._fetch() + instance = RecordingInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + async def _fetch_async(self) -> tuple: + """ + Internal async helper for fetch operation + + Returns: + tuple: (payload, status_code, headers) + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.fetch_with_response_info_async( + method="GET", uri=self._uri, headers=headers + ) + + async def fetch_async(self) -> RecordingInstance: + """ + Asynchronous coroutine to fetch the RecordingInstance + + + :returns: The fetched RecordingInstance + """ + payload, _, _ = await self._fetch_async() + return RecordingInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + async def fetch_with_http_info_async(self) -> ApiResponse: + """ + Asynchronous coroutine to fetch the RecordingInstance and return response metadata + + + :returns: ApiResponse with instance, status code, and headers + """ + payload, status_code, headers = await self._fetch_async() + instance = RecordingInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + return ApiResponse(data=instance, status_code=status_code, headers=headers) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class RecordingPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> RecordingInstance: + """ + Build an instance of RecordingInstance + + :param payload: Payload response from the API + """ + return RecordingInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class RecordingList(ListResource): + def __init__(self, version: Version): + """ + Initialize the RecordingList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Recordings" + + def stream( + self, + date_created: Union[datetime, object] = values.unset, + date_created_before: Union[datetime, object] = values.unset, + date_created_after: Union[datetime, object] = values.unset, + call_sid: Union[str, object] = values.unset, + conference_sid: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[RecordingInstance]: + """ + Streams RecordingInstance 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 datetime date_created: + :param datetime date_created_before: + :param datetime date_created_after: + :param str call_sid: + :param str conference_sid: + :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( + date_created=date_created, + date_created_before=date_created_before, + date_created_after=date_created_after, + call_sid=call_sid, + conference_sid=conference_sid, + page_size=limits["page_size"], + ) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + date_created: Union[datetime, object] = values.unset, + date_created_before: Union[datetime, object] = values.unset, + date_created_after: Union[datetime, object] = values.unset, + call_sid: Union[str, object] = values.unset, + conference_sid: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[RecordingInstance]: + """ + Asynchronously streams RecordingInstance 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 datetime date_created: + :param datetime date_created_before: + :param datetime date_created_after: + :param str call_sid: + :param str conference_sid: + :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( + date_created=date_created, + date_created_before=date_created_before, + date_created_after=date_created_after, + call_sid=call_sid, + conference_sid=conference_sid, + page_size=limits["page_size"], + ) + + return self._version.stream_async(page, limits["limit"]) + + def stream_with_http_info( + self, + date_created: Union[datetime, object] = values.unset, + date_created_before: Union[datetime, object] = values.unset, + date_created_after: Union[datetime, object] = values.unset, + call_sid: Union[str, object] = values.unset, + conference_sid: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Streams RecordingInstance and returns headers from first page + + + :param datetime date_created: + :param datetime date_created_before: + :param datetime date_created_after: + :param str call_sid: + :param str conference_sid: + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = self.page_with_http_info( + date_created=date_created, + date_created_before=date_created_before, + date_created_after=date_created_after, + call_sid=call_sid, + conference_sid=conference_sid, + page_size=limits["page_size"], + ) + + generator = self._version.stream(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + async def stream_with_http_info_async( + self, + date_created: Union[datetime, object] = values.unset, + date_created_before: Union[datetime, object] = values.unset, + date_created_after: Union[datetime, object] = values.unset, + call_sid: Union[str, object] = values.unset, + conference_sid: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> tuple: + """ + Asynchronously streams RecordingInstance and returns headers from first page + + + :param datetime date_created: + :param datetime date_created_before: + :param datetime date_created_after: + :param str call_sid: + :param str conference_sid: + :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: tuple of (generator, status_code, headers) where generator yields instances + """ + limits = self._version.read_limits(limit, page_size) + page_response = await self.page_with_http_info_async( + date_created=date_created, + date_created_before=date_created_before, + date_created_after=date_created_after, + call_sid=call_sid, + conference_sid=conference_sid, + page_size=limits["page_size"], + ) + + generator = self._version.stream_async(page_response.data, limits["limit"]) + return (generator, page_response.status_code, page_response.headers) + + def list( + self, + date_created: Union[datetime, object] = values.unset, + date_created_before: Union[datetime, object] = values.unset, + date_created_after: Union[datetime, object] = values.unset, + call_sid: Union[str, object] = values.unset, + conference_sid: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[RecordingInstance]: + """ + Lists RecordingInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param datetime date_created: + :param datetime date_created_before: + :param datetime date_created_after: + :param str call_sid: + :param str conference_sid: + :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( + date_created=date_created, + date_created_before=date_created_before, + date_created_after=date_created_after, + call_sid=call_sid, + conference_sid=conference_sid, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + date_created: Union[datetime, object] = values.unset, + date_created_before: Union[datetime, object] = values.unset, + date_created_after: Union[datetime, object] = values.unset, + call_sid: Union[str, object] = values.unset, + conference_sid: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[RecordingInstance]: + """ + Asynchronously lists RecordingInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param datetime date_created: + :param datetime date_created_before: + :param datetime date_created_after: + :param str call_sid: + :param str conference_sid: + :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( + date_created=date_created, + date_created_before=date_created_before, + date_created_after=date_created_after, + call_sid=call_sid, + conference_sid=conference_sid, + limit=limit, + page_size=page_size, + ) + ] + + def list_with_http_info( + self, + date_created: Union[datetime, object] = values.unset, + date_created_before: Union[datetime, object] = values.unset, + date_created_after: Union[datetime, object] = values.unset, + call_sid: Union[str, object] = values.unset, + conference_sid: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Lists RecordingInstance and returns headers from first page + + + :param datetime date_created: + :param datetime date_created_before: + :param datetime date_created_after: + :param str call_sid: + :param str conference_sid: + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = self.stream_with_http_info( + date_created=date_created, + date_created_before=date_created_before, + date_created_after=date_created_after, + call_sid=call_sid, + conference_sid=conference_sid, + limit=limit, + page_size=page_size, + ) + items = list(generator) + return ApiResponse(data=items, status_code=status_code, headers=headers) + + async def list_with_http_info_async( + self, + date_created: Union[datetime, object] = values.unset, + date_created_before: Union[datetime, object] = values.unset, + date_created_after: Union[datetime, object] = values.unset, + call_sid: Union[str, object] = values.unset, + conference_sid: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> ApiResponse: + """ + Asynchronously lists RecordingInstance and returns headers from first page + + + :param datetime date_created: + :param datetime date_created_before: + :param datetime date_created_after: + :param str call_sid: + :param str conference_sid: + :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: ApiResponse with list of instances, status code, and headers + """ + generator, status_code, headers = await self.stream_with_http_info_async( + date_created=date_created, + date_created_before=date_created_before, + date_created_after=date_created_after, + call_sid=call_sid, + conference_sid=conference_sid, + limit=limit, + page_size=page_size, + ) + items = [record async for record in generator] + return ApiResponse(data=items, status_code=status_code, headers=headers) + + def page( + self, + date_created: Union[datetime, object] = values.unset, + date_created_before: Union[datetime, object] = values.unset, + date_created_after: Union[datetime, object] = values.unset, + call_sid: Union[str, object] = values.unset, + conference_sid: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> RecordingPage: + """ + Retrieve a single page of RecordingInstance records from the API. + Request is executed immediately + + :param date_created: + :param date_created_before: + :param date_created_after: + :param call_sid: + :param conference_sid: + :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 RecordingInstance + """ + data = values.of( + { + "DateCreated": serialize.iso8601_datetime(date_created), + "DateCreated<": serialize.iso8601_datetime(date_created_before), + "DateCreated>": serialize.iso8601_datetime(date_created_after), + "CallSid": call_sid, + "ConferenceSid": conference_sid, + "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 RecordingPage(self._version, response) + + async def page_async( + self, + date_created: Union[datetime, object] = values.unset, + date_created_before: Union[datetime, object] = values.unset, + date_created_after: Union[datetime, object] = values.unset, + call_sid: Union[str, object] = values.unset, + conference_sid: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> RecordingPage: + """ + Asynchronously retrieve a single page of RecordingInstance records from the API. + Request is executed immediately + + :param date_created: + :param date_created_before: + :param date_created_after: + :param call_sid: + :param conference_sid: + :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 RecordingInstance + """ + data = values.of( + { + "DateCreated": serialize.iso8601_datetime(date_created), + "DateCreated<": serialize.iso8601_datetime(date_created_before), + "DateCreated>": serialize.iso8601_datetime(date_created_after), + "CallSid": call_sid, + "ConferenceSid": conference_sid, + "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 RecordingPage(self._version, response) + + def page_with_http_info( + self, + date_created: Union[datetime, object] = values.unset, + date_created_before: Union[datetime, object] = values.unset, + date_created_after: Union[datetime, object] = values.unset, + call_sid: Union[str, object] = values.unset, + conference_sid: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Retrieve a single page with response metadata + + + :param date_created: + :param date_created_before: + :param date_created_after: + :param call_sid: + :param conference_sid: + :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: ApiResponse with RecordingPage, status code, and headers + """ + data = values.of( + { + "DateCreated": serialize.iso8601_datetime(date_created), + "DateCreated<": serialize.iso8601_datetime(date_created_before), + "DateCreated>": serialize.iso8601_datetime(date_created_after), + "CallSid": call_sid, + "ConferenceSid": conference_sid, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response, status_code, response_headers = self._version.page_with_response_info( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = RecordingPage(self._version, response) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + async def page_with_http_info_async( + self, + date_created: Union[datetime, object] = values.unset, + date_created_before: Union[datetime, object] = values.unset, + date_created_after: Union[datetime, object] = values.unset, + call_sid: Union[str, object] = values.unset, + conference_sid: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ApiResponse: + """ + Asynchronously retrieve a single page with response metadata + + + :param date_created: + :param date_created_before: + :param date_created_after: + :param call_sid: + :param conference_sid: + :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: ApiResponse with RecordingPage, status code, and headers + """ + data = values.of( + { + "DateCreated": serialize.iso8601_datetime(date_created), + "DateCreated<": serialize.iso8601_datetime(date_created_before), + "DateCreated>": serialize.iso8601_datetime(date_created_after), + "CallSid": call_sid, + "ConferenceSid": conference_sid, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + page = RecordingPage(self._version, response) + return ApiResponse(data=page, status_code=status_code, headers=response_headers) + + def get_page(self, target_url: str) -> RecordingPage: + """ + Retrieve a specific page of RecordingInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of RecordingInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return RecordingPage(self._version, response) + + async def get_page_async(self, target_url: str) -> RecordingPage: + """ + Asynchronously retrieve a specific page of RecordingInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of RecordingInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return RecordingPage(self._version, response) + + def get(self, sid: str) -> RecordingContext: + """ + Constructs a RecordingContext + + :param sid: + """ + return RecordingContext(self._version, sid=sid) + + def __call__(self, sid: str) -> RecordingContext: + """ + Constructs a RecordingContext + + :param sid: + """ + return RecordingContext(self._version, sid=sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/voice/v1/source_ip_mapping.py b/twilio/rest/voice/v1/source_ip_mapping.py index e3cedd869..8aa2d8000 100644 --- a/twilio/rest/voice/v1/source_ip_mapping.py +++ b/twilio/rest/voice/v1/source_ip_mapping.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class SourceIpMappingInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the IP Record resource. :ivar ip_record_sid: The Twilio-provided string that uniquely identifies the IP Record resource to map from. @@ -200,7 +202,6 @@ def __repr__(self) -> str: class SourceIpMappingContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the SourceIpMappingContext @@ -487,7 +488,6 @@ def __repr__(self) -> str: class SourceIpMappingPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SourceIpMappingInstance: """ Build an instance of SourceIpMappingInstance @@ -506,7 +506,6 @@ def __repr__(self) -> str: class SourceIpMappingList(ListResource): - def __init__(self, version: Version): """ Initialize the SourceIpMappingList @@ -963,10 +962,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SourceIpMappingPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/wireless/WirelessBase.py b/twilio/rest/wireless/WirelessBase.py index 0228c4d66..5bec36968 100644 --- a/twilio/rest/wireless/WirelessBase.py +++ b/twilio/rest/wireless/WirelessBase.py @@ -17,7 +17,6 @@ class WirelessBase(Domain): - def __init__(self, twilio: Client): """ Initialize the Wireless Domain diff --git a/twilio/rest/wireless/v1/__init__.py b/twilio/rest/wireless/v1/__init__.py index 8f4d0dc5d..7d94692e4 100644 --- a/twilio/rest/wireless/v1/__init__.py +++ b/twilio/rest/wireless/v1/__init__.py @@ -22,7 +22,6 @@ class V1(Version): - def __init__(self, domain: Domain): """ Initialize the V1 version of Wireless diff --git a/twilio/rest/wireless/v1/command.py b/twilio/rest/wireless/v1/command.py index 06ca67a5e..d5f002b2b 100644 --- a/twilio/rest/wireless/v1/command.py +++ b/twilio/rest/wireless/v1/command.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class CommandInstance(InstanceResource): - class CommandMode(object): TEXT = "text" BINARY = "binary" @@ -188,7 +188,6 @@ def __repr__(self) -> str: class CommandContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the CommandContext @@ -373,7 +372,6 @@ def __repr__(self) -> str: class CommandPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> CommandInstance: """ Build an instance of CommandInstance @@ -392,7 +390,6 @@ def __repr__(self) -> str: class CommandList(ListResource): - def __init__(self, version: Version): """ Initialize the CommandList @@ -1103,10 +1100,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = CommandPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/wireless/v1/rate_plan.py b/twilio/rest/wireless/v1/rate_plan.py index 14b70d637..0ba4f95be 100644 --- a/twilio/rest/wireless/v1/rate_plan.py +++ b/twilio/rest/wireless/v1/rate_plan.py @@ -12,6 +12,7 @@ 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 @@ -24,7 +25,6 @@ class RatePlanInstance(InstanceResource): - class DataLimitStrategy(object): BLOCK = "block" THROTTLE = "throttle" @@ -45,6 +45,9 @@ class DataLimitStrategy(object): :ivar international_roaming_data_limit: The total data usage (download and upload combined) in Megabytes that the Network allows during one month when roaming outside the United States. Can be up to 2TB. :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + :ivar usage_notification_url: + :ivar usage_notification_method: + :ivar data_limit_strategy: :ivar url: The absolute URL of the resource. """ @@ -80,6 +83,15 @@ def __init__( self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_updated") ) + self.usage_notification_url: Optional[str] = payload.get( + "usage_notification_url" + ) + self.usage_notification_method: Optional[str] = payload.get( + "usage_notification_method" + ) + self.data_limit_strategy: Optional[ + "RatePlanInstance.DataLimitStrategy" + ] = payload.get("data_limit_strategy") self.url: Optional[str] = payload.get("url") self._solution = { @@ -178,72 +190,96 @@ def update( self, unique_name: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, + usage_notification_url: Union[str, object] = values.unset, + usage_notification_method: Union[str, object] = values.unset, ) -> "RatePlanInstance": """ Update the RatePlanInstance :param unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. :param friendly_name: A descriptive string that you create to describe the resource. It does not have to be unique. + :param usage_notification_url: + :param usage_notification_method: :returns: The updated RatePlanInstance """ return self._proxy.update( unique_name=unique_name, friendly_name=friendly_name, + usage_notification_url=usage_notification_url, + usage_notification_method=usage_notification_method, ) async def update_async( self, unique_name: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, + usage_notification_url: Union[str, object] = values.unset, + usage_notification_method: Union[str, object] = values.unset, ) -> "RatePlanInstance": """ Asynchronous coroutine to update the RatePlanInstance :param unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. :param friendly_name: A descriptive string that you create to describe the resource. It does not have to be unique. + :param usage_notification_url: + :param usage_notification_method: :returns: The updated RatePlanInstance """ return await self._proxy.update_async( unique_name=unique_name, friendly_name=friendly_name, + usage_notification_url=usage_notification_url, + usage_notification_method=usage_notification_method, ) def update_with_http_info( self, unique_name: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, + usage_notification_url: Union[str, object] = values.unset, + usage_notification_method: Union[str, object] = values.unset, ) -> ApiResponse: """ Update the RatePlanInstance with HTTP info :param unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. :param friendly_name: A descriptive string that you create to describe the resource. It does not have to be unique. + :param usage_notification_url: + :param usage_notification_method: :returns: ApiResponse with instance, status code, and headers """ return self._proxy.update_with_http_info( unique_name=unique_name, friendly_name=friendly_name, + usage_notification_url=usage_notification_url, + usage_notification_method=usage_notification_method, ) async def update_with_http_info_async( self, unique_name: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, + usage_notification_url: Union[str, object] = values.unset, + usage_notification_method: Union[str, object] = values.unset, ) -> ApiResponse: """ Asynchronous coroutine to update the RatePlanInstance with HTTP info :param unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. :param friendly_name: A descriptive string that you create to describe the resource. It does not have to be unique. + :param usage_notification_url: + :param usage_notification_method: :returns: ApiResponse with instance, status code, and headers """ return await self._proxy.update_with_http_info_async( unique_name=unique_name, friendly_name=friendly_name, + usage_notification_url=usage_notification_url, + usage_notification_method=usage_notification_method, ) def __repr__(self) -> str: @@ -257,7 +293,6 @@ def __repr__(self) -> str: class RatePlanContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the RatePlanContext @@ -435,6 +470,8 @@ def _update( self, unique_name: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, + usage_notification_url: Union[str, object] = values.unset, + usage_notification_method: Union[str, object] = values.unset, ) -> tuple: """ Internal helper for update operation @@ -447,6 +484,8 @@ def _update( { "UniqueName": unique_name, "FriendlyName": friendly_name, + "UsageNotificationUrl": usage_notification_url, + "UsageNotificationMethod": usage_notification_method, } ) headers = values.of({}) @@ -463,17 +502,24 @@ def update( self, unique_name: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, + usage_notification_url: Union[str, object] = values.unset, + usage_notification_method: Union[str, object] = values.unset, ) -> RatePlanInstance: """ Update the RatePlanInstance :param unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. :param friendly_name: A descriptive string that you create to describe the resource. It does not have to be unique. + :param usage_notification_url: + :param usage_notification_method: :returns: The updated RatePlanInstance """ payload, _, _ = self._update( - unique_name=unique_name, friendly_name=friendly_name + unique_name=unique_name, + friendly_name=friendly_name, + usage_notification_url=usage_notification_url, + usage_notification_method=usage_notification_method, ) return RatePlanInstance(self._version, payload, sid=self._solution["sid"]) @@ -481,17 +527,24 @@ def update_with_http_info( self, unique_name: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, + usage_notification_url: Union[str, object] = values.unset, + usage_notification_method: Union[str, object] = values.unset, ) -> ApiResponse: """ Update the RatePlanInstance and return response metadata :param unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. :param friendly_name: A descriptive string that you create to describe the resource. It does not have to be unique. + :param usage_notification_url: + :param usage_notification_method: :returns: ApiResponse with instance, status code, and headers """ payload, status_code, headers = self._update( - unique_name=unique_name, friendly_name=friendly_name + unique_name=unique_name, + friendly_name=friendly_name, + usage_notification_url=usage_notification_url, + usage_notification_method=usage_notification_method, ) instance = RatePlanInstance(self._version, payload, sid=self._solution["sid"]) return ApiResponse(data=instance, status_code=status_code, headers=headers) @@ -500,6 +553,8 @@ async def _update_async( self, unique_name: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, + usage_notification_url: Union[str, object] = values.unset, + usage_notification_method: Union[str, object] = values.unset, ) -> tuple: """ Internal async helper for update operation @@ -512,6 +567,8 @@ async def _update_async( { "UniqueName": unique_name, "FriendlyName": friendly_name, + "UsageNotificationUrl": usage_notification_url, + "UsageNotificationMethod": usage_notification_method, } ) headers = values.of({}) @@ -528,17 +585,24 @@ async def update_async( self, unique_name: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, + usage_notification_url: Union[str, object] = values.unset, + usage_notification_method: Union[str, object] = values.unset, ) -> RatePlanInstance: """ Asynchronous coroutine to update the RatePlanInstance :param unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. :param friendly_name: A descriptive string that you create to describe the resource. It does not have to be unique. + :param usage_notification_url: + :param usage_notification_method: :returns: The updated RatePlanInstance """ payload, _, _ = await self._update_async( - unique_name=unique_name, friendly_name=friendly_name + unique_name=unique_name, + friendly_name=friendly_name, + usage_notification_url=usage_notification_url, + usage_notification_method=usage_notification_method, ) return RatePlanInstance(self._version, payload, sid=self._solution["sid"]) @@ -546,17 +610,24 @@ async def update_with_http_info_async( self, unique_name: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, + usage_notification_url: Union[str, object] = values.unset, + usage_notification_method: Union[str, object] = values.unset, ) -> ApiResponse: """ Asynchronous coroutine to update the RatePlanInstance and return response metadata :param unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. :param friendly_name: A descriptive string that you create to describe the resource. It does not have to be unique. + :param usage_notification_url: + :param usage_notification_method: :returns: ApiResponse with instance, status code, and headers """ payload, status_code, headers = await self._update_async( - unique_name=unique_name, friendly_name=friendly_name + unique_name=unique_name, + friendly_name=friendly_name, + usage_notification_url=usage_notification_url, + usage_notification_method=usage_notification_method, ) instance = RatePlanInstance(self._version, payload, sid=self._solution["sid"]) return ApiResponse(data=instance, status_code=status_code, headers=headers) @@ -572,7 +643,6 @@ def __repr__(self) -> str: class RatePlanPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> RatePlanInstance: """ Build an instance of RatePlanInstance @@ -591,7 +661,6 @@ def __repr__(self) -> str: class RatePlanList(ListResource): - def __init__(self, version: Version): """ Initialize the RatePlanList @@ -616,6 +685,8 @@ def _create( international_roaming: Union[List[str], object] = values.unset, national_roaming_data_limit: Union[int, object] = values.unset, international_roaming_data_limit: Union[int, object] = values.unset, + usage_notification_url: Union[str, object] = values.unset, + usage_notification_method: Union[str, object] = values.unset, data_limit_strategy: Union[ "RatePlanInstance.DataLimitStrategy", object ] = values.unset, @@ -644,6 +715,8 @@ def _create( ), "NationalRoamingDataLimit": national_roaming_data_limit, "InternationalRoamingDataLimit": international_roaming_data_limit, + "UsageNotificationUrl": usage_notification_url, + "UsageNotificationMethod": usage_notification_method, "DataLimitStrategy": data_limit_strategy, } ) @@ -670,6 +743,8 @@ def create( international_roaming: Union[List[str], object] = values.unset, national_roaming_data_limit: Union[int, object] = values.unset, international_roaming_data_limit: Union[int, object] = values.unset, + usage_notification_url: Union[str, object] = values.unset, + usage_notification_method: Union[str, object] = values.unset, data_limit_strategy: Union[ "RatePlanInstance.DataLimitStrategy", object ] = values.unset, @@ -688,6 +763,8 @@ def create( :param international_roaming: The list of services that SIMs capable of using GPRS/3G/4G/LTE data connectivity can use outside of the United States. Can contain: `data` and `messaging`. :param national_roaming_data_limit: The total data usage (download and upload combined) in Megabytes that the Network allows during one month on non-home networks in the United States. The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB. See [national roaming](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#national-roaming) for more info. :param international_roaming_data_limit: The total data usage (download and upload combined) in Megabytes that the Network allows during one month when roaming outside the United States. Can be up to 2TB. + :param usage_notification_url: + :param usage_notification_method: :param data_limit_strategy: :returns: The created RatePlanInstance @@ -704,6 +781,8 @@ def create( international_roaming=international_roaming, national_roaming_data_limit=national_roaming_data_limit, international_roaming_data_limit=international_roaming_data_limit, + usage_notification_url=usage_notification_url, + usage_notification_method=usage_notification_method, data_limit_strategy=data_limit_strategy, ) return RatePlanInstance(self._version, payload) @@ -721,6 +800,8 @@ def create_with_http_info( international_roaming: Union[List[str], object] = values.unset, national_roaming_data_limit: Union[int, object] = values.unset, international_roaming_data_limit: Union[int, object] = values.unset, + usage_notification_url: Union[str, object] = values.unset, + usage_notification_method: Union[str, object] = values.unset, data_limit_strategy: Union[ "RatePlanInstance.DataLimitStrategy", object ] = values.unset, @@ -739,6 +820,8 @@ def create_with_http_info( :param international_roaming: The list of services that SIMs capable of using GPRS/3G/4G/LTE data connectivity can use outside of the United States. Can contain: `data` and `messaging`. :param national_roaming_data_limit: The total data usage (download and upload combined) in Megabytes that the Network allows during one month on non-home networks in the United States. The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB. See [national roaming](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#national-roaming) for more info. :param international_roaming_data_limit: The total data usage (download and upload combined) in Megabytes that the Network allows during one month when roaming outside the United States. Can be up to 2TB. + :param usage_notification_url: + :param usage_notification_method: :param data_limit_strategy: :returns: ApiResponse with instance, status code, and headers @@ -755,6 +838,8 @@ def create_with_http_info( international_roaming=international_roaming, national_roaming_data_limit=national_roaming_data_limit, international_roaming_data_limit=international_roaming_data_limit, + usage_notification_url=usage_notification_url, + usage_notification_method=usage_notification_method, data_limit_strategy=data_limit_strategy, ) instance = RatePlanInstance(self._version, payload) @@ -773,6 +858,8 @@ async def _create_async( international_roaming: Union[List[str], object] = values.unset, national_roaming_data_limit: Union[int, object] = values.unset, international_roaming_data_limit: Union[int, object] = values.unset, + usage_notification_url: Union[str, object] = values.unset, + usage_notification_method: Union[str, object] = values.unset, data_limit_strategy: Union[ "RatePlanInstance.DataLimitStrategy", object ] = values.unset, @@ -801,6 +888,8 @@ async def _create_async( ), "NationalRoamingDataLimit": national_roaming_data_limit, "InternationalRoamingDataLimit": international_roaming_data_limit, + "UsageNotificationUrl": usage_notification_url, + "UsageNotificationMethod": usage_notification_method, "DataLimitStrategy": data_limit_strategy, } ) @@ -827,6 +916,8 @@ async def create_async( international_roaming: Union[List[str], object] = values.unset, national_roaming_data_limit: Union[int, object] = values.unset, international_roaming_data_limit: Union[int, object] = values.unset, + usage_notification_url: Union[str, object] = values.unset, + usage_notification_method: Union[str, object] = values.unset, data_limit_strategy: Union[ "RatePlanInstance.DataLimitStrategy", object ] = values.unset, @@ -845,6 +936,8 @@ async def create_async( :param international_roaming: The list of services that SIMs capable of using GPRS/3G/4G/LTE data connectivity can use outside of the United States. Can contain: `data` and `messaging`. :param national_roaming_data_limit: The total data usage (download and upload combined) in Megabytes that the Network allows during one month on non-home networks in the United States. The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB. See [national roaming](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#national-roaming) for more info. :param international_roaming_data_limit: The total data usage (download and upload combined) in Megabytes that the Network allows during one month when roaming outside the United States. Can be up to 2TB. + :param usage_notification_url: + :param usage_notification_method: :param data_limit_strategy: :returns: The created RatePlanInstance @@ -861,6 +954,8 @@ async def create_async( international_roaming=international_roaming, national_roaming_data_limit=national_roaming_data_limit, international_roaming_data_limit=international_roaming_data_limit, + usage_notification_url=usage_notification_url, + usage_notification_method=usage_notification_method, data_limit_strategy=data_limit_strategy, ) return RatePlanInstance(self._version, payload) @@ -878,6 +973,8 @@ async def create_with_http_info_async( international_roaming: Union[List[str], object] = values.unset, national_roaming_data_limit: Union[int, object] = values.unset, international_roaming_data_limit: Union[int, object] = values.unset, + usage_notification_url: Union[str, object] = values.unset, + usage_notification_method: Union[str, object] = values.unset, data_limit_strategy: Union[ "RatePlanInstance.DataLimitStrategy", object ] = values.unset, @@ -896,6 +993,8 @@ async def create_with_http_info_async( :param international_roaming: The list of services that SIMs capable of using GPRS/3G/4G/LTE data connectivity can use outside of the United States. Can contain: `data` and `messaging`. :param national_roaming_data_limit: The total data usage (download and upload combined) in Megabytes that the Network allows during one month on non-home networks in the United States. The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB. See [national roaming](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#national-roaming) for more info. :param international_roaming_data_limit: The total data usage (download and upload combined) in Megabytes that the Network allows during one month when roaming outside the United States. Can be up to 2TB. + :param usage_notification_url: + :param usage_notification_method: :param data_limit_strategy: :returns: ApiResponse with instance, status code, and headers @@ -912,6 +1011,8 @@ async def create_with_http_info_async( international_roaming=international_roaming, national_roaming_data_limit=national_roaming_data_limit, international_roaming_data_limit=international_roaming_data_limit, + usage_notification_url=usage_notification_url, + usage_notification_method=usage_notification_method, data_limit_strategy=data_limit_strategy, ) instance = RatePlanInstance(self._version, payload) @@ -1248,10 +1349,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = RatePlanPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/wireless/v1/sim/__init__.py b/twilio/rest/wireless/v1/sim/__init__.py index 94d28ac89..2b697d461 100644 --- a/twilio/rest/wireless/v1/sim/__init__.py +++ b/twilio/rest/wireless/v1/sim/__init__.py @@ -12,6 +12,7 @@ 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 @@ -26,7 +27,6 @@ class SimInstance(InstanceResource): - class ResetStatus(object): RESETTING = "resetting" @@ -486,7 +486,6 @@ def __repr__(self) -> str: class SimContext(InstanceContext): - def __init__(self, version: Version, sid: str): """ Initialize the SimContext @@ -1088,7 +1087,6 @@ def __repr__(self) -> str: class SimPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> SimInstance: """ Build an instance of SimInstance @@ -1107,7 +1105,6 @@ def __repr__(self) -> str: class SimList(ListResource): - def __init__(self, version: Version): """ Initialize the SimList @@ -1636,10 +1633,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = SimPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/wireless/v1/sim/data_session.py b/twilio/rest/wireless/v1/sim/data_session.py index 654acb6d1..f37c4ae6f 100644 --- a/twilio/rest/wireless/v1/sim/data_session.py +++ b/twilio/rest/wireless/v1/sim/data_session.py @@ -12,6 +12,7 @@ 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 @@ -24,6 +25,7 @@ class DataSessionInstance(InstanceResource): + """ :ivar sid: The unique string that we created to identify the DataSession resource. :ivar sim_sid: The SID of the [Sim resource](https://www.twilio.com/docs/iot/wireless/api/sim-resource) that the Data Session is for. @@ -88,7 +90,6 @@ def __repr__(self) -> str: class DataSessionPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> DataSessionInstance: """ Build an instance of DataSessionInstance @@ -109,7 +110,6 @@ def __repr__(self) -> str: class DataSessionList(ListResource): - def __init__(self, version: Version, sim_sid: str): """ Initialize the DataSessionList @@ -457,10 +457,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = DataSessionPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/wireless/v1/sim/usage_record.py b/twilio/rest/wireless/v1/sim/usage_record.py index 6cb61e78f..1ffb6e234 100644 --- a/twilio/rest/wireless/v1/sim/usage_record.py +++ b/twilio/rest/wireless/v1/sim/usage_record.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import serialize, values @@ -24,7 +25,6 @@ class UsageRecordInstance(InstanceResource): - class Granularity(object): HOURLY = "hourly" DAILY = "daily" @@ -62,7 +62,6 @@ def __repr__(self) -> str: class UsageRecordPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> UsageRecordInstance: """ Build an instance of UsageRecordInstance @@ -83,7 +82,6 @@ def __repr__(self) -> str: class UsageRecordList(ListResource): - def __init__(self, version: Version, sim_sid: str): """ Initialize the UsageRecordList @@ -533,10 +531,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = UsageRecordPage(self._version, response, self._solution) return ApiResponse(data=page, status_code=status_code, headers=response_headers) diff --git a/twilio/rest/wireless/v1/usage_record.py b/twilio/rest/wireless/v1/usage_record.py index fdcab829e..8b0cebdde 100644 --- a/twilio/rest/wireless/v1/usage_record.py +++ b/twilio/rest/wireless/v1/usage_record.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ + from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import serialize, values @@ -24,7 +25,6 @@ class UsageRecordInstance(InstanceResource): - class Granularity(object): HOURLY = "hourly" DAILY = "daily" @@ -56,7 +56,6 @@ def __repr__(self) -> str: class UsageRecordPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> UsageRecordInstance: """ Build an instance of UsageRecordInstance @@ -75,7 +74,6 @@ def __repr__(self) -> str: class UsageRecordList(ListResource): - def __init__(self, version: Version): """ Initialize the UsageRecordList @@ -520,10 +518,12 @@ async def page_with_http_info_async( headers["Accept"] = "application/json" - response, status_code, response_headers = ( - await self._version.page_with_response_info_async( - method="GET", uri=self._uri, params=data, headers=headers - ) + ( + response, + status_code, + response_headers, + ) = await self._version.page_with_response_info_async( + method="GET", uri=self._uri, params=data, headers=headers ) page = UsageRecordPage(self._version, response) return ApiResponse(data=page, status_code=status_code, headers=response_headers)