diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index c9d4c023f72de0974507bdf4579ea055a1795d4b..9fdcf4c7523e7e4715b77c0ad16dbdcb93e70d63 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -38,16 +38,16 @@ jobs: - name: Run the tests run: make test-with-coverage -# - name: Run Cluster Tests -# if: (!github.event.pull_request.head.repo.fork) -# env: -# TWILIO_ACCOUNT_SID: ${{ secrets.TWILIO_ACCOUNT_SID }} -# TWILIO_API_KEY: ${{ secrets.TWILIO_CLUSTER_TEST_API_KEY}} -# TWILIO_API_SECRET: ${{ secrets.TWILIO_CLUSTER_TEST_API_KEY_SECRET }} -# TWILIO_FROM_NUMBER: ${{ secrets.TWILIO_FROM_NUMBER }} -# TWILIO_TO_NUMBER: ${{ secrets.TWILIO_TO_NUMBER }} -# TWILIO_AUTH_TOKEN: ${{ secrets.TWILIO_AUTH_TOKEN }} -# run: make cluster-test + - name: Run Cluster Tests + if: (!github.event.pull_request.head.repo.fork) + env: + TWILIO_ACCOUNT_SID: ${{ secrets.TWILIO_ACCOUNT_SID }} + TWILIO_API_KEY: ${{ secrets.TWILIO_CLUSTER_TEST_API_KEY}} + TWILIO_API_SECRET: ${{ secrets.TWILIO_CLUSTER_TEST_API_KEY_SECRET }} + TWILIO_FROM_NUMBER: ${{ secrets.TWILIO_FROM_NUMBER }} + TWILIO_TO_NUMBER: ${{ secrets.TWILIO_TO_NUMBER }} + TWILIO_AUTH_TOKEN: ${{ secrets.TWILIO_AUTH_TOKEN }} + run: make cluster-test - name: Verify docs generation run: make docs diff --git a/CHANGES.md b/CHANGES.md index 73bbaa1061d9c661d8dcf0bd60b701420b6f5052..d5fbaebfccacc90b01d8826022bdac26472f8037 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,74 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-03-15] Version 9.0.2 +-------------------------- +**Oauth** +- Add new APIs for vendor authorize and token endpoints + + +[2024-03-12] Version 9.0.1 +-------------------------- +**Library - Chore** +- [PR #775](https://github.com/twilio/twilio-python/pull/775): removing preview.understand references. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! + +**Api** +- Correct precedence documentation for application_sid vs status_callback in message creation +- Mark MaxPrice as deprecated + +**Flex** +- Making `plugins` visibility to public + +**Messaging** +- Add new `errors` attribute to the Brand Registration resource. +- Mark `brand_feedback` attribute as deprecated. +- Mark `failure_reason` attribute as deprecated. +- The new `errors` attribute is expected to provide additional information about Brand registration failures and feedback (if any has been provided by The Campaign Registry). Consumers should use this attribute instead of `brand_feedback` and `failure_reason`. + +**Numbers** +- Correcting mount_name for porting port in fetch API + +**Trusthub** +- Add new field in statusCallbackUrl in compliance_registration. +- Add new field in isvRegisteringForSelfOrTenant in compliance_registration. + +**Twiml** +- Expanded description of Action parameter for Message verb + + +[2024-02-27] Version 9.0.0 +-------------------------- +**Note:** This release contains breaking changes, check our [upgrade guide](./UPGRADE.md###-2024-02-20-8xx-to-9xx) for detailed migration notes. + +**Library - Feature** +- [PR #767](https://github.com/twilio/twilio-python/pull/767): Merge branch '9.0.0-rc' into main. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! **(breaking change)** + +**Library - Chore** +- [PR #771](https://github.com/twilio/twilio-python/pull/771): added check for unset values. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! +- [PR #768](https://github.com/twilio/twilio-python/pull/768): cluster tests enabled. Thanks to [@sbansla](https://github.com/sbansla)! + +**Api** +- remove feedback and feedback summary from call resource + +**Flex** +- Adding `routing_properties` to Interactions Channels Participant + +**Lookups** +- Add new `line_status` package to the lookup response +- Remove `live_activity` package from the lookup response **(breaking change)** + +**Messaging** +- Add tollfree multiple rejection reasons response array + +**Trusthub** +- Add ENUM for businessRegistrationAuthority in compliance_registration. **(breaking change)** +- Add new field in isIsvEmbed in compliance_registration. +- Add additional optional fields in compliance_registration for Individual business type. + +**Twiml** +- Add support for new Amazon Polly and Google voices (Q1 2024) for `Say` verb + + [2024-02-09] Version 8.13.0 --------------------------- **Library - Fix** diff --git a/UPGRADE.md b/UPGRADE.md index 79bdb48cc5255e0a789fe5bf3f433a1e78857710..03c196bf5b177bbab1a44bef1d7151b4837307d4 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -3,6 +3,15 @@ _`MAJOR` version bumps will have upgrade notes posted here._ +## [2024-02-20] 8.x.x to 9.x.x +### Overview + +##### Twilio Python Helper Library’s major version 9.0.0 is now available. We ensured that you can upgrade to Python helper Library 9.0.0 version without any breaking changes of existing apis + +Behind the scenes Python Helper is now auto-generated via OpenAPI with this release. This enables us to rapidly add new features and enhance consistency across versions and languages. +We're pleased to inform you that version 9.0.0 adds support for the application/json content type in the request body. + + ## [2023-04-05] 7.x.x to 8.x.x - **Supported Python versions updated** diff --git a/setup.py b/setup.py index bb6ca3cecff834b1bd2fbe63e12a59a711277803..625c2104132097069ca5d6fb60b680b90f648dfe 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ with open("README.md") as f: setup( name="twilio", - version="8.13.0", + version="9.0.2", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/tests/unit/http/test_http_client.py b/tests/unit/http/test_http_client.py index e599aaaf0012b1ec28adba940b95552375083032..8484e57b17664dbadbd500da1926fc20cd5bb86a 100644 --- a/tests/unit/http/test_http_client.py +++ b/tests/unit/http/test_http_client.py @@ -145,6 +145,32 @@ class TestHttpClientRequest(unittest.TestCase): "testing-unicode: Ω≈ç√, 💩", self.client._test_only_last_response.text ) + def test_request_with_json(self): + self.request_mock.url = "https://api.twilio.com/" + self.request_mock.headers = {"Host": "other.twilio.com"} + + self.client.request( + "doesnt-matter-method", + "doesnt-matter-url", + {"params-value": "params-key"}, + {"json-key": "json-value"}, + {"Content-Type": "application/json"}, + ) + + self.assertIsNotNone(self.client._test_only_last_request) + self.assertEqual( + {"Content-Type": "application/json"}, + self.client._test_only_last_request.headers, + ) + + self.assertIsNotNone(self.client._test_only_last_response) + + if self.client._test_only_last_response is not None: + self.assertEqual(200, self.client._test_only_last_response.status_code) + self.assertEqual( + "testing-unicode: Ω≈ç√, 💩", self.client._test_only_last_response.text + ) + def test_last_response_empty_on_error(self): self.session_mock.send.side_effect = Exception("voltron") diff --git a/twilio/__init__.py b/twilio/__init__.py index 1d1288358e96a8dc80679a655e28c4ed5499e465..698515090a5472a730e0d4daf946849e97d2ecba 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("8", "13", "0") +__version_info__ = ("9", "0", "2") __version__ = ".".join(__version_info__) diff --git a/twilio/base/serialize.py b/twilio/base/serialize.py index eac2e12c2edd5de439a79ff6a704d258f1e2d445..cea91b04c7ccea21021280a8a2768e590da07f78 100644 --- a/twilio/base/serialize.py +++ b/twilio/base/serialize.py @@ -62,6 +62,9 @@ def prefixed_collapsible_map(m, prefix): def boolean_to_string(bool_or_str): + if bool_or_str == values.unset: + return bool_or_str + if bool_or_str is None: return bool_or_str diff --git a/twilio/http/http_client.py b/twilio/http/http_client.py index bfc38feaf7e0d300788c5df09c7b5647e4aea5dc..7a1715ad490040a57964819ce8ad24a259b4c9c2 100644 --- a/twilio/http/http_client.py +++ b/twilio/http/http_client.py @@ -27,11 +27,10 @@ class TwilioHttpClient(HttpClient): ): """ Constructor for the TwilioHttpClient - :param pool_connections :param request_hooks :param timeout: Timeout for the requests. - Timeout should never be zero (0) or less. + Timeout should never be zero (0) or less :param logger :param proxy: Http proxy for the requests session :param max_retries: Maximum number of retries each request should attempt @@ -65,10 +64,10 @@ class TwilioHttpClient(HttpClient): :param headers: HTTP Headers to send with the request :param auth: Basic Auth arguments :param timeout: Socket/Read timeout for the request - :param allow_redirects: Whether or not to allow redirects + :param allow_redirects: Whether to allow redirects See the requests documentation for explanation of all these parameters - :return: An http response + :return: An HTTP response """ if timeout is None: timeout = self.timeout @@ -79,12 +78,14 @@ class TwilioHttpClient(HttpClient): "method": method.upper(), "url": url, "params": params, - "data": data, "headers": headers, "auth": auth, "hooks": self.request_hooks, } - + if headers and headers.get("Content-Type") == "application/json": + kwargs["json"] = data + else: + kwargs["data"] = data self.log_request(kwargs) self._test_only_last_response = None diff --git a/twilio/rest/__init__.py b/twilio/rest/__init__.py index 3e895271f94a9692e203a5539a19c53a2bdc2fb7..254d920786f55068468f86ac667c952d9b4fce36 100644 --- a/twilio/rest/__init__.py +++ b/twilio/rest/__init__.py @@ -28,11 +28,13 @@ if TYPE_CHECKING: from twilio.rest.ip_messaging import IpMessaging from twilio.rest.lookups import Lookups from twilio.rest.media import Media + from twilio.rest.preview_messaging import PreviewMessaging from twilio.rest.messaging import Messaging from twilio.rest.microvisor import Microvisor from twilio.rest.monitor import Monitor from twilio.rest.notify import Notify from twilio.rest.numbers import Numbers + from twilio.rest.oauth import Oauth from twilio.rest.preview import Preview from twilio.rest.pricing import Pricing from twilio.rest.proxy import Proxy @@ -135,11 +137,13 @@ class Client(ClientBase): self._ip_messaging: Optional["IpMessaging"] = None self._lookups: Optional["Lookups"] = None self._media: Optional["Media"] = None + self._preview_messaging: Optional["PreviewMessaging"] = None self._messaging: Optional["Messaging"] = None self._microvisor: Optional["Microvisor"] = None self._monitor: Optional["Monitor"] = None self._notify: Optional["Notify"] = None self._numbers: Optional["Numbers"] = None + self._oauth: Optional["Oauth"] = None self._preview: Optional["Preview"] = None self._pricing: Optional["Pricing"] = None self._proxy: Optional["Proxy"] = None @@ -338,6 +342,19 @@ class Client(ClientBase): self._media = Media(self) return self._media + @property + def preview_messaging(self) -> "PreviewMessaging": + """ + Access the PreviewMessaging Twilio Domain + + :returns: PreviewMessaging Twilio Domain + """ + if self._preview_messaging is None: + from twilio.rest.preview_messaging import PreviewMessaging + + self._preview_messaging = PreviewMessaging(self) + return self._preview_messaging + @property def messaging(self) -> "Messaging": """ @@ -403,6 +420,19 @@ class Client(ClientBase): self._numbers = Numbers(self) return self._numbers + @property + def oauth(self) -> "Oauth": + """ + Access the Oauth Twilio Domain + + :returns: Oauth Twilio Domain + """ + if self._oauth is None: + from twilio.rest.oauth import Oauth + + self._oauth = Oauth(self) + return self._oauth + @property def preview(self) -> "Preview": """ diff --git a/twilio/rest/accounts/v1/safelist.py b/twilio/rest/accounts/v1/safelist.py index e20855965cbab4036dc9f743507591dd248b82d2..ce5672caedea18d065ec2d2f99b0bb2b42891a2d 100644 --- a/twilio/rest/accounts/v1/safelist.py +++ b/twilio/rest/accounts/v1/safelist.py @@ -150,6 +150,7 @@ class SafelistList(ListResource): "PhoneNumber": phone_number, } ) + payload = self._version.fetch(method="GET", uri=self._uri, params=params) return SafelistInstance(self._version, payload) @@ -169,6 +170,7 @@ class SafelistList(ListResource): "PhoneNumber": phone_number, } ) + payload = await self._version.fetch_async( method="GET", uri=self._uri, params=params ) diff --git a/twilio/rest/api/v2010/account/address/__init__.py b/twilio/rest/api/v2010/account/address/__init__.py index 422d7f776c16828dfd9ca94916db752efe179545..fd77747102d1102e33c6e17252a67a77fdf0a74d 100644 --- a/twilio/rest/api/v2010/account/address/__init__.py +++ b/twilio/rest/api/v2010/account/address/__init__.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -350,8 +350,8 @@ class AddressContext(InstanceContext): "City": city, "Region": region, "PostalCode": postal_code, - "EmergencyEnabled": emergency_enabled, - "AutoCorrectAddress": auto_correct_address, + "EmergencyEnabled": serialize.boolean_to_string(emergency_enabled), + "AutoCorrectAddress": serialize.boolean_to_string(auto_correct_address), "StreetSecondary": street_secondary, } ) @@ -404,8 +404,8 @@ class AddressContext(InstanceContext): "City": city, "Region": region, "PostalCode": postal_code, - "EmergencyEnabled": emergency_enabled, - "AutoCorrectAddress": auto_correct_address, + "EmergencyEnabled": serialize.boolean_to_string(emergency_enabled), + "AutoCorrectAddress": serialize.boolean_to_string(auto_correct_address), "StreetSecondary": street_secondary, } ) @@ -524,8 +524,8 @@ class AddressList(ListResource): "PostalCode": postal_code, "IsoCountry": iso_country, "FriendlyName": friendly_name, - "EmergencyEnabled": emergency_enabled, - "AutoCorrectAddress": auto_correct_address, + "EmergencyEnabled": serialize.boolean_to_string(emergency_enabled), + "AutoCorrectAddress": serialize.boolean_to_string(auto_correct_address), "StreetSecondary": street_secondary, } ) @@ -579,8 +579,8 @@ class AddressList(ListResource): "PostalCode": postal_code, "IsoCountry": iso_country, "FriendlyName": friendly_name, - "EmergencyEnabled": emergency_enabled, - "AutoCorrectAddress": auto_correct_address, + "EmergencyEnabled": serialize.boolean_to_string(emergency_enabled), + "AutoCorrectAddress": serialize.boolean_to_string(auto_correct_address), "StreetSecondary": street_secondary, } ) diff --git a/twilio/rest/api/v2010/account/application.py b/twilio/rest/api/v2010/account/application.py index 3f70417b5ed101d29f3ced384f3abffd67e295ac..a3b11f02820cd2961fd2dbf5971a691d5973d838 100644 --- a/twilio/rest/api/v2010/account/application.py +++ b/twilio/rest/api/v2010/account/application.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -414,14 +414,18 @@ class ApplicationContext(InstanceContext): "VoiceFallbackMethod": voice_fallback_method, "StatusCallback": status_callback, "StatusCallbackMethod": status_callback_method, - "VoiceCallerIdLookup": voice_caller_id_lookup, + "VoiceCallerIdLookup": serialize.boolean_to_string( + voice_caller_id_lookup + ), "SmsUrl": sms_url, "SmsMethod": sms_method, "SmsFallbackUrl": sms_fallback_url, "SmsFallbackMethod": sms_fallback_method, "SmsStatusCallback": sms_status_callback, "MessageStatusCallback": message_status_callback, - "PublicApplicationConnectEnabled": public_application_connect_enabled, + "PublicApplicationConnectEnabled": serialize.boolean_to_string( + public_application_connect_enabled + ), } ) @@ -489,14 +493,18 @@ class ApplicationContext(InstanceContext): "VoiceFallbackMethod": voice_fallback_method, "StatusCallback": status_callback, "StatusCallbackMethod": status_callback_method, - "VoiceCallerIdLookup": voice_caller_id_lookup, + "VoiceCallerIdLookup": serialize.boolean_to_string( + voice_caller_id_lookup + ), "SmsUrl": sms_url, "SmsMethod": sms_method, "SmsFallbackUrl": sms_fallback_url, "SmsFallbackMethod": sms_fallback_method, "SmsStatusCallback": sms_status_callback, "MessageStatusCallback": message_status_callback, - "PublicApplicationConnectEnabled": public_application_connect_enabled, + "PublicApplicationConnectEnabled": serialize.boolean_to_string( + public_application_connect_enabled + ), } ) @@ -613,7 +621,9 @@ class ApplicationList(ListResource): "VoiceFallbackMethod": voice_fallback_method, "StatusCallback": status_callback, "StatusCallbackMethod": status_callback_method, - "VoiceCallerIdLookup": voice_caller_id_lookup, + "VoiceCallerIdLookup": serialize.boolean_to_string( + voice_caller_id_lookup + ), "SmsUrl": sms_url, "SmsMethod": sms_method, "SmsFallbackUrl": sms_fallback_url, @@ -621,7 +631,9 @@ class ApplicationList(ListResource): "SmsStatusCallback": sms_status_callback, "MessageStatusCallback": message_status_callback, "FriendlyName": friendly_name, - "PublicApplicationConnectEnabled": public_application_connect_enabled, + "PublicApplicationConnectEnabled": serialize.boolean_to_string( + public_application_connect_enabled + ), } ) @@ -686,7 +698,9 @@ class ApplicationList(ListResource): "VoiceFallbackMethod": voice_fallback_method, "StatusCallback": status_callback, "StatusCallbackMethod": status_callback_method, - "VoiceCallerIdLookup": voice_caller_id_lookup, + "VoiceCallerIdLookup": serialize.boolean_to_string( + voice_caller_id_lookup + ), "SmsUrl": sms_url, "SmsMethod": sms_method, "SmsFallbackUrl": sms_fallback_url, @@ -694,7 +708,9 @@ class ApplicationList(ListResource): "SmsStatusCallback": sms_status_callback, "MessageStatusCallback": message_status_callback, "FriendlyName": friendly_name, - "PublicApplicationConnectEnabled": public_application_connect_enabled, + "PublicApplicationConnectEnabled": serialize.boolean_to_string( + public_application_connect_enabled + ), } ) 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 a3fd567a7f07af8269728ab01f1ee9ed5729f70d..43118d9f726228e8a1ba8e7552c8fdf133b5e327 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 @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -501,13 +501,19 @@ class LocalList(ListResource): { "AreaCode": area_code, "Contains": contains, - "SmsEnabled": sms_enabled, - "MmsEnabled": mms_enabled, - "VoiceEnabled": voice_enabled, - "ExcludeAllAddressRequired": exclude_all_address_required, - "ExcludeLocalAddressRequired": exclude_local_address_required, - "ExcludeForeignAddressRequired": exclude_foreign_address_required, - "Beta": beta, + "SmsEnabled": serialize.boolean_to_string(sms_enabled), + "MmsEnabled": serialize.boolean_to_string(mms_enabled), + "VoiceEnabled": serialize.boolean_to_string(voice_enabled), + "ExcludeAllAddressRequired": serialize.boolean_to_string( + exclude_all_address_required + ), + "ExcludeLocalAddressRequired": serialize.boolean_to_string( + exclude_local_address_required + ), + "ExcludeForeignAddressRequired": serialize.boolean_to_string( + exclude_foreign_address_required + ), + "Beta": serialize.boolean_to_string(beta), "NearNumber": near_number, "NearLatLong": near_lat_long, "Distance": distance, @@ -516,7 +522,7 @@ class LocalList(ListResource): "InRateCenter": in_rate_center, "InLata": in_lata, "InLocality": in_locality, - "FaxEnabled": fax_enabled, + "FaxEnabled": serialize.boolean_to_string(fax_enabled), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -582,13 +588,19 @@ class LocalList(ListResource): { "AreaCode": area_code, "Contains": contains, - "SmsEnabled": sms_enabled, - "MmsEnabled": mms_enabled, - "VoiceEnabled": voice_enabled, - "ExcludeAllAddressRequired": exclude_all_address_required, - "ExcludeLocalAddressRequired": exclude_local_address_required, - "ExcludeForeignAddressRequired": exclude_foreign_address_required, - "Beta": beta, + "SmsEnabled": serialize.boolean_to_string(sms_enabled), + "MmsEnabled": serialize.boolean_to_string(mms_enabled), + "VoiceEnabled": serialize.boolean_to_string(voice_enabled), + "ExcludeAllAddressRequired": serialize.boolean_to_string( + exclude_all_address_required + ), + "ExcludeLocalAddressRequired": serialize.boolean_to_string( + exclude_local_address_required + ), + "ExcludeForeignAddressRequired": serialize.boolean_to_string( + exclude_foreign_address_required + ), + "Beta": serialize.boolean_to_string(beta), "NearNumber": near_number, "NearLatLong": near_lat_long, "Distance": distance, @@ -597,7 +609,7 @@ class LocalList(ListResource): "InRateCenter": in_rate_center, "InLata": in_lata, "InLocality": in_locality, - "FaxEnabled": fax_enabled, + "FaxEnabled": serialize.boolean_to_string(fax_enabled), "PageToken": page_token, "Page": page_number, "PageSize": page_size, 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 04ba514cca258afc8b9720fe57c30130710cd2fb..ee94aa944e9670f56a67f80f7503792b1aaec226 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 @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -501,13 +501,19 @@ class MachineToMachineList(ListResource): { "AreaCode": area_code, "Contains": contains, - "SmsEnabled": sms_enabled, - "MmsEnabled": mms_enabled, - "VoiceEnabled": voice_enabled, - "ExcludeAllAddressRequired": exclude_all_address_required, - "ExcludeLocalAddressRequired": exclude_local_address_required, - "ExcludeForeignAddressRequired": exclude_foreign_address_required, - "Beta": beta, + "SmsEnabled": serialize.boolean_to_string(sms_enabled), + "MmsEnabled": serialize.boolean_to_string(mms_enabled), + "VoiceEnabled": serialize.boolean_to_string(voice_enabled), + "ExcludeAllAddressRequired": serialize.boolean_to_string( + exclude_all_address_required + ), + "ExcludeLocalAddressRequired": serialize.boolean_to_string( + exclude_local_address_required + ), + "ExcludeForeignAddressRequired": serialize.boolean_to_string( + exclude_foreign_address_required + ), + "Beta": serialize.boolean_to_string(beta), "NearNumber": near_number, "NearLatLong": near_lat_long, "Distance": distance, @@ -516,7 +522,7 @@ class MachineToMachineList(ListResource): "InRateCenter": in_rate_center, "InLata": in_lata, "InLocality": in_locality, - "FaxEnabled": fax_enabled, + "FaxEnabled": serialize.boolean_to_string(fax_enabled), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -582,13 +588,19 @@ class MachineToMachineList(ListResource): { "AreaCode": area_code, "Contains": contains, - "SmsEnabled": sms_enabled, - "MmsEnabled": mms_enabled, - "VoiceEnabled": voice_enabled, - "ExcludeAllAddressRequired": exclude_all_address_required, - "ExcludeLocalAddressRequired": exclude_local_address_required, - "ExcludeForeignAddressRequired": exclude_foreign_address_required, - "Beta": beta, + "SmsEnabled": serialize.boolean_to_string(sms_enabled), + "MmsEnabled": serialize.boolean_to_string(mms_enabled), + "VoiceEnabled": serialize.boolean_to_string(voice_enabled), + "ExcludeAllAddressRequired": serialize.boolean_to_string( + exclude_all_address_required + ), + "ExcludeLocalAddressRequired": serialize.boolean_to_string( + exclude_local_address_required + ), + "ExcludeForeignAddressRequired": serialize.boolean_to_string( + exclude_foreign_address_required + ), + "Beta": serialize.boolean_to_string(beta), "NearNumber": near_number, "NearLatLong": near_lat_long, "Distance": distance, @@ -597,7 +609,7 @@ class MachineToMachineList(ListResource): "InRateCenter": in_rate_center, "InLata": in_lata, "InLocality": in_locality, - "FaxEnabled": fax_enabled, + "FaxEnabled": serialize.boolean_to_string(fax_enabled), "PageToken": page_token, "Page": page_number, "PageSize": page_size, 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 cd37127017630c6791a759055772037c8ee73f64..622d2b85979b10553f73237ba17e16822f75c6bd 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 @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -501,13 +501,19 @@ class MobileList(ListResource): { "AreaCode": area_code, "Contains": contains, - "SmsEnabled": sms_enabled, - "MmsEnabled": mms_enabled, - "VoiceEnabled": voice_enabled, - "ExcludeAllAddressRequired": exclude_all_address_required, - "ExcludeLocalAddressRequired": exclude_local_address_required, - "ExcludeForeignAddressRequired": exclude_foreign_address_required, - "Beta": beta, + "SmsEnabled": serialize.boolean_to_string(sms_enabled), + "MmsEnabled": serialize.boolean_to_string(mms_enabled), + "VoiceEnabled": serialize.boolean_to_string(voice_enabled), + "ExcludeAllAddressRequired": serialize.boolean_to_string( + exclude_all_address_required + ), + "ExcludeLocalAddressRequired": serialize.boolean_to_string( + exclude_local_address_required + ), + "ExcludeForeignAddressRequired": serialize.boolean_to_string( + exclude_foreign_address_required + ), + "Beta": serialize.boolean_to_string(beta), "NearNumber": near_number, "NearLatLong": near_lat_long, "Distance": distance, @@ -516,7 +522,7 @@ class MobileList(ListResource): "InRateCenter": in_rate_center, "InLata": in_lata, "InLocality": in_locality, - "FaxEnabled": fax_enabled, + "FaxEnabled": serialize.boolean_to_string(fax_enabled), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -582,13 +588,19 @@ class MobileList(ListResource): { "AreaCode": area_code, "Contains": contains, - "SmsEnabled": sms_enabled, - "MmsEnabled": mms_enabled, - "VoiceEnabled": voice_enabled, - "ExcludeAllAddressRequired": exclude_all_address_required, - "ExcludeLocalAddressRequired": exclude_local_address_required, - "ExcludeForeignAddressRequired": exclude_foreign_address_required, - "Beta": beta, + "SmsEnabled": serialize.boolean_to_string(sms_enabled), + "MmsEnabled": serialize.boolean_to_string(mms_enabled), + "VoiceEnabled": serialize.boolean_to_string(voice_enabled), + "ExcludeAllAddressRequired": serialize.boolean_to_string( + exclude_all_address_required + ), + "ExcludeLocalAddressRequired": serialize.boolean_to_string( + exclude_local_address_required + ), + "ExcludeForeignAddressRequired": serialize.boolean_to_string( + exclude_foreign_address_required + ), + "Beta": serialize.boolean_to_string(beta), "NearNumber": near_number, "NearLatLong": near_lat_long, "Distance": distance, @@ -597,7 +609,7 @@ class MobileList(ListResource): "InRateCenter": in_rate_center, "InLata": in_lata, "InLocality": in_locality, - "FaxEnabled": fax_enabled, + "FaxEnabled": serialize.boolean_to_string(fax_enabled), "PageToken": page_token, "Page": page_number, "PageSize": page_size, 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 018bef3ac7145c894ebe520440909d46999aa994..d0f3a63ddaea2cbf7042b0441c4a90b80cc6b68b 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 @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -501,13 +501,19 @@ class NationalList(ListResource): { "AreaCode": area_code, "Contains": contains, - "SmsEnabled": sms_enabled, - "MmsEnabled": mms_enabled, - "VoiceEnabled": voice_enabled, - "ExcludeAllAddressRequired": exclude_all_address_required, - "ExcludeLocalAddressRequired": exclude_local_address_required, - "ExcludeForeignAddressRequired": exclude_foreign_address_required, - "Beta": beta, + "SmsEnabled": serialize.boolean_to_string(sms_enabled), + "MmsEnabled": serialize.boolean_to_string(mms_enabled), + "VoiceEnabled": serialize.boolean_to_string(voice_enabled), + "ExcludeAllAddressRequired": serialize.boolean_to_string( + exclude_all_address_required + ), + "ExcludeLocalAddressRequired": serialize.boolean_to_string( + exclude_local_address_required + ), + "ExcludeForeignAddressRequired": serialize.boolean_to_string( + exclude_foreign_address_required + ), + "Beta": serialize.boolean_to_string(beta), "NearNumber": near_number, "NearLatLong": near_lat_long, "Distance": distance, @@ -516,7 +522,7 @@ class NationalList(ListResource): "InRateCenter": in_rate_center, "InLata": in_lata, "InLocality": in_locality, - "FaxEnabled": fax_enabled, + "FaxEnabled": serialize.boolean_to_string(fax_enabled), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -582,13 +588,19 @@ class NationalList(ListResource): { "AreaCode": area_code, "Contains": contains, - "SmsEnabled": sms_enabled, - "MmsEnabled": mms_enabled, - "VoiceEnabled": voice_enabled, - "ExcludeAllAddressRequired": exclude_all_address_required, - "ExcludeLocalAddressRequired": exclude_local_address_required, - "ExcludeForeignAddressRequired": exclude_foreign_address_required, - "Beta": beta, + "SmsEnabled": serialize.boolean_to_string(sms_enabled), + "MmsEnabled": serialize.boolean_to_string(mms_enabled), + "VoiceEnabled": serialize.boolean_to_string(voice_enabled), + "ExcludeAllAddressRequired": serialize.boolean_to_string( + exclude_all_address_required + ), + "ExcludeLocalAddressRequired": serialize.boolean_to_string( + exclude_local_address_required + ), + "ExcludeForeignAddressRequired": serialize.boolean_to_string( + exclude_foreign_address_required + ), + "Beta": serialize.boolean_to_string(beta), "NearNumber": near_number, "NearLatLong": near_lat_long, "Distance": distance, @@ -597,7 +609,7 @@ class NationalList(ListResource): "InRateCenter": in_rate_center, "InLata": in_lata, "InLocality": in_locality, - "FaxEnabled": fax_enabled, + "FaxEnabled": serialize.boolean_to_string(fax_enabled), "PageToken": page_token, "Page": page_number, "PageSize": page_size, 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 3cb7af3eff60eddcb604f54ea00c06053377477d..7b5b9b11c806647c431a4693818e2c3786bcfed9 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 @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -501,13 +501,19 @@ class SharedCostList(ListResource): { "AreaCode": area_code, "Contains": contains, - "SmsEnabled": sms_enabled, - "MmsEnabled": mms_enabled, - "VoiceEnabled": voice_enabled, - "ExcludeAllAddressRequired": exclude_all_address_required, - "ExcludeLocalAddressRequired": exclude_local_address_required, - "ExcludeForeignAddressRequired": exclude_foreign_address_required, - "Beta": beta, + "SmsEnabled": serialize.boolean_to_string(sms_enabled), + "MmsEnabled": serialize.boolean_to_string(mms_enabled), + "VoiceEnabled": serialize.boolean_to_string(voice_enabled), + "ExcludeAllAddressRequired": serialize.boolean_to_string( + exclude_all_address_required + ), + "ExcludeLocalAddressRequired": serialize.boolean_to_string( + exclude_local_address_required + ), + "ExcludeForeignAddressRequired": serialize.boolean_to_string( + exclude_foreign_address_required + ), + "Beta": serialize.boolean_to_string(beta), "NearNumber": near_number, "NearLatLong": near_lat_long, "Distance": distance, @@ -516,7 +522,7 @@ class SharedCostList(ListResource): "InRateCenter": in_rate_center, "InLata": in_lata, "InLocality": in_locality, - "FaxEnabled": fax_enabled, + "FaxEnabled": serialize.boolean_to_string(fax_enabled), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -582,13 +588,19 @@ class SharedCostList(ListResource): { "AreaCode": area_code, "Contains": contains, - "SmsEnabled": sms_enabled, - "MmsEnabled": mms_enabled, - "VoiceEnabled": voice_enabled, - "ExcludeAllAddressRequired": exclude_all_address_required, - "ExcludeLocalAddressRequired": exclude_local_address_required, - "ExcludeForeignAddressRequired": exclude_foreign_address_required, - "Beta": beta, + "SmsEnabled": serialize.boolean_to_string(sms_enabled), + "MmsEnabled": serialize.boolean_to_string(mms_enabled), + "VoiceEnabled": serialize.boolean_to_string(voice_enabled), + "ExcludeAllAddressRequired": serialize.boolean_to_string( + exclude_all_address_required + ), + "ExcludeLocalAddressRequired": serialize.boolean_to_string( + exclude_local_address_required + ), + "ExcludeForeignAddressRequired": serialize.boolean_to_string( + exclude_foreign_address_required + ), + "Beta": serialize.boolean_to_string(beta), "NearNumber": near_number, "NearLatLong": near_lat_long, "Distance": distance, @@ -597,7 +609,7 @@ class SharedCostList(ListResource): "InRateCenter": in_rate_center, "InLata": in_lata, "InLocality": in_locality, - "FaxEnabled": fax_enabled, + "FaxEnabled": serialize.boolean_to_string(fax_enabled), "PageToken": page_token, "Page": page_number, "PageSize": page_size, 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 e9d830c0bb34f1269d5b1b6af66e6ba47eb0e727..436801800112de88d5ce463dac616c9c66bdaad4 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 @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -501,13 +501,19 @@ class TollFreeList(ListResource): { "AreaCode": area_code, "Contains": contains, - "SmsEnabled": sms_enabled, - "MmsEnabled": mms_enabled, - "VoiceEnabled": voice_enabled, - "ExcludeAllAddressRequired": exclude_all_address_required, - "ExcludeLocalAddressRequired": exclude_local_address_required, - "ExcludeForeignAddressRequired": exclude_foreign_address_required, - "Beta": beta, + "SmsEnabled": serialize.boolean_to_string(sms_enabled), + "MmsEnabled": serialize.boolean_to_string(mms_enabled), + "VoiceEnabled": serialize.boolean_to_string(voice_enabled), + "ExcludeAllAddressRequired": serialize.boolean_to_string( + exclude_all_address_required + ), + "ExcludeLocalAddressRequired": serialize.boolean_to_string( + exclude_local_address_required + ), + "ExcludeForeignAddressRequired": serialize.boolean_to_string( + exclude_foreign_address_required + ), + "Beta": serialize.boolean_to_string(beta), "NearNumber": near_number, "NearLatLong": near_lat_long, "Distance": distance, @@ -516,7 +522,7 @@ class TollFreeList(ListResource): "InRateCenter": in_rate_center, "InLata": in_lata, "InLocality": in_locality, - "FaxEnabled": fax_enabled, + "FaxEnabled": serialize.boolean_to_string(fax_enabled), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -582,13 +588,19 @@ class TollFreeList(ListResource): { "AreaCode": area_code, "Contains": contains, - "SmsEnabled": sms_enabled, - "MmsEnabled": mms_enabled, - "VoiceEnabled": voice_enabled, - "ExcludeAllAddressRequired": exclude_all_address_required, - "ExcludeLocalAddressRequired": exclude_local_address_required, - "ExcludeForeignAddressRequired": exclude_foreign_address_required, - "Beta": beta, + "SmsEnabled": serialize.boolean_to_string(sms_enabled), + "MmsEnabled": serialize.boolean_to_string(mms_enabled), + "VoiceEnabled": serialize.boolean_to_string(voice_enabled), + "ExcludeAllAddressRequired": serialize.boolean_to_string( + exclude_all_address_required + ), + "ExcludeLocalAddressRequired": serialize.boolean_to_string( + exclude_local_address_required + ), + "ExcludeForeignAddressRequired": serialize.boolean_to_string( + exclude_foreign_address_required + ), + "Beta": serialize.boolean_to_string(beta), "NearNumber": near_number, "NearLatLong": near_lat_long, "Distance": distance, @@ -597,7 +609,7 @@ class TollFreeList(ListResource): "InRateCenter": in_rate_center, "InLata": in_lata, "InLocality": in_locality, - "FaxEnabled": fax_enabled, + "FaxEnabled": serialize.boolean_to_string(fax_enabled), "PageToken": page_token, "Page": page_number, "PageSize": page_size, 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 8825843c8fb3fe1f81ad3930ed65e2fbd9a2349c..e0615d5a6ea57a39ee2395ada5801b4c35b5df45 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 @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -501,13 +501,19 @@ class VoipList(ListResource): { "AreaCode": area_code, "Contains": contains, - "SmsEnabled": sms_enabled, - "MmsEnabled": mms_enabled, - "VoiceEnabled": voice_enabled, - "ExcludeAllAddressRequired": exclude_all_address_required, - "ExcludeLocalAddressRequired": exclude_local_address_required, - "ExcludeForeignAddressRequired": exclude_foreign_address_required, - "Beta": beta, + "SmsEnabled": serialize.boolean_to_string(sms_enabled), + "MmsEnabled": serialize.boolean_to_string(mms_enabled), + "VoiceEnabled": serialize.boolean_to_string(voice_enabled), + "ExcludeAllAddressRequired": serialize.boolean_to_string( + exclude_all_address_required + ), + "ExcludeLocalAddressRequired": serialize.boolean_to_string( + exclude_local_address_required + ), + "ExcludeForeignAddressRequired": serialize.boolean_to_string( + exclude_foreign_address_required + ), + "Beta": serialize.boolean_to_string(beta), "NearNumber": near_number, "NearLatLong": near_lat_long, "Distance": distance, @@ -516,7 +522,7 @@ class VoipList(ListResource): "InRateCenter": in_rate_center, "InLata": in_lata, "InLocality": in_locality, - "FaxEnabled": fax_enabled, + "FaxEnabled": serialize.boolean_to_string(fax_enabled), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -582,13 +588,19 @@ class VoipList(ListResource): { "AreaCode": area_code, "Contains": contains, - "SmsEnabled": sms_enabled, - "MmsEnabled": mms_enabled, - "VoiceEnabled": voice_enabled, - "ExcludeAllAddressRequired": exclude_all_address_required, - "ExcludeLocalAddressRequired": exclude_local_address_required, - "ExcludeForeignAddressRequired": exclude_foreign_address_required, - "Beta": beta, + "SmsEnabled": serialize.boolean_to_string(sms_enabled), + "MmsEnabled": serialize.boolean_to_string(mms_enabled), + "VoiceEnabled": serialize.boolean_to_string(voice_enabled), + "ExcludeAllAddressRequired": serialize.boolean_to_string( + exclude_all_address_required + ), + "ExcludeLocalAddressRequired": serialize.boolean_to_string( + exclude_local_address_required + ), + "ExcludeForeignAddressRequired": serialize.boolean_to_string( + exclude_foreign_address_required + ), + "Beta": serialize.boolean_to_string(beta), "NearNumber": near_number, "NearLatLong": near_lat_long, "Distance": distance, @@ -597,7 +609,7 @@ class VoipList(ListResource): "InRateCenter": in_rate_center, "InLata": in_lata, "InLocality": in_locality, - "FaxEnabled": fax_enabled, + "FaxEnabled": serialize.boolean_to_string(fax_enabled), "PageToken": page_token, "Page": page_number, "PageSize": page_size, diff --git a/twilio/rest/api/v2010/account/call/__init__.py b/twilio/rest/api/v2010/account/call/__init__.py index 406db276029eb2f6ac12229a22c56bd7d55ab371..b218709a2d67e90e807a1a4db2a1a9b45e40f37c 100644 --- a/twilio/rest/api/v2010/account/call/__init__.py +++ b/twilio/rest/api/v2010/account/call/__init__.py @@ -21,8 +21,6 @@ from twilio.base.list_resource import ListResource from twilio.base.version import Version from twilio.base.page import Page from twilio.rest.api.v2010.account.call.event import EventList -from twilio.rest.api.v2010.account.call.feedback import FeedbackList -from twilio.rest.api.v2010.account.call.feedback_summary import FeedbackSummaryList from twilio.rest.api.v2010.account.call.notification import NotificationList from twilio.rest.api.v2010.account.call.payment import PaymentList from twilio.rest.api.v2010.account.call.recording import RecordingList @@ -270,13 +268,6 @@ class CallInstance(InstanceResource): """ return self._proxy.events - @property - def feedback(self) -> FeedbackList: - """ - Access the feedback - """ - return self._proxy.feedback - @property def notifications(self) -> NotificationList: """ @@ -356,7 +347,6 @@ class CallContext(InstanceContext): self._uri = "/Accounts/{account_sid}/Calls/{sid}.json".format(**self._solution) self._events: Optional[EventList] = None - self._feedback: Optional[FeedbackList] = None self._notifications: Optional[NotificationList] = None self._payments: Optional[PaymentList] = None self._recordings: Optional[RecordingList] = None @@ -552,19 +542,6 @@ class CallContext(InstanceContext): ) return self._events - @property - def feedback(self) -> FeedbackList: - """ - Access the feedback - """ - if self._feedback is None: - self._feedback = FeedbackList( - self._version, - self._solution["account_sid"], - self._solution["sid"], - ) - return self._feedback - @property def notifications(self) -> NotificationList: """ @@ -707,8 +684,6 @@ class CallList(ListResource): } self._uri = "/Accounts/{account_sid}/Calls.json".format(**self._solution) - self._feedback_summaries: Optional[FeedbackSummaryList] = None - def create( self, to: str, @@ -803,7 +778,7 @@ class CallList(ListResource): "StatusCallbackMethod": status_callback_method, "SendDigits": send_digits, "Timeout": timeout, - "Record": record, + "Record": serialize.boolean_to_string(record), "RecordingChannels": recording_channels, "RecordingStatusCallback": recording_status_callback, "RecordingStatusCallbackMethod": recording_status_callback_method, @@ -937,7 +912,7 @@ class CallList(ListResource): "StatusCallbackMethod": status_callback_method, "SendDigits": send_digits, "Timeout": timeout, - "Record": record, + "Record": serialize.boolean_to_string(record), "RecordingChannels": recording_channels, "RecordingStatusCallback": recording_status_callback, "RecordingStatusCallbackMethod": recording_status_callback_method, @@ -1344,17 +1319,6 @@ class CallList(ListResource): response = await self._version.domain.twilio.request_async("GET", target_url) return CallPage(self._version, response, self._solution) - @property - def feedback_summaries(self) -> FeedbackSummaryList: - """ - Access the feedback_summaries - """ - if self._feedback_summaries is None: - self._feedback_summaries = FeedbackSummaryList( - self._version, account_sid=self._solution["account_sid"] - ) - return self._feedback_summaries - def get(self, sid: str) -> CallContext: """ Constructs a CallContext diff --git a/twilio/rest/api/v2010/account/call/feedback.py b/twilio/rest/api/v2010/account/call/feedback.py deleted file mode 100644 index 210a529ac2dbb4dc46f10bf1c7067cf66276e26c..0000000000000000000000000000000000000000 --- a/twilio/rest/api/v2010/account/call/feedback.py +++ /dev/null @@ -1,333 +0,0 @@ -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 -from twilio.base import deserialize, serialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version - - -class FeedbackInstance(InstanceResource): - - class Issues(object): - AUDIO_LATENCY = "audio-latency" - DIGITS_NOT_CAPTURED = "digits-not-captured" - DROPPED_CALL = "dropped-call" - IMPERFECT_AUDIO = "imperfect-audio" - INCORRECT_CALLER_ID = "incorrect-caller-id" - ONE_WAY_AUDIO = "one-way-audio" - POST_DIAL_DELAY = "post-dial-delay" - UNSOLICITED_CALL = "unsolicited-call" - - """ - :ivar account_sid: The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - :ivar date_created: The date that this resource was created, given in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. - :ivar date_updated: The date that this resource was last updated, given in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. - :ivar issues: A list of issues experienced during the call. The issues can be: `imperfect-audio`, `dropped-call`, `incorrect-caller-id`, `post-dial-delay`, `digits-not-captured`, `audio-latency`, `unsolicited-call`, or `one-way-audio`. - :ivar quality_score: `1` to `5` quality score where `1` represents imperfect experience and `5` represents a perfect call. - :ivar sid: A 34 character string that uniquely identifies this resource. - """ - - def __init__( - self, version: Version, payload: Dict[str, Any], account_sid: str, call_sid: str - ): - super().__init__(version) - - self.account_sid: Optional[str] = payload.get("account_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.issues: Optional[List["FeedbackInstance.Issues"]] = payload.get("issues") - self.quality_score: Optional[int] = deserialize.integer( - payload.get("quality_score") - ) - self.sid: Optional[str] = payload.get("sid") - - self._solution = { - "account_sid": account_sid, - "call_sid": call_sid, - } - self._context: Optional[FeedbackContext] = None - - @property - def _proxy(self) -> "FeedbackContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FeedbackContext for this FeedbackInstance - """ - if self._context is None: - self._context = FeedbackContext( - self._version, - account_sid=self._solution["account_sid"], - call_sid=self._solution["call_sid"], - ) - return self._context - - def fetch(self) -> "FeedbackInstance": - """ - Fetch the FeedbackInstance - - - :returns: The fetched FeedbackInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "FeedbackInstance": - """ - Asynchronous coroutine to fetch the FeedbackInstance - - - :returns: The fetched FeedbackInstance - """ - return await self._proxy.fetch_async() - - def update( - self, - quality_score: Union[int, object] = values.unset, - issue: Union[List["FeedbackInstance.Issues"], object] = values.unset, - ) -> "FeedbackInstance": - """ - Update the FeedbackInstance - - :param quality_score: The call quality expressed as an integer from `1` to `5` where `1` represents very poor call quality and `5` represents a perfect call. - :param issue: One or more issues experienced during the call. The issues can be: `imperfect-audio`, `dropped-call`, `incorrect-caller-id`, `post-dial-delay`, `digits-not-captured`, `audio-latency`, `unsolicited-call`, or `one-way-audio`. - - :returns: The updated FeedbackInstance - """ - return self._proxy.update( - quality_score=quality_score, - issue=issue, - ) - - async def update_async( - self, - quality_score: Union[int, object] = values.unset, - issue: Union[List["FeedbackInstance.Issues"], object] = values.unset, - ) -> "FeedbackInstance": - """ - Asynchronous coroutine to update the FeedbackInstance - - :param quality_score: The call quality expressed as an integer from `1` to `5` where `1` represents very poor call quality and `5` represents a perfect call. - :param issue: One or more issues experienced during the call. The issues can be: `imperfect-audio`, `dropped-call`, `incorrect-caller-id`, `post-dial-delay`, `digits-not-captured`, `audio-latency`, `unsolicited-call`, or `one-way-audio`. - - :returns: The updated FeedbackInstance - """ - return await self._proxy.update_async( - quality_score=quality_score, - issue=issue, - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) - return "<Twilio.Api.V2010.FeedbackInstance {}>".format(context) - - -class FeedbackContext(InstanceContext): - - def __init__(self, version: Version, account_sid: str, call_sid: str): - """ - Initialize the FeedbackContext - - :param version: Version that contains the resource - :param account_sid: The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - :param call_sid: The call sid that uniquely identifies the call - """ - super().__init__(version) - - # Path Solution - self._solution = { - "account_sid": account_sid, - "call_sid": call_sid, - } - self._uri = "/Accounts/{account_sid}/Calls/{call_sid}/Feedback.json".format( - **self._solution - ) - - def fetch(self) -> FeedbackInstance: - """ - Fetch the FeedbackInstance - - - :returns: The fetched FeedbackInstance - """ - - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) - - return FeedbackInstance( - self._version, - payload, - account_sid=self._solution["account_sid"], - call_sid=self._solution["call_sid"], - ) - - async def fetch_async(self) -> FeedbackInstance: - """ - Asynchronous coroutine to fetch the FeedbackInstance - - - :returns: The fetched FeedbackInstance - """ - - payload = await self._version.fetch_async( - method="GET", - uri=self._uri, - ) - - return FeedbackInstance( - self._version, - payload, - account_sid=self._solution["account_sid"], - call_sid=self._solution["call_sid"], - ) - - def update( - self, - quality_score: Union[int, object] = values.unset, - issue: Union[List["FeedbackInstance.Issues"], object] = values.unset, - ) -> FeedbackInstance: - """ - Update the FeedbackInstance - - :param quality_score: The call quality expressed as an integer from `1` to `5` where `1` represents very poor call quality and `5` represents a perfect call. - :param issue: One or more issues experienced during the call. The issues can be: `imperfect-audio`, `dropped-call`, `incorrect-caller-id`, `post-dial-delay`, `digits-not-captured`, `audio-latency`, `unsolicited-call`, or `one-way-audio`. - - :returns: The updated FeedbackInstance - """ - data = values.of( - { - "QualityScore": quality_score, - "Issue": serialize.map(issue, lambda e: e), - } - ) - - payload = self._version.update( - method="POST", - uri=self._uri, - data=data, - ) - - return FeedbackInstance( - self._version, - payload, - account_sid=self._solution["account_sid"], - call_sid=self._solution["call_sid"], - ) - - async def update_async( - self, - quality_score: Union[int, object] = values.unset, - issue: Union[List["FeedbackInstance.Issues"], object] = values.unset, - ) -> FeedbackInstance: - """ - Asynchronous coroutine to update the FeedbackInstance - - :param quality_score: The call quality expressed as an integer from `1` to `5` where `1` represents very poor call quality and `5` represents a perfect call. - :param issue: One or more issues experienced during the call. The issues can be: `imperfect-audio`, `dropped-call`, `incorrect-caller-id`, `post-dial-delay`, `digits-not-captured`, `audio-latency`, `unsolicited-call`, or `one-way-audio`. - - :returns: The updated FeedbackInstance - """ - data = values.of( - { - "QualityScore": quality_score, - "Issue": serialize.map(issue, lambda e: e), - } - ) - - payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, - ) - - return FeedbackInstance( - 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 - """ - context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) - return "<Twilio.Api.V2010.FeedbackContext {}>".format(context) - - -class FeedbackList(ListResource): - - def __init__(self, version: Version, account_sid: str, call_sid: str): - """ - Initialize the FeedbackList - - :param version: Version that contains the resource - :param account_sid: The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - :param call_sid: The call sid that uniquely identifies the call - - """ - super().__init__(version) - - # Path Solution - self._solution = { - "account_sid": account_sid, - "call_sid": call_sid, - } - - def get(self) -> FeedbackContext: - """ - Constructs a FeedbackContext - - """ - return FeedbackContext( - self._version, - account_sid=self._solution["account_sid"], - call_sid=self._solution["call_sid"], - ) - - def __call__(self) -> FeedbackContext: - """ - Constructs a FeedbackContext - - """ - return FeedbackContext( - self._version, - 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 "<Twilio.Api.V2010.FeedbackList>" diff --git a/twilio/rest/api/v2010/account/call/feedback_summary.py b/twilio/rest/api/v2010/account/call/feedback_summary.py deleted file mode 100644 index 2f26b0b0a48bf78ca7557e4e0c7d91cb48dfccb2..0000000000000000000000000000000000000000 --- a/twilio/rest/api/v2010/account/call/feedback_summary.py +++ /dev/null @@ -1,378 +0,0 @@ -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, datetime -from typing import Any, Dict, List, Optional, Union -from twilio.base import deserialize, serialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version - - -class FeedbackSummaryInstance(InstanceResource): - - class Status(object): - QUEUED = "queued" - IN_PROGRESS = "in-progress" - COMPLETED = "completed" - FAILED = "failed" - - """ - :ivar account_sid: The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - :ivar call_count: The total number of calls. - :ivar call_feedback_count: The total number of calls with a feedback entry. - :ivar date_created: The date that this resource was created, given in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. - :ivar date_updated: The date that this resource was last updated, given in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. - :ivar end_date: The last date for which feedback entries are included in this Feedback Summary, formatted as `YYYY-MM-DD` and specified in UTC. - :ivar include_subaccounts: Whether the feedback summary includes subaccounts; `true` if it does, otherwise `false`. - :ivar issues: A list of issues experienced during the call. The issues can be: `imperfect-audio`, `dropped-call`, `incorrect-caller-id`, `post-dial-delay`, `digits-not-captured`, `audio-latency`, or `one-way-audio`. - :ivar quality_score_average: The average QualityScore of the feedback entries. - :ivar quality_score_median: The median QualityScore of the feedback entries. - :ivar quality_score_standard_deviation: The standard deviation of the quality scores. - :ivar sid: A 34 character string that uniquely identifies this resource. - :ivar start_date: The first date for which feedback entries are included in this feedback summary, formatted as `YYYY-MM-DD` and specified in UTC. - :ivar status: - """ - - def __init__( - self, - version: Version, - payload: Dict[str, Any], - account_sid: str, - sid: Optional[str] = None, - ): - super().__init__(version) - - self.account_sid: Optional[str] = payload.get("account_sid") - self.call_count: Optional[int] = deserialize.integer(payload.get("call_count")) - self.call_feedback_count: Optional[int] = deserialize.integer( - payload.get("call_feedback_count") - ) - 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.end_date: Optional[date] = deserialize.iso8601_date( - payload.get("end_date") - ) - self.include_subaccounts: Optional[bool] = payload.get("include_subaccounts") - self.issues: Optional[List[Dict[str, object]]] = payload.get("issues") - self.quality_score_average: Optional[float] = deserialize.decimal( - payload.get("quality_score_average") - ) - self.quality_score_median: Optional[float] = deserialize.decimal( - payload.get("quality_score_median") - ) - self.quality_score_standard_deviation: Optional[float] = deserialize.decimal( - payload.get("quality_score_standard_deviation") - ) - self.sid: Optional[str] = payload.get("sid") - self.start_date: Optional[date] = deserialize.iso8601_date( - payload.get("start_date") - ) - self.status: Optional["FeedbackSummaryInstance.Status"] = payload.get("status") - - self._solution = { - "account_sid": account_sid, - "sid": sid or self.sid, - } - self._context: Optional[FeedbackSummaryContext] = None - - @property - def _proxy(self) -> "FeedbackSummaryContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FeedbackSummaryContext for this FeedbackSummaryInstance - """ - if self._context is None: - self._context = FeedbackSummaryContext( - self._version, - account_sid=self._solution["account_sid"], - sid=self._solution["sid"], - ) - return self._context - - def delete(self) -> bool: - """ - Deletes the FeedbackSummaryInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete() - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the FeedbackSummaryInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async() - - def fetch(self) -> "FeedbackSummaryInstance": - """ - Fetch the FeedbackSummaryInstance - - - :returns: The fetched FeedbackSummaryInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "FeedbackSummaryInstance": - """ - Asynchronous coroutine to fetch the FeedbackSummaryInstance - - - :returns: The fetched FeedbackSummaryInstance - """ - return await self._proxy.fetch_async() - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) - return "<Twilio.Api.V2010.FeedbackSummaryInstance {}>".format(context) - - -class FeedbackSummaryContext(InstanceContext): - - def __init__(self, version: Version, account_sid: str, sid: str): - """ - Initialize the FeedbackSummaryContext - - :param version: Version that contains the resource - :param account_sid: The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - :param sid: A 34 character string that uniquely identifies this resource. - """ - super().__init__(version) - - # Path Solution - self._solution = { - "account_sid": account_sid, - "sid": sid, - } - self._uri = "/Accounts/{account_sid}/Calls/FeedbackSummary/{sid}.json".format( - **self._solution - ) - - def delete(self) -> bool: - """ - Deletes the FeedbackSummaryInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the FeedbackSummaryInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._version.delete_async( - method="DELETE", - uri=self._uri, - ) - - def fetch(self) -> FeedbackSummaryInstance: - """ - Fetch the FeedbackSummaryInstance - - - :returns: The fetched FeedbackSummaryInstance - """ - - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) - - return FeedbackSummaryInstance( - self._version, - payload, - account_sid=self._solution["account_sid"], - sid=self._solution["sid"], - ) - - async def fetch_async(self) -> FeedbackSummaryInstance: - """ - Asynchronous coroutine to fetch the FeedbackSummaryInstance - - - :returns: The fetched FeedbackSummaryInstance - """ - - payload = await self._version.fetch_async( - method="GET", - uri=self._uri, - ) - - return FeedbackSummaryInstance( - self._version, - payload, - account_sid=self._solution["account_sid"], - sid=self._solution["sid"], - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) - return "<Twilio.Api.V2010.FeedbackSummaryContext {}>".format(context) - - -class FeedbackSummaryList(ListResource): - - def __init__(self, version: Version, account_sid: str): - """ - Initialize the FeedbackSummaryList - - :param version: Version that contains the resource - :param account_sid: The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - - """ - super().__init__(version) - - # Path Solution - self._solution = { - "account_sid": account_sid, - } - self._uri = "/Accounts/{account_sid}/Calls/FeedbackSummary.json".format( - **self._solution - ) - - def create( - self, - start_date: date, - end_date: date, - include_subaccounts: Union[bool, object] = values.unset, - status_callback: Union[str, object] = values.unset, - status_callback_method: Union[str, object] = values.unset, - ) -> FeedbackSummaryInstance: - """ - Create the FeedbackSummaryInstance - - :param start_date: Only include feedback given on or after this date. Format is `YYYY-MM-DD` and specified in UTC. - :param end_date: Only include feedback given on or before this date. Format is `YYYY-MM-DD` and specified in UTC. - :param include_subaccounts: Whether to also include Feedback resources from all subaccounts. `true` includes feedback from all subaccounts and `false`, the default, includes feedback from only the specified account. - :param status_callback: The URL that we will request when the feedback summary is complete. - :param status_callback_method: The HTTP method (`GET` or `POST`) we use to make the request to the `StatusCallback` URL. - - :returns: The created FeedbackSummaryInstance - """ - - data = values.of( - { - "StartDate": serialize.iso8601_date(start_date), - "EndDate": serialize.iso8601_date(end_date), - "IncludeSubaccounts": include_subaccounts, - "StatusCallback": status_callback, - "StatusCallbackMethod": status_callback_method, - } - ) - - payload = self._version.create( - method="POST", - uri=self._uri, - data=data, - ) - - return FeedbackSummaryInstance( - self._version, payload, account_sid=self._solution["account_sid"] - ) - - async def create_async( - self, - start_date: date, - end_date: date, - include_subaccounts: Union[bool, object] = values.unset, - status_callback: Union[str, object] = values.unset, - status_callback_method: Union[str, object] = values.unset, - ) -> FeedbackSummaryInstance: - """ - Asynchronously create the FeedbackSummaryInstance - - :param start_date: Only include feedback given on or after this date. Format is `YYYY-MM-DD` and specified in UTC. - :param end_date: Only include feedback given on or before this date. Format is `YYYY-MM-DD` and specified in UTC. - :param include_subaccounts: Whether to also include Feedback resources from all subaccounts. `true` includes feedback from all subaccounts and `false`, the default, includes feedback from only the specified account. - :param status_callback: The URL that we will request when the feedback summary is complete. - :param status_callback_method: The HTTP method (`GET` or `POST`) we use to make the request to the `StatusCallback` URL. - - :returns: The created FeedbackSummaryInstance - """ - - data = values.of( - { - "StartDate": serialize.iso8601_date(start_date), - "EndDate": serialize.iso8601_date(end_date), - "IncludeSubaccounts": include_subaccounts, - "StatusCallback": status_callback, - "StatusCallbackMethod": status_callback_method, - } - ) - - payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, - ) - - return FeedbackSummaryInstance( - self._version, payload, account_sid=self._solution["account_sid"] - ) - - def get(self, sid: str) -> FeedbackSummaryContext: - """ - Constructs a FeedbackSummaryContext - - :param sid: A 34 character string that uniquely identifies this resource. - """ - return FeedbackSummaryContext( - self._version, account_sid=self._solution["account_sid"], sid=sid - ) - - def __call__(self, sid: str) -> FeedbackSummaryContext: - """ - Constructs a FeedbackSummaryContext - - :param sid: A 34 character string that uniquely identifies this resource. - """ - return FeedbackSummaryContext( - self._version, account_sid=self._solution["account_sid"], sid=sid - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "<Twilio.Api.V2010.FeedbackSummaryList>" diff --git a/twilio/rest/api/v2010/account/call/payment.py b/twilio/rest/api/v2010/account/call/payment.py index 540baa84351041cb22a688d5d418ed77c59ed885..d6252f527749688c897aa0cb6bc54cf94504eb7b 100644 --- a/twilio/rest/api/v2010/account/call/payment.py +++ b/twilio/rest/api/v2010/account/call/payment.py @@ -354,8 +354,8 @@ class PaymentList(ListResource): "Parameter": serialize.object(parameter), "PaymentConnector": payment_connector, "PaymentMethod": payment_method, - "PostalCode": postal_code, - "SecurityCode": security_code, + "PostalCode": serialize.boolean_to_string(postal_code), + "SecurityCode": serialize.boolean_to_string(security_code), "Timeout": timeout, "TokenType": token_type, "ValidCardTypes": valid_card_types, @@ -432,8 +432,8 @@ class PaymentList(ListResource): "Parameter": serialize.object(parameter), "PaymentConnector": payment_connector, "PaymentMethod": payment_method, - "PostalCode": postal_code, - "SecurityCode": security_code, + "PostalCode": serialize.boolean_to_string(postal_code), + "SecurityCode": serialize.boolean_to_string(security_code), "Timeout": timeout, "TokenType": token_type, "ValidCardTypes": valid_card_types, diff --git a/twilio/rest/api/v2010/account/conference/participant.py b/twilio/rest/api/v2010/account/conference/participant.py index 3759e4558d0f62a2843a55b6a0a76aa9380ca60f..1f3fffd8a48719fb96f20ad84961fb4633b27221 100644 --- a/twilio/rest/api/v2010/account/conference/participant.py +++ b/twilio/rest/api/v2010/account/conference/participant.py @@ -374,17 +374,19 @@ class ParticipantContext(InstanceContext): """ data = values.of( { - "Muted": muted, - "Hold": hold, + "Muted": serialize.boolean_to_string(muted), + "Hold": serialize.boolean_to_string(hold), "HoldUrl": hold_url, "HoldMethod": hold_method, "AnnounceUrl": announce_url, "AnnounceMethod": announce_method, "WaitUrl": wait_url, "WaitMethod": wait_method, - "BeepOnExit": beep_on_exit, - "EndConferenceOnExit": end_conference_on_exit, - "Coaching": coaching, + "BeepOnExit": serialize.boolean_to_string(beep_on_exit), + "EndConferenceOnExit": serialize.boolean_to_string( + end_conference_on_exit + ), + "Coaching": serialize.boolean_to_string(coaching), "CallSidToCoach": call_sid_to_coach, } ) @@ -438,17 +440,19 @@ class ParticipantContext(InstanceContext): """ data = values.of( { - "Muted": muted, - "Hold": hold, + "Muted": serialize.boolean_to_string(muted), + "Hold": serialize.boolean_to_string(hold), "HoldUrl": hold_url, "HoldMethod": hold_method, "AnnounceUrl": announce_url, "AnnounceMethod": announce_method, "WaitUrl": wait_url, "WaitMethod": wait_method, - "BeepOnExit": beep_on_exit, - "EndConferenceOnExit": end_conference_on_exit, - "Coaching": coaching, + "BeepOnExit": serialize.boolean_to_string(beep_on_exit), + "EndConferenceOnExit": serialize.boolean_to_string( + end_conference_on_exit + ), + "Coaching": serialize.boolean_to_string(coaching), "CallSidToCoach": call_sid_to_coach, } ) @@ -642,14 +646,18 @@ class ParticipantList(ListResource): ), "Label": label, "Timeout": timeout, - "Record": record, - "Muted": muted, + "Record": serialize.boolean_to_string(record), + "Muted": serialize.boolean_to_string(muted), "Beep": beep, - "StartConferenceOnEnter": start_conference_on_enter, - "EndConferenceOnExit": end_conference_on_exit, + "StartConferenceOnEnter": serialize.boolean_to_string( + start_conference_on_enter + ), + "EndConferenceOnExit": serialize.boolean_to_string( + end_conference_on_exit + ), "WaitUrl": wait_url, "WaitMethod": wait_method, - "EarlyMedia": early_media, + "EarlyMedia": serialize.boolean_to_string(early_media), "MaxParticipants": max_participants, "ConferenceRecord": conference_record, "ConferenceTrim": conference_trim, @@ -672,7 +680,7 @@ class ParticipantList(ListResource): "ConferenceRecordingStatusCallbackEvent": serialize.map( conference_recording_status_callback_event, lambda e: e ), - "Coaching": coaching, + "Coaching": serialize.boolean_to_string(coaching), "CallSidToCoach": call_sid_to_coach, "JitterBufferSize": jitter_buffer_size, "Byoc": byoc, @@ -824,14 +832,18 @@ class ParticipantList(ListResource): ), "Label": label, "Timeout": timeout, - "Record": record, - "Muted": muted, + "Record": serialize.boolean_to_string(record), + "Muted": serialize.boolean_to_string(muted), "Beep": beep, - "StartConferenceOnEnter": start_conference_on_enter, - "EndConferenceOnExit": end_conference_on_exit, + "StartConferenceOnEnter": serialize.boolean_to_string( + start_conference_on_enter + ), + "EndConferenceOnExit": serialize.boolean_to_string( + end_conference_on_exit + ), "WaitUrl": wait_url, "WaitMethod": wait_method, - "EarlyMedia": early_media, + "EarlyMedia": serialize.boolean_to_string(early_media), "MaxParticipants": max_participants, "ConferenceRecord": conference_record, "ConferenceTrim": conference_trim, @@ -854,7 +866,7 @@ class ParticipantList(ListResource): "ConferenceRecordingStatusCallbackEvent": serialize.map( conference_recording_status_callback_event, lambda e: e ), - "Coaching": coaching, + "Coaching": serialize.boolean_to_string(coaching), "CallSidToCoach": call_sid_to_coach, "JitterBufferSize": jitter_buffer_size, "Byoc": byoc, @@ -1048,9 +1060,9 @@ class ParticipantList(ListResource): """ data = values.of( { - "Muted": muted, - "Hold": hold, - "Coaching": coaching, + "Muted": serialize.boolean_to_string(muted), + "Hold": serialize.boolean_to_string(hold), + "Coaching": serialize.boolean_to_string(coaching), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -1084,9 +1096,9 @@ class ParticipantList(ListResource): """ data = values.of( { - "Muted": muted, - "Hold": hold, - "Coaching": coaching, + "Muted": serialize.boolean_to_string(muted), + "Hold": serialize.boolean_to_string(hold), + "Coaching": serialize.boolean_to_string(coaching), "PageToken": page_token, "Page": page_number, "PageSize": page_size, 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 b1910d5bf69eec5cdf6bc5754e356a7d67eda03e..6fa4748b604673fc3e126104f8f11a5805dc651a 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -553,7 +553,9 @@ class IncomingPhoneNumberContext(InstanceContext): "StatusCallback": status_callback, "StatusCallbackMethod": status_callback_method, "VoiceApplicationSid": voice_application_sid, - "VoiceCallerIdLookup": voice_caller_id_lookup, + "VoiceCallerIdLookup": serialize.boolean_to_string( + voice_caller_id_lookup + ), "VoiceFallbackMethod": voice_fallback_method, "VoiceFallbackUrl": voice_fallback_url, "VoiceMethod": voice_method, @@ -653,7 +655,9 @@ class IncomingPhoneNumberContext(InstanceContext): "StatusCallback": status_callback, "StatusCallbackMethod": status_callback_method, "VoiceApplicationSid": voice_application_sid, - "VoiceCallerIdLookup": voice_caller_id_lookup, + "VoiceCallerIdLookup": serialize.boolean_to_string( + voice_caller_id_lookup + ), "VoiceFallbackMethod": voice_fallback_method, "VoiceFallbackUrl": voice_fallback_url, "VoiceMethod": voice_method, @@ -823,7 +827,9 @@ class IncomingPhoneNumberList(ListResource): "StatusCallback": status_callback, "StatusCallbackMethod": status_callback_method, "VoiceApplicationSid": voice_application_sid, - "VoiceCallerIdLookup": voice_caller_id_lookup, + "VoiceCallerIdLookup": serialize.boolean_to_string( + voice_caller_id_lookup + ), "VoiceFallbackMethod": voice_fallback_method, "VoiceFallbackUrl": voice_fallback_url, "VoiceMethod": voice_method, @@ -924,7 +930,9 @@ class IncomingPhoneNumberList(ListResource): "StatusCallback": status_callback, "StatusCallbackMethod": status_callback_method, "VoiceApplicationSid": voice_application_sid, - "VoiceCallerIdLookup": voice_caller_id_lookup, + "VoiceCallerIdLookup": serialize.boolean_to_string( + voice_caller_id_lookup + ), "VoiceFallbackMethod": voice_fallback_method, "VoiceFallbackUrl": voice_fallback_url, "VoiceMethod": voice_method, @@ -1132,7 +1140,7 @@ class IncomingPhoneNumberList(ListResource): """ data = values.of( { - "Beta": beta, + "Beta": serialize.boolean_to_string(beta), "FriendlyName": friendly_name, "PhoneNumber": phone_number, "Origin": origin, @@ -1171,7 +1179,7 @@ class IncomingPhoneNumberList(ListResource): """ data = values.of( { - "Beta": beta, + "Beta": serialize.boolean_to_string(beta), "FriendlyName": friendly_name, "PhoneNumber": phone_number, "Origin": origin, 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 6f87f0e94cee75fcdba62b85ac42688c93bfaa7e..454872032995d42a34f5c2c37ae4da232ed9c03e 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/local.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/local.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -263,7 +263,9 @@ class LocalList(ListResource): "StatusCallback": status_callback, "StatusCallbackMethod": status_callback_method, "VoiceApplicationSid": voice_application_sid, - "VoiceCallerIdLookup": voice_caller_id_lookup, + "VoiceCallerIdLookup": serialize.boolean_to_string( + voice_caller_id_lookup + ), "VoiceFallbackMethod": voice_fallback_method, "VoiceFallbackUrl": voice_fallback_url, "VoiceMethod": voice_method, @@ -359,7 +361,9 @@ class LocalList(ListResource): "StatusCallback": status_callback, "StatusCallbackMethod": status_callback_method, "VoiceApplicationSid": voice_application_sid, - "VoiceCallerIdLookup": voice_caller_id_lookup, + "VoiceCallerIdLookup": serialize.boolean_to_string( + voice_caller_id_lookup + ), "VoiceFallbackMethod": voice_fallback_method, "VoiceFallbackUrl": voice_fallback_url, "VoiceMethod": voice_method, @@ -565,7 +569,7 @@ class LocalList(ListResource): """ data = values.of( { - "Beta": beta, + "Beta": serialize.boolean_to_string(beta), "FriendlyName": friendly_name, "PhoneNumber": phone_number, "Origin": origin, @@ -604,7 +608,7 @@ class LocalList(ListResource): """ data = values.of( { - "Beta": beta, + "Beta": serialize.boolean_to_string(beta), "FriendlyName": friendly_name, "PhoneNumber": phone_number, "Origin": origin, 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 59fdda7a907974601e731023339277b141307302..6147d4bfe7af30d17a15b149185fcc645fe7d7f9 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -265,7 +265,9 @@ class MobileList(ListResource): "StatusCallback": status_callback, "StatusCallbackMethod": status_callback_method, "VoiceApplicationSid": voice_application_sid, - "VoiceCallerIdLookup": voice_caller_id_lookup, + "VoiceCallerIdLookup": serialize.boolean_to_string( + voice_caller_id_lookup + ), "VoiceFallbackMethod": voice_fallback_method, "VoiceFallbackUrl": voice_fallback_url, "VoiceMethod": voice_method, @@ -363,7 +365,9 @@ class MobileList(ListResource): "StatusCallback": status_callback, "StatusCallbackMethod": status_callback_method, "VoiceApplicationSid": voice_application_sid, - "VoiceCallerIdLookup": voice_caller_id_lookup, + "VoiceCallerIdLookup": serialize.boolean_to_string( + voice_caller_id_lookup + ), "VoiceFallbackMethod": voice_fallback_method, "VoiceFallbackUrl": voice_fallback_url, "VoiceMethod": voice_method, @@ -569,7 +573,7 @@ class MobileList(ListResource): """ data = values.of( { - "Beta": beta, + "Beta": serialize.boolean_to_string(beta), "FriendlyName": friendly_name, "PhoneNumber": phone_number, "Origin": origin, @@ -608,7 +612,7 @@ class MobileList(ListResource): """ data = values.of( { - "Beta": beta, + "Beta": serialize.boolean_to_string(beta), "FriendlyName": friendly_name, "PhoneNumber": phone_number, "Origin": origin, 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 e6a197283a232bd7efedfd5dfab4115b26e4c519..806b7c0500bcbb0904fcabedce7d1aebf6b80090 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 @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -265,7 +265,9 @@ class TollFreeList(ListResource): "StatusCallback": status_callback, "StatusCallbackMethod": status_callback_method, "VoiceApplicationSid": voice_application_sid, - "VoiceCallerIdLookup": voice_caller_id_lookup, + "VoiceCallerIdLookup": serialize.boolean_to_string( + voice_caller_id_lookup + ), "VoiceFallbackMethod": voice_fallback_method, "VoiceFallbackUrl": voice_fallback_url, "VoiceMethod": voice_method, @@ -363,7 +365,9 @@ class TollFreeList(ListResource): "StatusCallback": status_callback, "StatusCallbackMethod": status_callback_method, "VoiceApplicationSid": voice_application_sid, - "VoiceCallerIdLookup": voice_caller_id_lookup, + "VoiceCallerIdLookup": serialize.boolean_to_string( + voice_caller_id_lookup + ), "VoiceFallbackMethod": voice_fallback_method, "VoiceFallbackUrl": voice_fallback_url, "VoiceMethod": voice_method, @@ -569,7 +573,7 @@ class TollFreeList(ListResource): """ data = values.of( { - "Beta": beta, + "Beta": serialize.boolean_to_string(beta), "FriendlyName": friendly_name, "PhoneNumber": phone_number, "Origin": origin, @@ -608,7 +612,7 @@ class TollFreeList(ListResource): """ data = values.of( { - "Beta": beta, + "Beta": serialize.boolean_to_string(beta), "FriendlyName": friendly_name, "PhoneNumber": phone_number, "Origin": origin, diff --git a/twilio/rest/api/v2010/account/message/__init__.py b/twilio/rest/api/v2010/account/message/__init__.py index 9706e80cf022ae6e00d3cae6a1d58aabfebdc83c..972d80b172c7156fcde178ab06c5d01d10f765af 100644 --- a/twilio/rest/api/v2010/account/message/__init__.py +++ b/twilio/rest/api/v2010/account/message/__init__.py @@ -508,8 +508,8 @@ class MessageList(ListResource): :param to: The recipient's phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (for SMS/MMS) or [channel address](https://www.twilio.com/docs/messaging/channels), e.g. `whatsapp:+15552229999`. :param status_callback: The URL of the endpoint to which Twilio sends [Message status callback requests](https://www.twilio.com/docs/sms/api/message-resource#twilios-request-to-the-statuscallback-url). URL must contain a valid hostname and underscores are not allowed. If you include this parameter with the `messaging_service_sid`, Twilio uses this URL instead of the Status Callback URL of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource). - :param application_sid: The SID of the associated [TwiML Application](https://www.twilio.com/docs/usage/api/applications). If this parameter is provided, the `status_callback` parameter of this request is ignored; [Message status callback requests](https://www.twilio.com/docs/sms/api/message-resource#twilios-request-to-the-statuscallback-url) are sent to the TwiML App's `message_status_callback` URL. - :param max_price: The maximum price in US dollars that you are willing to pay for this Message's delivery. The value can have up to four decimal places. When the `max_price` parameter is provided, the cost of a message is checked before it is sent. If the cost exceeds `max_price`, the message is not sent and the Message `status` is `failed`. + :param application_sid: The SID of the associated [TwiML Application](https://www.twilio.com/docs/usage/api/applications). [Message status callback requests](https://www.twilio.com/docs/sms/api/message-resource#twilios-request-to-the-statuscallback-url) are sent to the TwiML App's `message_status_callback` URL. Note that the `status_callback` parameter of a request takes priority over the `application_sid` parameter; if both are included `application_sid` is ignored. + :param max_price: [DEPRECATED] This parameter will no longer have any effect as of 2024-06-03. :param provide_feedback: Boolean indicating whether or not you intend to provide delivery confirmation feedback to Twilio (used in conjunction with the [Message Feedback subresource](https://www.twilio.com/docs/sms/api/message-feedback-resource)). Default value is `false`. :param attempt: Total number of attempts made (including this request) to send the message regardless of the provider used :param validity_period: The maximum length in seconds that the Message can remain in Twilio's outgoing message queue. If a queued Message exceeds the `validity_period`, the Message is not sent. Accepted values are integers from `1` to `14400`. Default value is `14400`. A `validity_period` greater than `5` is recommended. [Learn more about the validity period](https://www.twilio.com/blog/take-more-control-of-outbound-messages-using-validity-period-html) @@ -539,18 +539,18 @@ class MessageList(ListResource): "StatusCallback": status_callback, "ApplicationSid": application_sid, "MaxPrice": max_price, - "ProvideFeedback": provide_feedback, + "ProvideFeedback": serialize.boolean_to_string(provide_feedback), "Attempt": attempt, "ValidityPeriod": validity_period, - "ForceDelivery": force_delivery, + "ForceDelivery": serialize.boolean_to_string(force_delivery), "ContentRetention": content_retention, "AddressRetention": address_retention, - "SmartEncoded": smart_encoded, + "SmartEncoded": serialize.boolean_to_string(smart_encoded), "PersistentAction": serialize.map(persistent_action, lambda e: e), - "ShortenUrls": shorten_urls, + "ShortenUrls": serialize.boolean_to_string(shorten_urls), "ScheduleType": schedule_type, "SendAt": serialize.iso8601_datetime(send_at), - "SendAsMms": send_as_mms, + "SendAsMms": serialize.boolean_to_string(send_as_mms), "ContentVariables": content_variables, "RiskCheck": risk_check, "From": from_, @@ -606,8 +606,8 @@ class MessageList(ListResource): :param to: The recipient's phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (for SMS/MMS) or [channel address](https://www.twilio.com/docs/messaging/channels), e.g. `whatsapp:+15552229999`. :param status_callback: The URL of the endpoint to which Twilio sends [Message status callback requests](https://www.twilio.com/docs/sms/api/message-resource#twilios-request-to-the-statuscallback-url). URL must contain a valid hostname and underscores are not allowed. If you include this parameter with the `messaging_service_sid`, Twilio uses this URL instead of the Status Callback URL of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource). - :param application_sid: The SID of the associated [TwiML Application](https://www.twilio.com/docs/usage/api/applications). If this parameter is provided, the `status_callback` parameter of this request is ignored; [Message status callback requests](https://www.twilio.com/docs/sms/api/message-resource#twilios-request-to-the-statuscallback-url) are sent to the TwiML App's `message_status_callback` URL. - :param max_price: The maximum price in US dollars that you are willing to pay for this Message's delivery. The value can have up to four decimal places. When the `max_price` parameter is provided, the cost of a message is checked before it is sent. If the cost exceeds `max_price`, the message is not sent and the Message `status` is `failed`. + :param application_sid: The SID of the associated [TwiML Application](https://www.twilio.com/docs/usage/api/applications). [Message status callback requests](https://www.twilio.com/docs/sms/api/message-resource#twilios-request-to-the-statuscallback-url) are sent to the TwiML App's `message_status_callback` URL. Note that the `status_callback` parameter of a request takes priority over the `application_sid` parameter; if both are included `application_sid` is ignored. + :param max_price: [DEPRECATED] This parameter will no longer have any effect as of 2024-06-03. :param provide_feedback: Boolean indicating whether or not you intend to provide delivery confirmation feedback to Twilio (used in conjunction with the [Message Feedback subresource](https://www.twilio.com/docs/sms/api/message-feedback-resource)). Default value is `false`. :param attempt: Total number of attempts made (including this request) to send the message regardless of the provider used :param validity_period: The maximum length in seconds that the Message can remain in Twilio's outgoing message queue. If a queued Message exceeds the `validity_period`, the Message is not sent. Accepted values are integers from `1` to `14400`. Default value is `14400`. A `validity_period` greater than `5` is recommended. [Learn more about the validity period](https://www.twilio.com/blog/take-more-control-of-outbound-messages-using-validity-period-html) @@ -637,18 +637,18 @@ class MessageList(ListResource): "StatusCallback": status_callback, "ApplicationSid": application_sid, "MaxPrice": max_price, - "ProvideFeedback": provide_feedback, + "ProvideFeedback": serialize.boolean_to_string(provide_feedback), "Attempt": attempt, "ValidityPeriod": validity_period, - "ForceDelivery": force_delivery, + "ForceDelivery": serialize.boolean_to_string(force_delivery), "ContentRetention": content_retention, "AddressRetention": address_retention, - "SmartEncoded": smart_encoded, + "SmartEncoded": serialize.boolean_to_string(smart_encoded), "PersistentAction": serialize.map(persistent_action, lambda e: e), - "ShortenUrls": shorten_urls, + "ShortenUrls": serialize.boolean_to_string(shorten_urls), "ScheduleType": schedule_type, "SendAt": serialize.iso8601_datetime(send_at), - "SendAsMms": send_as_mms, + "SendAsMms": serialize.boolean_to_string(send_as_mms), "ContentVariables": content_variables, "RiskCheck": risk_check, "From": from_, diff --git a/twilio/rest/api/v2010/account/recording/__init__.py b/twilio/rest/api/v2010/account/recording/__init__.py index b6d7c982736db1c3b422babc651e89a217380779..bc1ddccb76eedb48831480b8fa2d8920573b296b 100644 --- a/twilio/rest/api/v2010/account/recording/__init__.py +++ b/twilio/rest/api/v2010/account/recording/__init__.py @@ -258,7 +258,7 @@ class RecordingContext(InstanceContext): data = values.of( { - "IncludeSoftDeleted": include_soft_deleted, + "IncludeSoftDeleted": serialize.boolean_to_string(include_soft_deleted), } ) @@ -284,7 +284,7 @@ class RecordingContext(InstanceContext): data = values.of( { - "IncludeSoftDeleted": include_soft_deleted, + "IncludeSoftDeleted": serialize.boolean_to_string(include_soft_deleted), } ) @@ -588,7 +588,7 @@ class RecordingList(ListResource): "DateCreated>": serialize.iso8601_datetime(date_created_after), "CallSid": call_sid, "ConferenceSid": conference_sid, - "IncludeSoftDeleted": include_soft_deleted, + "IncludeSoftDeleted": serialize.boolean_to_string(include_soft_deleted), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -633,7 +633,7 @@ class RecordingList(ListResource): "DateCreated>": serialize.iso8601_datetime(date_created_after), "CallSid": call_sid, "ConferenceSid": conference_sid, - "IncludeSoftDeleted": include_soft_deleted, + "IncludeSoftDeleted": serialize.boolean_to_string(include_soft_deleted), "PageToken": page_token, "Page": page_number, "PageSize": page_size, diff --git a/twilio/rest/api/v2010/account/sip/domain/__init__.py b/twilio/rest/api/v2010/account/sip/domain/__init__.py index f59a0c8a27180a5cd05b10a7d944946732f1e3d8..b469628388fdd8fc0d7ab4b30eccfee4004ef98c 100644 --- a/twilio/rest/api/v2010/account/sip/domain/__init__.py +++ b/twilio/rest/api/v2010/account/sip/domain/__init__.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -423,10 +423,12 @@ class DomainContext(InstanceContext): "VoiceStatusCallbackMethod": voice_status_callback_method, "VoiceStatusCallbackUrl": voice_status_callback_url, "VoiceUrl": voice_url, - "SipRegistration": sip_registration, + "SipRegistration": serialize.boolean_to_string(sip_registration), "DomainName": domain_name, - "EmergencyCallingEnabled": emergency_calling_enabled, - "Secure": secure, + "EmergencyCallingEnabled": serialize.boolean_to_string( + emergency_calling_enabled + ), + "Secure": serialize.boolean_to_string(secure), "ByocTrunkSid": byoc_trunk_sid, "EmergencyCallerSid": emergency_caller_sid, } @@ -489,10 +491,12 @@ class DomainContext(InstanceContext): "VoiceStatusCallbackMethod": voice_status_callback_method, "VoiceStatusCallbackUrl": voice_status_callback_url, "VoiceUrl": voice_url, - "SipRegistration": sip_registration, + "SipRegistration": serialize.boolean_to_string(sip_registration), "DomainName": domain_name, - "EmergencyCallingEnabled": emergency_calling_enabled, - "Secure": secure, + "EmergencyCallingEnabled": serialize.boolean_to_string( + emergency_calling_enabled + ), + "Secure": serialize.boolean_to_string(secure), "ByocTrunkSid": byoc_trunk_sid, "EmergencyCallerSid": emergency_caller_sid, } @@ -645,9 +649,11 @@ class DomainList(ListResource): "VoiceFallbackMethod": voice_fallback_method, "VoiceStatusCallbackUrl": voice_status_callback_url, "VoiceStatusCallbackMethod": voice_status_callback_method, - "SipRegistration": sip_registration, - "EmergencyCallingEnabled": emergency_calling_enabled, - "Secure": secure, + "SipRegistration": serialize.boolean_to_string(sip_registration), + "EmergencyCallingEnabled": serialize.boolean_to_string( + emergency_calling_enabled + ), + "Secure": serialize.boolean_to_string(secure), "ByocTrunkSid": byoc_trunk_sid, "EmergencyCallerSid": emergency_caller_sid, } @@ -709,9 +715,11 @@ class DomainList(ListResource): "VoiceFallbackMethod": voice_fallback_method, "VoiceStatusCallbackUrl": voice_status_callback_url, "VoiceStatusCallbackMethod": voice_status_callback_method, - "SipRegistration": sip_registration, - "EmergencyCallingEnabled": emergency_calling_enabled, - "Secure": secure, + "SipRegistration": serialize.boolean_to_string(sip_registration), + "EmergencyCallingEnabled": serialize.boolean_to_string( + emergency_calling_enabled + ), + "Secure": serialize.boolean_to_string(secure), "ByocTrunkSid": byoc_trunk_sid, "EmergencyCallerSid": emergency_caller_sid, } diff --git a/twilio/rest/api/v2010/account/usage/record/__init__.py b/twilio/rest/api/v2010/account/usage/record/__init__.py index 8f8236fa23ce780b8002ef079716eca10432d774..0afc8e3472d0958fbde4df57053826198ffd32dc 100644 --- a/twilio/rest/api/v2010/account/usage/record/__init__.py +++ b/twilio/rest/api/v2010/account/usage/record/__init__.py @@ -646,7 +646,7 @@ class RecordList(ListResource): "Category": category, "StartDate": serialize.iso8601_date(start_date), "EndDate": serialize.iso8601_date(end_date), - "IncludeSubaccounts": include_subaccounts, + "IncludeSubaccounts": serialize.boolean_to_string(include_subaccounts), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -685,7 +685,7 @@ class RecordList(ListResource): "Category": category, "StartDate": serialize.iso8601_date(start_date), "EndDate": serialize.iso8601_date(end_date), - "IncludeSubaccounts": include_subaccounts, + "IncludeSubaccounts": serialize.boolean_to_string(include_subaccounts), "PageToken": page_token, "Page": page_number, "PageSize": page_size, 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 5c424bbb8048a5eafd5e1fc0c19b68cbbd377ad3..7c0b6f5ce415f325074070271439d300589f0ce7 100644 --- a/twilio/rest/api/v2010/account/usage/record/all_time.py +++ b/twilio/rest/api/v2010/account/usage/record/all_time.py @@ -629,7 +629,7 @@ class AllTimeList(ListResource): "Category": category, "StartDate": serialize.iso8601_date(start_date), "EndDate": serialize.iso8601_date(end_date), - "IncludeSubaccounts": include_subaccounts, + "IncludeSubaccounts": serialize.boolean_to_string(include_subaccounts), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -668,7 +668,7 @@ class AllTimeList(ListResource): "Category": category, "StartDate": serialize.iso8601_date(start_date), "EndDate": serialize.iso8601_date(end_date), - "IncludeSubaccounts": include_subaccounts, + "IncludeSubaccounts": serialize.boolean_to_string(include_subaccounts), "PageToken": page_token, "Page": page_number, "PageSize": page_size, diff --git a/twilio/rest/api/v2010/account/usage/record/daily.py b/twilio/rest/api/v2010/account/usage/record/daily.py index 6ce34da0225873afda025f891da6f9686d6bbf29..a0acd62b2a05ce803887347c51181449be47ba0a 100644 --- a/twilio/rest/api/v2010/account/usage/record/daily.py +++ b/twilio/rest/api/v2010/account/usage/record/daily.py @@ -629,7 +629,7 @@ class DailyList(ListResource): "Category": category, "StartDate": serialize.iso8601_date(start_date), "EndDate": serialize.iso8601_date(end_date), - "IncludeSubaccounts": include_subaccounts, + "IncludeSubaccounts": serialize.boolean_to_string(include_subaccounts), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -668,7 +668,7 @@ class DailyList(ListResource): "Category": category, "StartDate": serialize.iso8601_date(start_date), "EndDate": serialize.iso8601_date(end_date), - "IncludeSubaccounts": include_subaccounts, + "IncludeSubaccounts": serialize.boolean_to_string(include_subaccounts), "PageToken": page_token, "Page": page_number, "PageSize": page_size, 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 53b6deec6f182a901959573ae0d1dac158cd2089..21fa1e1b61beeea501fb77dac1fd6bc7f7367c5b 100644 --- a/twilio/rest/api/v2010/account/usage/record/last_month.py +++ b/twilio/rest/api/v2010/account/usage/record/last_month.py @@ -629,7 +629,7 @@ class LastMonthList(ListResource): "Category": category, "StartDate": serialize.iso8601_date(start_date), "EndDate": serialize.iso8601_date(end_date), - "IncludeSubaccounts": include_subaccounts, + "IncludeSubaccounts": serialize.boolean_to_string(include_subaccounts), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -668,7 +668,7 @@ class LastMonthList(ListResource): "Category": category, "StartDate": serialize.iso8601_date(start_date), "EndDate": serialize.iso8601_date(end_date), - "IncludeSubaccounts": include_subaccounts, + "IncludeSubaccounts": serialize.boolean_to_string(include_subaccounts), "PageToken": page_token, "Page": page_number, "PageSize": page_size, diff --git a/twilio/rest/api/v2010/account/usage/record/monthly.py b/twilio/rest/api/v2010/account/usage/record/monthly.py index baa1164a7d04cd08228d430b49775f72596b0c58..0eff14396a778dec6dd660fbca559d02a41e5f57 100644 --- a/twilio/rest/api/v2010/account/usage/record/monthly.py +++ b/twilio/rest/api/v2010/account/usage/record/monthly.py @@ -629,7 +629,7 @@ class MonthlyList(ListResource): "Category": category, "StartDate": serialize.iso8601_date(start_date), "EndDate": serialize.iso8601_date(end_date), - "IncludeSubaccounts": include_subaccounts, + "IncludeSubaccounts": serialize.boolean_to_string(include_subaccounts), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -668,7 +668,7 @@ class MonthlyList(ListResource): "Category": category, "StartDate": serialize.iso8601_date(start_date), "EndDate": serialize.iso8601_date(end_date), - "IncludeSubaccounts": include_subaccounts, + "IncludeSubaccounts": serialize.boolean_to_string(include_subaccounts), "PageToken": page_token, "Page": page_number, "PageSize": page_size, 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 5ce2ddc58ad6f285b8df865ca038c9c62283a031..646b4a49d5251eb60eadc2edf2f67227d2e2b9d9 100644 --- a/twilio/rest/api/v2010/account/usage/record/this_month.py +++ b/twilio/rest/api/v2010/account/usage/record/this_month.py @@ -629,7 +629,7 @@ class ThisMonthList(ListResource): "Category": category, "StartDate": serialize.iso8601_date(start_date), "EndDate": serialize.iso8601_date(end_date), - "IncludeSubaccounts": include_subaccounts, + "IncludeSubaccounts": serialize.boolean_to_string(include_subaccounts), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -668,7 +668,7 @@ class ThisMonthList(ListResource): "Category": category, "StartDate": serialize.iso8601_date(start_date), "EndDate": serialize.iso8601_date(end_date), - "IncludeSubaccounts": include_subaccounts, + "IncludeSubaccounts": serialize.boolean_to_string(include_subaccounts), "PageToken": page_token, "Page": page_number, "PageSize": page_size, diff --git a/twilio/rest/api/v2010/account/usage/record/today.py b/twilio/rest/api/v2010/account/usage/record/today.py index cb814db8198623db6fca9ed75bf88f73652fcdd3..30de9d4cb719660eaca80b2f4ce02ea043cba1d5 100644 --- a/twilio/rest/api/v2010/account/usage/record/today.py +++ b/twilio/rest/api/v2010/account/usage/record/today.py @@ -629,7 +629,7 @@ class TodayList(ListResource): "Category": category, "StartDate": serialize.iso8601_date(start_date), "EndDate": serialize.iso8601_date(end_date), - "IncludeSubaccounts": include_subaccounts, + "IncludeSubaccounts": serialize.boolean_to_string(include_subaccounts), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -668,7 +668,7 @@ class TodayList(ListResource): "Category": category, "StartDate": serialize.iso8601_date(start_date), "EndDate": serialize.iso8601_date(end_date), - "IncludeSubaccounts": include_subaccounts, + "IncludeSubaccounts": serialize.boolean_to_string(include_subaccounts), "PageToken": page_token, "Page": page_number, "PageSize": page_size, diff --git a/twilio/rest/api/v2010/account/usage/record/yearly.py b/twilio/rest/api/v2010/account/usage/record/yearly.py index ac757b9eb721a0517db1c1cf7a08afbd00fd5951..fbe9dd1f6f8ca6252d704651cd9fc10da47e8974 100644 --- a/twilio/rest/api/v2010/account/usage/record/yearly.py +++ b/twilio/rest/api/v2010/account/usage/record/yearly.py @@ -629,7 +629,7 @@ class YearlyList(ListResource): "Category": category, "StartDate": serialize.iso8601_date(start_date), "EndDate": serialize.iso8601_date(end_date), - "IncludeSubaccounts": include_subaccounts, + "IncludeSubaccounts": serialize.boolean_to_string(include_subaccounts), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -668,7 +668,7 @@ class YearlyList(ListResource): "Category": category, "StartDate": serialize.iso8601_date(start_date), "EndDate": serialize.iso8601_date(end_date), - "IncludeSubaccounts": include_subaccounts, + "IncludeSubaccounts": serialize.boolean_to_string(include_subaccounts), "PageToken": page_token, "Page": page_number, "PageSize": page_size, diff --git a/twilio/rest/api/v2010/account/usage/record/yesterday.py b/twilio/rest/api/v2010/account/usage/record/yesterday.py index ab262b7092436af9dd2f116d0508e7a1895bc726..db5f9eb47246f30325a0e59a73f5c4a238310b07 100644 --- a/twilio/rest/api/v2010/account/usage/record/yesterday.py +++ b/twilio/rest/api/v2010/account/usage/record/yesterday.py @@ -629,7 +629,7 @@ class YesterdayList(ListResource): "Category": category, "StartDate": serialize.iso8601_date(start_date), "EndDate": serialize.iso8601_date(end_date), - "IncludeSubaccounts": include_subaccounts, + "IncludeSubaccounts": serialize.boolean_to_string(include_subaccounts), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -668,7 +668,7 @@ class YesterdayList(ListResource): "Category": category, "StartDate": serialize.iso8601_date(start_date), "EndDate": serialize.iso8601_date(end_date), - "IncludeSubaccounts": include_subaccounts, + "IncludeSubaccounts": serialize.boolean_to_string(include_subaccounts), "PageToken": page_token, "Page": page_number, "PageSize": page_size, diff --git a/twilio/rest/bulkexports/v1/export_configuration.py b/twilio/rest/bulkexports/v1/export_configuration.py index 59aee93915011b69c462b36a716aac9c7d048bac..c6629d21cf57265d76520b0a02317f809a84269b 100644 --- a/twilio/rest/bulkexports/v1/export_configuration.py +++ b/twilio/rest/bulkexports/v1/export_configuration.py @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, Optional, Union -from twilio.base import values +from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -205,7 +205,7 @@ class ExportConfigurationContext(InstanceContext): """ data = values.of( { - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), "WebhookUrl": webhook_url, "WebhookMethod": webhook_method, } @@ -238,7 +238,7 @@ class ExportConfigurationContext(InstanceContext): """ data = values.of( { - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), "WebhookUrl": webhook_url, "WebhookMethod": webhook_method, } diff --git a/twilio/rest/chat/v1/credential.py b/twilio/rest/chat/v1/credential.py index 8b477b675dbfded3237da16668078f1ce4dd6f4e..68ec9f4b463619d5ea10794a6674720ccb016458 100644 --- a/twilio/rest/chat/v1/credential.py +++ b/twilio/rest/chat/v1/credential.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -289,7 +289,7 @@ class CredentialContext(InstanceContext): "FriendlyName": friendly_name, "Certificate": certificate, "PrivateKey": private_key, - "Sandbox": sandbox, + "Sandbox": serialize.boolean_to_string(sandbox), "ApiKey": api_key, "Secret": secret, } @@ -329,7 +329,7 @@ class CredentialContext(InstanceContext): "FriendlyName": friendly_name, "Certificate": certificate, "PrivateKey": private_key, - "Sandbox": sandbox, + "Sandbox": serialize.boolean_to_string(sandbox), "ApiKey": api_key, "Secret": secret, } @@ -415,7 +415,7 @@ class CredentialList(ListResource): "FriendlyName": friendly_name, "Certificate": certificate, "PrivateKey": private_key, - "Sandbox": sandbox, + "Sandbox": serialize.boolean_to_string(sandbox), "ApiKey": api_key, "Secret": secret, } @@ -459,7 +459,7 @@ class CredentialList(ListResource): "FriendlyName": friendly_name, "Certificate": certificate, "PrivateKey": private_key, - "Sandbox": sandbox, + "Sandbox": serialize.boolean_to_string(sandbox), "ApiKey": api_key, "Secret": secret, } diff --git a/twilio/rest/chat/v1/service/__init__.py b/twilio/rest/chat/v1/service/__init__.py index 2783da6a9a4cfac5f14c4ffd509e95654c76d19f..1e2a5884a7a8ef10c18502b9430f8f991a8cc876 100644 --- a/twilio/rest/chat/v1/service/__init__.py +++ b/twilio/rest/chat/v1/service/__init__.py @@ -732,17 +732,27 @@ class ServiceContext(InstanceContext): "DefaultServiceRoleSid": default_service_role_sid, "DefaultChannelRoleSid": default_channel_role_sid, "DefaultChannelCreatorRoleSid": default_channel_creator_role_sid, - "ReadStatusEnabled": read_status_enabled, - "ReachabilityEnabled": reachability_enabled, + "ReadStatusEnabled": serialize.boolean_to_string(read_status_enabled), + "ReachabilityEnabled": serialize.boolean_to_string( + reachability_enabled + ), "TypingIndicatorTimeout": typing_indicator_timeout, "ConsumptionReportInterval": consumption_report_interval, - "Notifications.NewMessage.Enabled": notifications_new_message_enabled, + "Notifications.NewMessage.Enabled": serialize.boolean_to_string( + notifications_new_message_enabled + ), "Notifications.NewMessage.Template": notifications_new_message_template, - "Notifications.AddedToChannel.Enabled": notifications_added_to_channel_enabled, + "Notifications.AddedToChannel.Enabled": serialize.boolean_to_string( + notifications_added_to_channel_enabled + ), "Notifications.AddedToChannel.Template": notifications_added_to_channel_template, - "Notifications.RemovedFromChannel.Enabled": notifications_removed_from_channel_enabled, + "Notifications.RemovedFromChannel.Enabled": serialize.boolean_to_string( + notifications_removed_from_channel_enabled + ), "Notifications.RemovedFromChannel.Template": notifications_removed_from_channel_template, - "Notifications.InvitedToChannel.Enabled": notifications_invited_to_channel_enabled, + "Notifications.InvitedToChannel.Enabled": serialize.boolean_to_string( + notifications_invited_to_channel_enabled + ), "Notifications.InvitedToChannel.Template": notifications_invited_to_channel_template, "PreWebhookUrl": pre_webhook_url, "PostWebhookUrl": post_webhook_url, @@ -916,17 +926,27 @@ class ServiceContext(InstanceContext): "DefaultServiceRoleSid": default_service_role_sid, "DefaultChannelRoleSid": default_channel_role_sid, "DefaultChannelCreatorRoleSid": default_channel_creator_role_sid, - "ReadStatusEnabled": read_status_enabled, - "ReachabilityEnabled": reachability_enabled, + "ReadStatusEnabled": serialize.boolean_to_string(read_status_enabled), + "ReachabilityEnabled": serialize.boolean_to_string( + reachability_enabled + ), "TypingIndicatorTimeout": typing_indicator_timeout, "ConsumptionReportInterval": consumption_report_interval, - "Notifications.NewMessage.Enabled": notifications_new_message_enabled, + "Notifications.NewMessage.Enabled": serialize.boolean_to_string( + notifications_new_message_enabled + ), "Notifications.NewMessage.Template": notifications_new_message_template, - "Notifications.AddedToChannel.Enabled": notifications_added_to_channel_enabled, + "Notifications.AddedToChannel.Enabled": serialize.boolean_to_string( + notifications_added_to_channel_enabled + ), "Notifications.AddedToChannel.Template": notifications_added_to_channel_template, - "Notifications.RemovedFromChannel.Enabled": notifications_removed_from_channel_enabled, + "Notifications.RemovedFromChannel.Enabled": serialize.boolean_to_string( + notifications_removed_from_channel_enabled + ), "Notifications.RemovedFromChannel.Template": notifications_removed_from_channel_template, - "Notifications.InvitedToChannel.Enabled": notifications_invited_to_channel_enabled, + "Notifications.InvitedToChannel.Enabled": serialize.boolean_to_string( + notifications_invited_to_channel_enabled + ), "Notifications.InvitedToChannel.Template": notifications_invited_to_channel_template, "PreWebhookUrl": pre_webhook_url, "PostWebhookUrl": post_webhook_url, diff --git a/twilio/rest/chat/v2/credential.py b/twilio/rest/chat/v2/credential.py index 564cd5159fd3e1604dd6ec232bba1f5d62f87ec1..8011ed0e1f10c374afa48f7eb605d2f7d8a7a3cb 100644 --- a/twilio/rest/chat/v2/credential.py +++ b/twilio/rest/chat/v2/credential.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -289,7 +289,7 @@ class CredentialContext(InstanceContext): "FriendlyName": friendly_name, "Certificate": certificate, "PrivateKey": private_key, - "Sandbox": sandbox, + "Sandbox": serialize.boolean_to_string(sandbox), "ApiKey": api_key, "Secret": secret, } @@ -329,7 +329,7 @@ class CredentialContext(InstanceContext): "FriendlyName": friendly_name, "Certificate": certificate, "PrivateKey": private_key, - "Sandbox": sandbox, + "Sandbox": serialize.boolean_to_string(sandbox), "ApiKey": api_key, "Secret": secret, } @@ -415,7 +415,7 @@ class CredentialList(ListResource): "FriendlyName": friendly_name, "Certificate": certificate, "PrivateKey": private_key, - "Sandbox": sandbox, + "Sandbox": serialize.boolean_to_string(sandbox), "ApiKey": api_key, "Secret": secret, } @@ -459,7 +459,7 @@ class CredentialList(ListResource): "FriendlyName": friendly_name, "Certificate": certificate, "PrivateKey": private_key, - "Sandbox": sandbox, + "Sandbox": serialize.boolean_to_string(sandbox), "ApiKey": api_key, "Secret": secret, } diff --git a/twilio/rest/chat/v2/service/__init__.py b/twilio/rest/chat/v2/service/__init__.py index 66dd200b410047bfa3ca2b26a9ebf43c1b31780d..f6fa9e2c49865635ef2e8a3db7ba92d54f6a6c5a 100644 --- a/twilio/rest/chat/v2/service/__init__.py +++ b/twilio/rest/chat/v2/service/__init__.py @@ -571,21 +571,33 @@ class ServiceContext(InstanceContext): "DefaultServiceRoleSid": default_service_role_sid, "DefaultChannelRoleSid": default_channel_role_sid, "DefaultChannelCreatorRoleSid": default_channel_creator_role_sid, - "ReadStatusEnabled": read_status_enabled, - "ReachabilityEnabled": reachability_enabled, + "ReadStatusEnabled": serialize.boolean_to_string(read_status_enabled), + "ReachabilityEnabled": serialize.boolean_to_string( + reachability_enabled + ), "TypingIndicatorTimeout": typing_indicator_timeout, "ConsumptionReportInterval": consumption_report_interval, - "Notifications.NewMessage.Enabled": notifications_new_message_enabled, + "Notifications.NewMessage.Enabled": serialize.boolean_to_string( + notifications_new_message_enabled + ), "Notifications.NewMessage.Template": notifications_new_message_template, "Notifications.NewMessage.Sound": notifications_new_message_sound, - "Notifications.NewMessage.BadgeCountEnabled": notifications_new_message_badge_count_enabled, - "Notifications.AddedToChannel.Enabled": notifications_added_to_channel_enabled, + "Notifications.NewMessage.BadgeCountEnabled": serialize.boolean_to_string( + notifications_new_message_badge_count_enabled + ), + "Notifications.AddedToChannel.Enabled": serialize.boolean_to_string( + notifications_added_to_channel_enabled + ), "Notifications.AddedToChannel.Template": notifications_added_to_channel_template, "Notifications.AddedToChannel.Sound": notifications_added_to_channel_sound, - "Notifications.RemovedFromChannel.Enabled": notifications_removed_from_channel_enabled, + "Notifications.RemovedFromChannel.Enabled": serialize.boolean_to_string( + notifications_removed_from_channel_enabled + ), "Notifications.RemovedFromChannel.Template": notifications_removed_from_channel_template, "Notifications.RemovedFromChannel.Sound": notifications_removed_from_channel_sound, - "Notifications.InvitedToChannel.Enabled": notifications_invited_to_channel_enabled, + "Notifications.InvitedToChannel.Enabled": serialize.boolean_to_string( + notifications_invited_to_channel_enabled + ), "Notifications.InvitedToChannel.Template": notifications_invited_to_channel_template, "Notifications.InvitedToChannel.Sound": notifications_invited_to_channel_sound, "PreWebhookUrl": pre_webhook_url, @@ -597,7 +609,9 @@ class ServiceContext(InstanceContext): "Media.CompatibilityMessage": media_compatibility_message, "PreWebhookRetryCount": pre_webhook_retry_count, "PostWebhookRetryCount": post_webhook_retry_count, - "Notifications.LogEnabled": notifications_log_enabled, + "Notifications.LogEnabled": serialize.boolean_to_string( + notifications_log_enabled + ), } ) @@ -688,21 +702,33 @@ class ServiceContext(InstanceContext): "DefaultServiceRoleSid": default_service_role_sid, "DefaultChannelRoleSid": default_channel_role_sid, "DefaultChannelCreatorRoleSid": default_channel_creator_role_sid, - "ReadStatusEnabled": read_status_enabled, - "ReachabilityEnabled": reachability_enabled, + "ReadStatusEnabled": serialize.boolean_to_string(read_status_enabled), + "ReachabilityEnabled": serialize.boolean_to_string( + reachability_enabled + ), "TypingIndicatorTimeout": typing_indicator_timeout, "ConsumptionReportInterval": consumption_report_interval, - "Notifications.NewMessage.Enabled": notifications_new_message_enabled, + "Notifications.NewMessage.Enabled": serialize.boolean_to_string( + notifications_new_message_enabled + ), "Notifications.NewMessage.Template": notifications_new_message_template, "Notifications.NewMessage.Sound": notifications_new_message_sound, - "Notifications.NewMessage.BadgeCountEnabled": notifications_new_message_badge_count_enabled, - "Notifications.AddedToChannel.Enabled": notifications_added_to_channel_enabled, + "Notifications.NewMessage.BadgeCountEnabled": serialize.boolean_to_string( + notifications_new_message_badge_count_enabled + ), + "Notifications.AddedToChannel.Enabled": serialize.boolean_to_string( + notifications_added_to_channel_enabled + ), "Notifications.AddedToChannel.Template": notifications_added_to_channel_template, "Notifications.AddedToChannel.Sound": notifications_added_to_channel_sound, - "Notifications.RemovedFromChannel.Enabled": notifications_removed_from_channel_enabled, + "Notifications.RemovedFromChannel.Enabled": serialize.boolean_to_string( + notifications_removed_from_channel_enabled + ), "Notifications.RemovedFromChannel.Template": notifications_removed_from_channel_template, "Notifications.RemovedFromChannel.Sound": notifications_removed_from_channel_sound, - "Notifications.InvitedToChannel.Enabled": notifications_invited_to_channel_enabled, + "Notifications.InvitedToChannel.Enabled": serialize.boolean_to_string( + notifications_invited_to_channel_enabled + ), "Notifications.InvitedToChannel.Template": notifications_invited_to_channel_template, "Notifications.InvitedToChannel.Sound": notifications_invited_to_channel_sound, "PreWebhookUrl": pre_webhook_url, @@ -714,7 +740,9 @@ class ServiceContext(InstanceContext): "Media.CompatibilityMessage": media_compatibility_message, "PreWebhookRetryCount": pre_webhook_retry_count, "PostWebhookRetryCount": post_webhook_retry_count, - "Notifications.LogEnabled": notifications_log_enabled, + "Notifications.LogEnabled": serialize.boolean_to_string( + notifications_log_enabled + ), } ) diff --git a/twilio/rest/content/v1/content/__init__.py b/twilio/rest/content/v1/content/__init__.py index b057cb4f864975101e1decf2f58d90b76b7bd88e..bdc1102ca43bb9714c39b397cd7bd2a9d1793976 100644 --- a/twilio/rest/content/v1/content/__init__.py +++ b/twilio/rest/content/v1/content/__init__.py @@ -20,10 +20,27 @@ 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.content.v1.content.approval_create import ApprovalCreateList from twilio.rest.content.v1.content.approval_fetch import ApprovalFetchList class ContentInstance(InstanceResource): + + class AuthenticationActionType(object): + COPY_CODE = "COPY_CODE" + + class CallToActionActionType(object): + URL = "URL" + PHONE_NUMBER = "PHONE_NUMBER" + + class CardActionType(object): + URL = "URL" + PHONE_NUMBER = "PHONE_NUMBER" + QUICK_REPLY = "QUICK_REPLY" + + class QuickReplyActionType(object): + QUICK_REPLY = "QUICK_REPLY" + """ :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. @@ -32,7 +49,7 @@ class ContentInstance(InstanceResource): :ivar friendly_name: A string name used to describe the Content resource. Not visible to the end recipient. :ivar language: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. :ivar variables: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. - :ivar types: The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource. + :ivar types: The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. :ivar url: The URL of the resource, relative to `https://content.twilio.com`. :ivar links: A list of links related to the Content resource, such as approval_fetch and approval_create """ @@ -113,6 +130,13 @@ class ContentInstance(InstanceResource): """ return await self._proxy.fetch_async() + @property + def approval_create(self) -> ApprovalCreateList: + """ + Access the approval_create + """ + return self._proxy.approval_create + @property def approval_fetch(self) -> ApprovalFetchList: """ @@ -147,6 +171,7 @@ class ContentContext(InstanceContext): } self._uri = "/Content/{sid}".format(**self._solution) + self._approval_create: Optional[ApprovalCreateList] = None self._approval_fetch: Optional[ApprovalFetchList] = None def delete(self) -> bool: @@ -211,6 +236,18 @@ class ContentContext(InstanceContext): sid=self._solution["sid"], ) + @property + def approval_create(self) -> ApprovalCreateList: + """ + Access the approval_create + """ + if self._approval_create is None: + self._approval_create = ApprovalCreateList( + self._version, + self._solution["sid"], + ) + return self._approval_create + @property def approval_fetch(self) -> ApprovalFetchList: """ @@ -254,6 +291,451 @@ class ContentPage(Page): class ContentList(ListResource): + class AuthenticationAction(object): + """ + :ivar type: + :ivar copy_code_text: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.type: Optional["ContentInstance.AuthenticationActionType"] = ( + payload.get("type") + ) + self.copy_code_text: Optional[str] = payload.get("copy_code_text") + + def to_dict(self): + return { + "type": self.type.to_dict(), + "copy_code_text": self.copy_code_text, + } + + class CallToActionAction(object): + """ + :ivar type: + :ivar title: + :ivar url: + :ivar phone: + :ivar id: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.type: Optional["ContentInstance.CallToActionActionType"] = payload.get( + "type" + ) + self.title: Optional[str] = payload.get("title") + self.url: Optional[str] = payload.get("url") + self.phone: Optional[str] = payload.get("phone") + self.id: Optional[str] = payload.get("id") + + def to_dict(self): + return { + "type": self.type.to_dict(), + "title": self.title, + "url": self.url, + "phone": self.phone, + "id": self.id, + } + + class CardAction(object): + """ + :ivar type: + :ivar title: + :ivar url: + :ivar phone: + :ivar id: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.type: Optional["ContentInstance.CardActionType"] = payload.get("type") + self.title: Optional[str] = payload.get("title") + self.url: Optional[str] = payload.get("url") + self.phone: Optional[str] = payload.get("phone") + self.id: Optional[str] = payload.get("id") + + def to_dict(self): + return { + "type": self.type.to_dict(), + "title": self.title, + "url": self.url, + "phone": self.phone, + "id": self.id, + } + + class CatalogItem(object): + """ + :ivar id: + :ivar section_title: + :ivar name: + :ivar media_url: + :ivar price: + :ivar description: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.id: Optional[str] = payload.get("id") + self.section_title: Optional[str] = payload.get("section_title") + self.name: Optional[str] = payload.get("name") + self.media_url: Optional[str] = payload.get("media_url") + self.price: Optional[float] = payload.get("price") + self.description: Optional[str] = payload.get("description") + + def to_dict(self): + return { + "id": self.id, + "section_title": self.section_title, + "name": self.name, + "media_url": self.media_url, + "price": self.price, + "description": self.description, + } + + class ContentCreateRequest(object): + """ + :ivar friendly_name: User defined name of the content + :ivar variables: Key value pairs of variable name to value + :ivar language: Language code for the content + :ivar types: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.variables: Optional[dict[str, str]] = payload.get("variables") + self.language: Optional[str] = payload.get("language") + self.types: Optional[ContentList.Types] = payload.get("types") + + def to_dict(self): + return { + "friendly_name": self.friendly_name, + "variables": self.variables, + "language": self.language, + "types": self.types.to_dict(), + } + + class ListItem(object): + """ + :ivar id: + :ivar item: + :ivar description: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.id: Optional[str] = payload.get("id") + self.item: Optional[str] = payload.get("item") + self.description: Optional[str] = payload.get("description") + + def to_dict(self): + return { + "id": self.id, + "item": self.item, + "description": self.description, + } + + class QuickReplyAction(object): + """ + :ivar type: + :ivar title: + :ivar id: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.type: Optional["ContentInstance.QuickReplyActionType"] = payload.get( + "type" + ) + self.title: Optional[str] = payload.get("title") + self.id: Optional[str] = payload.get("id") + + def to_dict(self): + return { + "type": self.type.to_dict(), + "title": self.title, + "id": self.id, + } + + class TwilioCallToAction(object): + """ + :ivar body: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.body: Optional[str] = payload.get("body") + self.actions: Optional[List[ContentList.CallToActionAction]] = payload.get( + "actions" + ) + + def to_dict(self): + return { + "body": self.body, + "actions": [actions.to_dict() for actions in self.actions], + } + + class TwilioCard(object): + """ + :ivar title: + :ivar subtitle: + :ivar media: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.title: Optional[str] = payload.get("title") + self.subtitle: Optional[str] = payload.get("subtitle") + self.media: Optional[List[str]] = payload.get("media") + self.actions: Optional[List[ContentList.CardAction]] = payload.get( + "actions" + ) + + def to_dict(self): + return { + "title": self.title, + "subtitle": self.subtitle, + "media": self.media, + "actions": [actions.to_dict() for actions in self.actions], + } + + class TwilioCatalog(object): + """ + :ivar title: + :ivar body: + :ivar subtitle: + :ivar id: + :ivar items: + :ivar dynamic_items: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.title: Optional[str] = payload.get("title") + self.body: Optional[str] = payload.get("body") + self.subtitle: Optional[str] = payload.get("subtitle") + self.id: Optional[str] = payload.get("id") + self.items: Optional[List[ContentList.CatalogItem]] = payload.get("items") + self.dynamic_items: Optional[str] = payload.get("dynamic_items") + + def to_dict(self): + return { + "title": self.title, + "body": self.body, + "subtitle": self.subtitle, + "id": self.id, + "items": [items.to_dict() for items in self.items], + "dynamic_items": self.dynamic_items, + } + + class TwilioListPicker(object): + """ + :ivar body: + :ivar button: + :ivar items: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.body: Optional[str] = payload.get("body") + self.button: Optional[str] = payload.get("button") + self.items: Optional[List[ContentList.ListItem]] = payload.get("items") + + def to_dict(self): + return { + "body": self.body, + "button": self.button, + "items": [items.to_dict() for items in self.items], + } + + class TwilioLocation(object): + """ + :ivar latitude: + :ivar longitude: + :ivar label: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.latitude: Optional[float] = payload.get("latitude") + self.longitude: Optional[float] = payload.get("longitude") + self.label: Optional[str] = payload.get("label") + + def to_dict(self): + return { + "latitude": self.latitude, + "longitude": self.longitude, + "label": self.label, + } + + class TwilioMedia(object): + """ + :ivar body: + :ivar media: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.body: Optional[str] = payload.get("body") + self.media: Optional[List[str]] = payload.get("media") + + def to_dict(self): + return { + "body": self.body, + "media": self.media, + } + + class TwilioQuickReply(object): + """ + :ivar body: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.body: Optional[str] = payload.get("body") + self.actions: Optional[List[ContentList.QuickReplyAction]] = payload.get( + "actions" + ) + + def to_dict(self): + return { + "body": self.body, + "actions": [actions.to_dict() for actions in self.actions], + } + + class TwilioText(object): + """ + :ivar body: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.body: Optional[str] = payload.get("body") + + def to_dict(self): + return { + "body": self.body, + } + + class Types(object): + """ + :ivar twilio_text: + :ivar twilio_media: + :ivar twilio_location: + :ivar twilio_list_picker: + :ivar twilio_call_to_action: + :ivar twilio_quick_reply: + :ivar twilio_card: + :ivar twilio_catalog: + :ivar whatsapp_card: + :ivar whatsapp_authentication: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.twilio_text: Optional[ContentList.TwilioText] = payload.get( + "twilio_text" + ) + self.twilio_media: Optional[ContentList.TwilioMedia] = payload.get( + "twilio_media" + ) + self.twilio_location: Optional[ContentList.TwilioLocation] = payload.get( + "twilio_location" + ) + self.twilio_list_picker: Optional[ContentList.TwilioListPicker] = ( + payload.get("twilio_list_picker") + ) + self.twilio_call_to_action: Optional[ContentList.TwilioCallToAction] = ( + payload.get("twilio_call_to_action") + ) + self.twilio_quick_reply: Optional[ContentList.TwilioQuickReply] = ( + payload.get("twilio_quick_reply") + ) + self.twilio_card: Optional[ContentList.TwilioCard] = payload.get( + "twilio_card" + ) + self.twilio_catalog: Optional[ContentList.TwilioCatalog] = payload.get( + "twilio_catalog" + ) + self.whatsapp_card: Optional[ContentList.WhatsappCard] = payload.get( + "whatsapp_card" + ) + self.whatsapp_authentication: Optional[ + ContentList.WhatsappAuthentication + ] = payload.get("whatsapp_authentication") + + def to_dict(self): + return { + "twilio_text": self.twilio_text.to_dict(), + "twilio_media": self.twilio_media.to_dict(), + "twilio_location": self.twilio_location.to_dict(), + "twilio_list_picker": self.twilio_list_picker.to_dict(), + "twilio_call_to_action": self.twilio_call_to_action.to_dict(), + "twilio_quick_reply": self.twilio_quick_reply.to_dict(), + "twilio_card": self.twilio_card.to_dict(), + "twilio_catalog": self.twilio_catalog.to_dict(), + "whatsapp_card": self.whatsapp_card.to_dict(), + "whatsapp_authentication": self.whatsapp_authentication.to_dict(), + } + + class WhatsappAuthentication(object): + """ + :ivar add_security_recommendation: + :ivar code_expiration_minutes: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.add_security_recommendation: Optional[bool] = payload.get( + "add_security_recommendation" + ) + self.code_expiration_minutes: Optional[float] = payload.get( + "code_expiration_minutes" + ) + self.actions: Optional[List[ContentList.AuthenticationAction]] = ( + payload.get("actions") + ) + + def to_dict(self): + return { + "add_security_recommendation": self.add_security_recommendation, + "code_expiration_minutes": self.code_expiration_minutes, + "actions": [actions.to_dict() for actions in self.actions], + } + + class WhatsappCard(object): + """ + :ivar body: + :ivar footer: + :ivar media: + :ivar header_text: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.body: Optional[str] = payload.get("body") + self.footer: Optional[str] = payload.get("footer") + self.media: Optional[List[str]] = payload.get("media") + self.header_text: Optional[str] = payload.get("header_text") + self.actions: Optional[List[ContentList.CardAction]] = payload.get( + "actions" + ) + + def to_dict(self): + return { + "body": self.body, + "footer": self.footer, + "media": self.media, + "header_text": self.header_text, + "actions": [actions.to_dict() for actions in self.actions], + } + def __init__(self, version: Version): """ Initialize the ContentList @@ -265,6 +747,43 @@ class ContentList(ListResource): self._uri = "/Content" + def create(self, content_create_request: ContentCreateRequest) -> ContentInstance: + """ + Create the ContentInstance + + :param content_create_request: + + :returns: The created ContentInstance + """ + data = content_create_request.to_dict() + + headers = {"Content-Type": "application/json"} + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ContentInstance(self._version, payload) + + async def create_async( + self, content_create_request: ContentCreateRequest + ) -> ContentInstance: + """ + Asynchronously create the ContentInstance + + :param content_create_request: + + :returns: The created ContentInstance + """ + + data = content_create_request.to_dict() + headers = {"Content-Type": "application/json"} + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ContentInstance(self._version, payload) + def stream( self, limit: Optional[int] = None, diff --git a/twilio/rest/content/v1/content/approval_create.py b/twilio/rest/content/v1/content/approval_create.py new file mode 100644 index 0000000000000000000000000000000000000000..63a447430642f3b00c50f81a54adc20ee77d264a --- /dev/null +++ b/twilio/rest/content/v1/content/approval_create.py @@ -0,0 +1,138 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Content + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from typing import Any, Dict, Optional + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class ApprovalCreateInstance(InstanceResource): + """ + :ivar name: + :ivar category: + :ivar content_type: + :ivar status: + :ivar rejection_reason: + :ivar allow_category_change: + """ + + def __init__(self, version: Version, payload: Dict[str, Any], sid: str): + super().__init__(version) + + self.name: Optional[str] = payload.get("name") + self.category: Optional[str] = payload.get("category") + self.content_type: Optional[str] = payload.get("content_type") + self.status: Optional[str] = payload.get("status") + self.rejection_reason: Optional[str] = payload.get("rejection_reason") + self.allow_category_change: Optional[bool] = payload.get( + "allow_category_change" + ) + + self._solution = { + "sid": 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 "<Twilio.Content.V1.ApprovalCreateInstance {}>".format(context) + + +class ApprovalCreateList(ListResource): + + class ContentApprovalRequest(object): + """ + :ivar name: Name of the template. + :ivar category: A WhatsApp recognized template category. + """ + + def __init__(self, payload: Dict[str, Any], sid: str): + + self.name: Optional[str] = payload.get("name") + self.category: Optional[str] = payload.get("category") + + def to_dict(self): + return { + "name": self.name, + "category": self.category, + } + + def __init__(self, version: Version, sid: str): + """ + Initialize the ApprovalCreateList + + :param version: Version that contains the resource + :param sid: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "sid": sid, + } + self._uri = "/Content/{sid}/ApprovalRequests/whatsapp".format(**self._solution) + + def create( + self, content_approval_request: ContentApprovalRequest + ) -> ApprovalCreateInstance: + """ + Create the ApprovalCreateInstance + + :param content_approval_request: + + :returns: The created ApprovalCreateInstance + """ + data = content_approval_request.to_dict() + + headers = {"Content-Type": "application/json"} + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ApprovalCreateInstance(self._version, payload, sid=self._solution["sid"]) + + async def create_async( + self, content_approval_request: ContentApprovalRequest + ) -> ApprovalCreateInstance: + """ + Asynchronously create the ApprovalCreateInstance + + :param content_approval_request: + + :returns: The created ApprovalCreateInstance + """ + + data = content_approval_request.to_dict() + headers = {"Content-Type": "application/json"} + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ApprovalCreateInstance(self._version, payload, sid=self._solution["sid"]) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "<Twilio.Content.V1.ApprovalCreateList>" diff --git a/twilio/rest/content/v1/content_and_approvals.py b/twilio/rest/content/v1/content_and_approvals.py index e2d6d72aaf1582d40b04997fdaa8ecf209ae19c3..de40cfc172fc79035ecd2c41b29d21805add05ab 100644 --- a/twilio/rest/content/v1/content_and_approvals.py +++ b/twilio/rest/content/v1/content_and_approvals.py @@ -31,7 +31,7 @@ class ContentAndApprovalsInstance(InstanceResource): :ivar friendly_name: A string name used to describe the Content resource. Not visible to the end recipient. :ivar language: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. :ivar variables: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. - :ivar types: The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource. + :ivar types: The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. :ivar approval_requests: The submitted information and approval request status of the Content resource. """ diff --git a/twilio/rest/content/v1/legacy_content.py b/twilio/rest/content/v1/legacy_content.py index 5705c33b0bc8f0c257fc6ebd834ffd84e734320f..cfb4ac698d650f7e8a792b4c81a6a09f4cf381e3 100644 --- a/twilio/rest/content/v1/legacy_content.py +++ b/twilio/rest/content/v1/legacy_content.py @@ -31,7 +31,7 @@ class LegacyContentInstance(InstanceResource): :ivar friendly_name: A string name used to describe the Content resource. Not visible to the end recipient. :ivar language: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. :ivar variables: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. - :ivar types: The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource. + :ivar types: The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. :ivar legacy_template_name: The string name of the legacy content template associated with this Content resource, unique across all template names for its account. Only lowercase letters, numbers and underscores are allowed :ivar legacy_body: The string body field of the legacy content template associated with this Content resource :ivar url: The URL of the resource, relative to `https://content.twilio.com`. diff --git a/twilio/rest/conversations/v1/address_configuration.py b/twilio/rest/conversations/v1/address_configuration.py index 3295eade6cf262edb863da7b49d34faf5bc82e75..86cdb0806604fd5065944f28b5a8c72cad809c09 100644 --- a/twilio/rest/conversations/v1/address_configuration.py +++ b/twilio/rest/conversations/v1/address_configuration.py @@ -340,7 +340,9 @@ class AddressConfigurationContext(InstanceContext): data = values.of( { "FriendlyName": friendly_name, - "AutoCreation.Enabled": auto_creation_enabled, + "AutoCreation.Enabled": serialize.boolean_to_string( + auto_creation_enabled + ), "AutoCreation.Type": auto_creation_type, "AutoCreation.ConversationServiceSid": auto_creation_conversation_service_sid, "AutoCreation.WebhookUrl": auto_creation_webhook_url, @@ -397,7 +399,9 @@ class AddressConfigurationContext(InstanceContext): data = values.of( { "FriendlyName": friendly_name, - "AutoCreation.Enabled": auto_creation_enabled, + "AutoCreation.Enabled": serialize.boolean_to_string( + auto_creation_enabled + ), "AutoCreation.Type": auto_creation_type, "AutoCreation.ConversationServiceSid": auto_creation_conversation_service_sid, "AutoCreation.WebhookUrl": auto_creation_webhook_url, @@ -507,7 +511,9 @@ class AddressConfigurationList(ListResource): "Type": type, "Address": address, "FriendlyName": friendly_name, - "AutoCreation.Enabled": auto_creation_enabled, + "AutoCreation.Enabled": serialize.boolean_to_string( + auto_creation_enabled + ), "AutoCreation.Type": auto_creation_type, "AutoCreation.ConversationServiceSid": auto_creation_conversation_service_sid, "AutoCreation.WebhookUrl": auto_creation_webhook_url, @@ -572,7 +578,9 @@ class AddressConfigurationList(ListResource): "Type": type, "Address": address, "FriendlyName": friendly_name, - "AutoCreation.Enabled": auto_creation_enabled, + "AutoCreation.Enabled": serialize.boolean_to_string( + auto_creation_enabled + ), "AutoCreation.Type": auto_creation_type, "AutoCreation.ConversationServiceSid": auto_creation_conversation_service_sid, "AutoCreation.WebhookUrl": auto_creation_webhook_url, diff --git a/twilio/rest/conversations/v1/credential.py b/twilio/rest/conversations/v1/credential.py index 92f26d1f0aa401383edf96ee25e55c1394277c52..120710f7e859179fcfc5b3ef014a8992df728067 100644 --- a/twilio/rest/conversations/v1/credential.py +++ b/twilio/rest/conversations/v1/credential.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -298,7 +298,7 @@ class CredentialContext(InstanceContext): "FriendlyName": friendly_name, "Certificate": certificate, "PrivateKey": private_key, - "Sandbox": sandbox, + "Sandbox": serialize.boolean_to_string(sandbox), "ApiKey": api_key, "Secret": secret, } @@ -341,7 +341,7 @@ class CredentialContext(InstanceContext): "FriendlyName": friendly_name, "Certificate": certificate, "PrivateKey": private_key, - "Sandbox": sandbox, + "Sandbox": serialize.boolean_to_string(sandbox), "ApiKey": api_key, "Secret": secret, } @@ -427,7 +427,7 @@ class CredentialList(ListResource): "FriendlyName": friendly_name, "Certificate": certificate, "PrivateKey": private_key, - "Sandbox": sandbox, + "Sandbox": serialize.boolean_to_string(sandbox), "ApiKey": api_key, "Secret": secret, } @@ -471,7 +471,7 @@ class CredentialList(ListResource): "FriendlyName": friendly_name, "Certificate": certificate, "PrivateKey": private_key, - "Sandbox": sandbox, + "Sandbox": serialize.boolean_to_string(sandbox), "ApiKey": api_key, "Secret": secret, } diff --git a/twilio/rest/conversations/v1/service/configuration/__init__.py b/twilio/rest/conversations/v1/service/configuration/__init__.py index 15de8dfda9ad21263cbff3deed0b8e240a222b49..9ca23a435f6b49a83adf54cb914583a77bdd4f99 100644 --- a/twilio/rest/conversations/v1/service/configuration/__init__.py +++ b/twilio/rest/conversations/v1/service/configuration/__init__.py @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, Optional, Union -from twilio.base import values +from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -230,7 +230,9 @@ class ConfigurationContext(InstanceContext): "DefaultConversationCreatorRoleSid": default_conversation_creator_role_sid, "DefaultConversationRoleSid": default_conversation_role_sid, "DefaultChatServiceRoleSid": default_chat_service_role_sid, - "ReachabilityEnabled": reachability_enabled, + "ReachabilityEnabled": serialize.boolean_to_string( + reachability_enabled + ), } ) @@ -266,7 +268,9 @@ class ConfigurationContext(InstanceContext): "DefaultConversationCreatorRoleSid": default_conversation_creator_role_sid, "DefaultConversationRoleSid": default_conversation_role_sid, "DefaultChatServiceRoleSid": default_chat_service_role_sid, - "ReachabilityEnabled": reachability_enabled, + "ReachabilityEnabled": serialize.boolean_to_string( + reachability_enabled + ), } ) diff --git a/twilio/rest/conversations/v1/service/configuration/notification.py b/twilio/rest/conversations/v1/service/configuration/notification.py index 498478fdf7d14864c192d135e5a7441e6e8b74bd..2dee2d4d29ab084a8472d3dcd156bce96a38c484 100644 --- a/twilio/rest/conversations/v1/service/configuration/notification.py +++ b/twilio/rest/conversations/v1/service/configuration/notification.py @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, Optional, Union -from twilio.base import values +from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -292,18 +292,26 @@ class NotificationContext(InstanceContext): """ data = values.of( { - "LogEnabled": log_enabled, - "NewMessage.Enabled": new_message_enabled, + "LogEnabled": serialize.boolean_to_string(log_enabled), + "NewMessage.Enabled": serialize.boolean_to_string(new_message_enabled), "NewMessage.Template": new_message_template, "NewMessage.Sound": new_message_sound, - "NewMessage.BadgeCountEnabled": new_message_badge_count_enabled, - "AddedToConversation.Enabled": added_to_conversation_enabled, + "NewMessage.BadgeCountEnabled": serialize.boolean_to_string( + new_message_badge_count_enabled + ), + "AddedToConversation.Enabled": serialize.boolean_to_string( + added_to_conversation_enabled + ), "AddedToConversation.Template": added_to_conversation_template, "AddedToConversation.Sound": added_to_conversation_sound, - "RemovedFromConversation.Enabled": removed_from_conversation_enabled, + "RemovedFromConversation.Enabled": serialize.boolean_to_string( + removed_from_conversation_enabled + ), "RemovedFromConversation.Template": removed_from_conversation_template, "RemovedFromConversation.Sound": removed_from_conversation_sound, - "NewMessage.WithMedia.Enabled": new_message_with_media_enabled, + "NewMessage.WithMedia.Enabled": serialize.boolean_to_string( + new_message_with_media_enabled + ), "NewMessage.WithMedia.Template": new_message_with_media_template, } ) @@ -355,18 +363,26 @@ class NotificationContext(InstanceContext): """ data = values.of( { - "LogEnabled": log_enabled, - "NewMessage.Enabled": new_message_enabled, + "LogEnabled": serialize.boolean_to_string(log_enabled), + "NewMessage.Enabled": serialize.boolean_to_string(new_message_enabled), "NewMessage.Template": new_message_template, "NewMessage.Sound": new_message_sound, - "NewMessage.BadgeCountEnabled": new_message_badge_count_enabled, - "AddedToConversation.Enabled": added_to_conversation_enabled, + "NewMessage.BadgeCountEnabled": serialize.boolean_to_string( + new_message_badge_count_enabled + ), + "AddedToConversation.Enabled": serialize.boolean_to_string( + added_to_conversation_enabled + ), "AddedToConversation.Template": added_to_conversation_template, "AddedToConversation.Sound": added_to_conversation_sound, - "RemovedFromConversation.Enabled": removed_from_conversation_enabled, + "RemovedFromConversation.Enabled": serialize.boolean_to_string( + removed_from_conversation_enabled + ), "RemovedFromConversation.Template": removed_from_conversation_template, "RemovedFromConversation.Sound": removed_from_conversation_sound, - "NewMessage.WithMedia.Enabled": new_message_with_media_enabled, + "NewMessage.WithMedia.Enabled": serialize.boolean_to_string( + new_message_with_media_enabled + ), "NewMessage.WithMedia.Template": new_message_with_media_template, } ) diff --git a/twilio/rest/events/v1/sink/__init__.py b/twilio/rest/events/v1/sink/__init__.py index 67688f296d1ba9ef2c1123312777fc5cb93fbf4a..b09b5edec3ad945b79edbf35756ca7210f08397d 100644 --- a/twilio/rest/events/v1/sink/__init__.py +++ b/twilio/rest/events/v1/sink/__init__.py @@ -577,7 +577,7 @@ class SinkList(ListResource): """ data = values.of( { - "InUse": in_use, + "InUse": serialize.boolean_to_string(in_use), "Status": status, "PageToken": page_token, "Page": page_number, @@ -610,7 +610,7 @@ class SinkList(ListResource): """ data = values.of( { - "InUse": in_use, + "InUse": serialize.boolean_to_string(in_use), "Status": status, "PageToken": page_token, "Page": page_number, diff --git a/twilio/rest/flex_api/v1/__init__.py b/twilio/rest/flex_api/v1/__init__.py index 7ee41b75f09a484cf9bd0266f370d89be148da9e..eeb00227e98e42e54df8dfc36762529ac7062c5f 100644 --- a/twilio/rest/flex_api/v1/__init__.py +++ b/twilio/rest/flex_api/v1/__init__.py @@ -22,12 +22,6 @@ from twilio.rest.flex_api.v1.flex_flow import FlexFlowList from twilio.rest.flex_api.v1.insights_assessments_comment import ( InsightsAssessmentsCommentList, ) -from twilio.rest.flex_api.v1.insights_conversational_ai import ( - InsightsConversationalAiList, -) -from twilio.rest.flex_api.v1.insights_conversational_ai_report_insights import ( - InsightsConversationalAiReportInsightsList, -) from twilio.rest.flex_api.v1.insights_conversations import InsightsConversationsList from twilio.rest.flex_api.v1.insights_questionnaires import InsightsQuestionnairesList from twilio.rest.flex_api.v1.insights_questionnaires_category import ( @@ -46,6 +40,14 @@ from twilio.rest.flex_api.v1.insights_settings_comment import ( ) from twilio.rest.flex_api.v1.insights_user_roles import InsightsUserRolesList from twilio.rest.flex_api.v1.interaction import InteractionList +from twilio.rest.flex_api.v1.plugin import PluginList +from twilio.rest.flex_api.v1.plugin_archive import PluginArchiveList +from twilio.rest.flex_api.v1.plugin_configuration import PluginConfigurationList +from twilio.rest.flex_api.v1.plugin_configuration_archive import ( + PluginConfigurationArchiveList, +) +from twilio.rest.flex_api.v1.plugin_release import PluginReleaseList +from twilio.rest.flex_api.v1.plugin_version_archive import PluginVersionArchiveList from twilio.rest.flex_api.v1.provisioning_status import ProvisioningStatusList from twilio.rest.flex_api.v1.web_channel import WebChannelList @@ -66,10 +68,6 @@ class V1(Version): self._insights_assessments_comment: Optional[InsightsAssessmentsCommentList] = ( None ) - self._insights_conversational_ai: Optional[InsightsConversationalAiList] = None - self._insights_conversational_ai_report_insights: Optional[ - InsightsConversationalAiReportInsightsList - ] = None self._insights_conversations: Optional[InsightsConversationsList] = None self._insights_questionnaires: Optional[InsightsQuestionnairesList] = None self._insights_questionnaires_category: Optional[ @@ -86,6 +84,14 @@ class V1(Version): self._insights_settings_comment: Optional[InsightsSettingsCommentList] = None self._insights_user_roles: Optional[InsightsUserRolesList] = None self._interaction: Optional[InteractionList] = None + 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_releases: Optional[PluginReleaseList] = None + self._plugin_version_archive: Optional[PluginVersionArchiveList] = None self._provisioning_status: Optional[ProvisioningStatusList] = None self._web_channel: Optional[WebChannelList] = None @@ -119,22 +125,6 @@ class V1(Version): self._insights_assessments_comment = InsightsAssessmentsCommentList(self) return self._insights_assessments_comment - @property - def insights_conversational_ai(self) -> InsightsConversationalAiList: - if self._insights_conversational_ai is None: - self._insights_conversational_ai = InsightsConversationalAiList(self) - return self._insights_conversational_ai - - @property - def insights_conversational_ai_report_insights( - self, - ) -> InsightsConversationalAiReportInsightsList: - if self._insights_conversational_ai_report_insights is None: - self._insights_conversational_ai_report_insights = ( - InsightsConversationalAiReportInsightsList(self) - ) - return self._insights_conversational_ai_report_insights - @property def insights_conversations(self) -> InsightsConversationsList: if self._insights_conversations is None: @@ -199,6 +189,42 @@ class V1(Version): self._interaction = InteractionList(self) return self._interaction + @property + def plugins(self) -> PluginList: + if self._plugins is None: + self._plugins = PluginList(self) + return self._plugins + + @property + def plugin_archive(self) -> PluginArchiveList: + if self._plugin_archive is None: + self._plugin_archive = PluginArchiveList(self) + return self._plugin_archive + + @property + def plugin_configurations(self) -> PluginConfigurationList: + if self._plugin_configurations is None: + self._plugin_configurations = PluginConfigurationList(self) + return self._plugin_configurations + + @property + def plugin_configuration_archive(self) -> PluginConfigurationArchiveList: + if self._plugin_configuration_archive is None: + self._plugin_configuration_archive = PluginConfigurationArchiveList(self) + return self._plugin_configuration_archive + + @property + def plugin_releases(self) -> PluginReleaseList: + if self._plugin_releases is None: + self._plugin_releases = PluginReleaseList(self) + return self._plugin_releases + + @property + def plugin_version_archive(self) -> PluginVersionArchiveList: + if self._plugin_version_archive is None: + self._plugin_version_archive = PluginVersionArchiveList(self) + return self._plugin_version_archive + @property def provisioning_status(self) -> ProvisioningStatusList: if self._provisioning_status is None: diff --git a/twilio/rest/flex_api/v1/channel.py b/twilio/rest/flex_api/v1/channel.py index a2f1e1af0fc9031fd9e9f303ecf18c156a284cbc..f362d5b01b338fa6bc35317c6996860bf30b73df 100644 --- a/twilio/rest/flex_api/v1/channel.py +++ b/twilio/rest/flex_api/v1/channel.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -280,7 +280,7 @@ class ChannelList(ListResource): "PreEngagementData": pre_engagement_data, "TaskSid": task_sid, "TaskAttributes": task_attributes, - "LongLived": long_lived, + "LongLived": serialize.boolean_to_string(long_lived), } ) @@ -333,7 +333,7 @@ class ChannelList(ListResource): "PreEngagementData": pre_engagement_data, "TaskSid": task_sid, "TaskAttributes": task_attributes, - "LongLived": long_lived, + "LongLived": serialize.boolean_to_string(long_lived), } ) diff --git a/twilio/rest/flex_api/v1/configuration.py b/twilio/rest/flex_api/v1/configuration.py index 511321a58861c22bf2632c0cd224ec1932af1ad8..bec7034cfef621418a2f8ef101114786a4bc4802 100644 --- a/twilio/rest/flex_api/v1/configuration.py +++ b/twilio/rest/flex_api/v1/configuration.py @@ -237,6 +237,34 @@ class ConfigurationInstance(InstanceResource): ui_version=ui_version, ) + def update( + self, body: Union[object, object] = values.unset + ) -> "ConfigurationInstance": + """ + Update the ConfigurationInstance + + :param body: + + :returns: The updated ConfigurationInstance + """ + return self._proxy.update( + body=body, + ) + + async def update_async( + self, body: Union[object, object] = values.unset + ) -> "ConfigurationInstance": + """ + Asynchronous coroutine to update the ConfigurationInstance + + :param body: + + :returns: The updated ConfigurationInstance + """ + return await self._proxy.update_async( + body=body, + ) + def __repr__(self) -> str: """ Provide a friendly representation @@ -309,6 +337,52 @@ class ConfigurationContext(InstanceContext): payload, ) + def update( + self, body: Union[object, object] = values.unset + ) -> ConfigurationInstance: + """ + Update the ConfigurationInstance + + :param body: + + :returns: The updated ConfigurationInstance + """ + data = values.of({}) + headers = values.of( + { + "body": body, + } + ) + + payload = self._version.update( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ConfigurationInstance(self._version, payload) + + async def update_async( + self, body: Union[object, object] = values.unset + ) -> ConfigurationInstance: + """ + Asynchronous coroutine to update the ConfigurationInstance + + :param body: + + :returns: The updated ConfigurationInstance + """ + data = values.of({}) + headers = values.of( + { + "body": body, + } + ) + + payload = await self._version.update_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ConfigurationInstance(self._version, payload) + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/flex_api/v1/flex_flow.py b/twilio/rest/flex_api/v1/flex_flow.py index 57c9a8f430838d5942f6298fffc02ea8dc64a21f..b11482937e3231bdcecc53df5908816663b592e3 100644 --- a/twilio/rest/flex_api/v1/flex_flow.py +++ b/twilio/rest/flex_api/v1/flex_flow.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -408,7 +408,7 @@ class FlexFlowContext(InstanceContext): "ChatServiceSid": chat_service_sid, "ChannelType": channel_type, "ContactIdentity": contact_identity, - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), "IntegrationType": integration_type, "Integration.FlowSid": integration_flow_sid, "Integration.Url": integration_url, @@ -417,9 +417,11 @@ class FlexFlowContext(InstanceContext): "Integration.Channel": integration_channel, "Integration.Timeout": integration_timeout, "Integration.Priority": integration_priority, - "Integration.CreationOnMessage": integration_creation_on_message, - "LongLived": long_lived, - "JanitorEnabled": janitor_enabled, + "Integration.CreationOnMessage": serialize.boolean_to_string( + integration_creation_on_message + ), + "LongLived": serialize.boolean_to_string(long_lived), + "JanitorEnabled": serialize.boolean_to_string(janitor_enabled), "Integration.RetryCount": integration_retry_count, } ) @@ -483,7 +485,7 @@ class FlexFlowContext(InstanceContext): "ChatServiceSid": chat_service_sid, "ChannelType": channel_type, "ContactIdentity": contact_identity, - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), "IntegrationType": integration_type, "Integration.FlowSid": integration_flow_sid, "Integration.Url": integration_url, @@ -492,9 +494,11 @@ class FlexFlowContext(InstanceContext): "Integration.Channel": integration_channel, "Integration.Timeout": integration_timeout, "Integration.Priority": integration_priority, - "Integration.CreationOnMessage": integration_creation_on_message, - "LongLived": long_lived, - "JanitorEnabled": janitor_enabled, + "Integration.CreationOnMessage": serialize.boolean_to_string( + integration_creation_on_message + ), + "LongLived": serialize.boolean_to_string(long_lived), + "JanitorEnabled": serialize.boolean_to_string(janitor_enabled), "Integration.RetryCount": integration_retry_count, } ) @@ -601,7 +605,7 @@ class FlexFlowList(ListResource): "ChatServiceSid": chat_service_sid, "ChannelType": channel_type, "ContactIdentity": contact_identity, - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), "IntegrationType": integration_type, "Integration.FlowSid": integration_flow_sid, "Integration.Url": integration_url, @@ -610,9 +614,11 @@ class FlexFlowList(ListResource): "Integration.Channel": integration_channel, "Integration.Timeout": integration_timeout, "Integration.Priority": integration_priority, - "Integration.CreationOnMessage": integration_creation_on_message, - "LongLived": long_lived, - "JanitorEnabled": janitor_enabled, + "Integration.CreationOnMessage": serialize.boolean_to_string( + integration_creation_on_message + ), + "LongLived": serialize.boolean_to_string(long_lived), + "JanitorEnabled": serialize.boolean_to_string(janitor_enabled), "Integration.RetryCount": integration_retry_count, } ) @@ -677,7 +683,7 @@ class FlexFlowList(ListResource): "ChatServiceSid": chat_service_sid, "ChannelType": channel_type, "ContactIdentity": contact_identity, - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), "IntegrationType": integration_type, "Integration.FlowSid": integration_flow_sid, "Integration.Url": integration_url, @@ -686,9 +692,11 @@ class FlexFlowList(ListResource): "Integration.Channel": integration_channel, "Integration.Timeout": integration_timeout, "Integration.Priority": integration_priority, - "Integration.CreationOnMessage": integration_creation_on_message, - "LongLived": long_lived, - "JanitorEnabled": janitor_enabled, + "Integration.CreationOnMessage": serialize.boolean_to_string( + integration_creation_on_message + ), + "LongLived": serialize.boolean_to_string(long_lived), + "JanitorEnabled": serialize.boolean_to_string(janitor_enabled), "Integration.RetryCount": integration_retry_count, } ) diff --git a/twilio/rest/flex_api/v1/insights_conversational_ai.py b/twilio/rest/flex_api/v1/insights_conversational_ai.py deleted file mode 100644 index 0cce79ad9d70426a0f416691edb33e316d0c1ec7..0000000000000000000000000000000000000000 --- a/twilio/rest/flex_api/v1/insights_conversational_ai.py +++ /dev/null @@ -1,295 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Flex - This is the public Twilio REST API. - - NOTE: This class is auto generated by OpenAPI Generator. - https://openapi-generator.tech - Do not edit the class manually. -""" - -from datetime import datetime -from typing import Any, Dict, List, Optional, Union -from twilio.base import deserialize, serialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version - - -class InsightsConversationalAiInstance(InstanceResource): - - class Granularity(object): - DAYS = "days" - WEEKS = "weeks" - MONTHS = "months" - QUARTERS = "quarters" - YEARS = "years" - - """ - :ivar instance_sid: Sid of Flex Service Instance - :ivar report_id: The type of report required to fetch.Like gauge,channel-metrics,queue-metrics - :ivar granularity: - :ivar period_start: The start date from which report data is included - :ivar period_end: The end date till report data is included - :ivar updated: Updated time of the report - :ivar total_pages: Represents total number of pages fetched report has - :ivar page: Page offset required for pagination - :ivar rows: List of report breakdown - :ivar url: The URL of this resource. - """ - - def __init__( - self, - version: Version, - payload: Dict[str, Any], - instance_sid: Optional[str] = None, - ): - super().__init__(version) - - self.instance_sid: Optional[str] = payload.get("instance_sid") - self.report_id: Optional[str] = payload.get("report_id") - self.granularity: Optional["InsightsConversationalAiInstance.Granularity"] = ( - payload.get("granularity") - ) - self.period_start: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("period_start") - ) - self.period_end: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("period_end") - ) - self.updated: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("updated") - ) - self.total_pages: Optional[int] = deserialize.integer( - payload.get("total_pages") - ) - self.page: Optional[int] = deserialize.integer(payload.get("page")) - self.rows: Optional[List[Dict[str, object]]] = payload.get("rows") - self.url: Optional[str] = payload.get("url") - - self._solution = { - "instance_sid": instance_sid or self.instance_sid, - } - self._context: Optional[InsightsConversationalAiContext] = None - - @property - def _proxy(self) -> "InsightsConversationalAiContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: InsightsConversationalAiContext for this InsightsConversationalAiInstance - """ - if self._context is None: - self._context = InsightsConversationalAiContext( - self._version, - instance_sid=self._solution["instance_sid"], - ) - return self._context - - def fetch( - self, - max_rows: Union[int, object] = values.unset, - report_id: Union[str, object] = values.unset, - granularity: Union[ - "InsightsConversationalAiInstance.Granularity", object - ] = values.unset, - include_date: Union[datetime, object] = values.unset, - ) -> "InsightsConversationalAiInstance": - """ - Fetch the InsightsConversationalAiInstance - - :param max_rows: Maximum number of rows to return - :param report_id: The type of report required to fetch.Like gauge,channel-metrics,queue-metrics - :param granularity: The time period for which report is needed - :param include_date: A reference date that should be included in the returned period - - :returns: The fetched InsightsConversationalAiInstance - """ - return self._proxy.fetch( - max_rows=max_rows, - report_id=report_id, - granularity=granularity, - include_date=include_date, - ) - - async def fetch_async( - self, - max_rows: Union[int, object] = values.unset, - report_id: Union[str, object] = values.unset, - granularity: Union[ - "InsightsConversationalAiInstance.Granularity", object - ] = values.unset, - include_date: Union[datetime, object] = values.unset, - ) -> "InsightsConversationalAiInstance": - """ - Asynchronous coroutine to fetch the InsightsConversationalAiInstance - - :param max_rows: Maximum number of rows to return - :param report_id: The type of report required to fetch.Like gauge,channel-metrics,queue-metrics - :param granularity: The time period for which report is needed - :param include_date: A reference date that should be included in the returned period - - :returns: The fetched InsightsConversationalAiInstance - """ - return await self._proxy.fetch_async( - max_rows=max_rows, - report_id=report_id, - granularity=granularity, - include_date=include_date, - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) - return "<Twilio.FlexApi.V1.InsightsConversationalAiInstance {}>".format(context) - - -class InsightsConversationalAiContext(InstanceContext): - - def __init__(self, version: Version, instance_sid: str): - """ - Initialize the InsightsConversationalAiContext - - :param version: Version that contains the resource - :param instance_sid: Sid of Flex Service Instance - """ - super().__init__(version) - - # Path Solution - self._solution = { - "instance_sid": instance_sid, - } - self._uri = "/Insights/Instances/{instance_sid}/AI/Reports".format( - **self._solution - ) - - def fetch( - self, - max_rows: Union[int, object] = values.unset, - report_id: Union[str, object] = values.unset, - granularity: Union[ - "InsightsConversationalAiInstance.Granularity", object - ] = values.unset, - include_date: Union[datetime, object] = values.unset, - ) -> InsightsConversationalAiInstance: - """ - Fetch the InsightsConversationalAiInstance - - :param max_rows: Maximum number of rows to return - :param report_id: The type of report required to fetch.Like gauge,channel-metrics,queue-metrics - :param granularity: The time period for which report is needed - :param include_date: A reference date that should be included in the returned period - - :returns: The fetched InsightsConversationalAiInstance - """ - - data = values.of( - { - "MaxRows": max_rows, - "ReportId": report_id, - "Granularity": granularity, - "IncludeDate": serialize.iso8601_datetime(include_date), - } - ) - - payload = self._version.fetch(method="GET", uri=self._uri, params=data) - - return InsightsConversationalAiInstance( - self._version, - payload, - instance_sid=self._solution["instance_sid"], - ) - - async def fetch_async( - self, - max_rows: Union[int, object] = values.unset, - report_id: Union[str, object] = values.unset, - granularity: Union[ - "InsightsConversationalAiInstance.Granularity", object - ] = values.unset, - include_date: Union[datetime, object] = values.unset, - ) -> InsightsConversationalAiInstance: - """ - Asynchronous coroutine to fetch the InsightsConversationalAiInstance - - :param max_rows: Maximum number of rows to return - :param report_id: The type of report required to fetch.Like gauge,channel-metrics,queue-metrics - :param granularity: The time period for which report is needed - :param include_date: A reference date that should be included in the returned period - - :returns: The fetched InsightsConversationalAiInstance - """ - - data = values.of( - { - "MaxRows": max_rows, - "ReportId": report_id, - "Granularity": granularity, - "IncludeDate": serialize.iso8601_datetime(include_date), - } - ) - - payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data - ) - - return InsightsConversationalAiInstance( - self._version, - payload, - instance_sid=self._solution["instance_sid"], - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) - return "<Twilio.FlexApi.V1.InsightsConversationalAiContext {}>".format(context) - - -class InsightsConversationalAiList(ListResource): - - def __init__(self, version: Version): - """ - Initialize the InsightsConversationalAiList - - :param version: Version that contains the resource - - """ - super().__init__(version) - - def get(self, instance_sid: str) -> InsightsConversationalAiContext: - """ - Constructs a InsightsConversationalAiContext - - :param instance_sid: Sid of Flex Service Instance - """ - return InsightsConversationalAiContext(self._version, instance_sid=instance_sid) - - def __call__(self, instance_sid: str) -> InsightsConversationalAiContext: - """ - Constructs a InsightsConversationalAiContext - - :param instance_sid: Sid of Flex Service Instance - """ - return InsightsConversationalAiContext(self._version, instance_sid=instance_sid) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "<Twilio.FlexApi.V1.InsightsConversationalAiList>" diff --git a/twilio/rest/flex_api/v1/insights_conversational_ai_report_insights.py b/twilio/rest/flex_api/v1/insights_conversational_ai_report_insights.py deleted file mode 100644 index 59ac5a04bfb2011f690673eaa7ceeab11919e2da..0000000000000000000000000000000000000000 --- a/twilio/rest/flex_api/v1/insights_conversational_ai_report_insights.py +++ /dev/null @@ -1,279 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Flex - This is the public Twilio REST API. - - NOTE: This class is auto generated by OpenAPI Generator. - https://openapi-generator.tech - Do not edit the class manually. -""" - -from datetime import datetime -from typing import Any, Dict, List, Optional, Union -from twilio.base import deserialize, serialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version - - -class InsightsConversationalAiReportInsightsInstance(InstanceResource): - """ - :ivar instance_sid: The Instance SID of the instance for which report insights is fetched - :ivar report_id: The type of report insights required to fetch.Like gauge,channel-metrics,queue-metrics - :ivar period_start: The start date from which report insights data is included - :ivar period_end: The end date till report insights data is included - :ivar updated: Updated time of the report insights - :ivar insights: List of report insights breakdown - :ivar url: The URL of this resource - """ - - def __init__( - self, - version: Version, - payload: Dict[str, Any], - instance_sid: Optional[str] = None, - ): - super().__init__(version) - - self.instance_sid: Optional[str] = payload.get("instance_sid") - self.report_id: Optional[str] = payload.get("report_id") - self.period_start: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("period_start") - ) - self.period_end: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("period_end") - ) - self.updated: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("updated") - ) - self.insights: Optional[List[Dict[str, object]]] = payload.get("insights") - self.url: Optional[str] = payload.get("url") - - self._solution = { - "instance_sid": instance_sid or self.instance_sid, - } - self._context: Optional[InsightsConversationalAiReportInsightsContext] = None - - @property - def _proxy(self) -> "InsightsConversationalAiReportInsightsContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: InsightsConversationalAiReportInsightsContext for this InsightsConversationalAiReportInsightsInstance - """ - if self._context is None: - self._context = InsightsConversationalAiReportInsightsContext( - self._version, - instance_sid=self._solution["instance_sid"], - ) - return self._context - - def fetch( - self, - max_rows: Union[int, object] = values.unset, - report_id: Union[str, object] = values.unset, - granularity: Union[str, object] = values.unset, - include_date: Union[datetime, object] = values.unset, - ) -> "InsightsConversationalAiReportInsightsInstance": - """ - Fetch the InsightsConversationalAiReportInsightsInstance - - :param max_rows: Maximum number of rows to return - :param report_id: The type of report insights required to fetch.Like gauge,channel-metrics,queue-metrics - :param granularity: The time period for which report insights is needed - :param include_date: A reference date that should be included in the returned period - - :returns: The fetched InsightsConversationalAiReportInsightsInstance - """ - return self._proxy.fetch( - max_rows=max_rows, - report_id=report_id, - granularity=granularity, - include_date=include_date, - ) - - async def fetch_async( - self, - max_rows: Union[int, object] = values.unset, - report_id: Union[str, object] = values.unset, - granularity: Union[str, object] = values.unset, - include_date: Union[datetime, object] = values.unset, - ) -> "InsightsConversationalAiReportInsightsInstance": - """ - Asynchronous coroutine to fetch the InsightsConversationalAiReportInsightsInstance - - :param max_rows: Maximum number of rows to return - :param report_id: The type of report insights required to fetch.Like gauge,channel-metrics,queue-metrics - :param granularity: The time period for which report insights is needed - :param include_date: A reference date that should be included in the returned period - - :returns: The fetched InsightsConversationalAiReportInsightsInstance - """ - return await self._proxy.fetch_async( - max_rows=max_rows, - report_id=report_id, - granularity=granularity, - include_date=include_date, - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) - return "<Twilio.FlexApi.V1.InsightsConversationalAiReportInsightsInstance {}>".format( - context - ) - - -class InsightsConversationalAiReportInsightsContext(InstanceContext): - - def __init__(self, version: Version, instance_sid: str): - """ - Initialize the InsightsConversationalAiReportInsightsContext - - :param version: Version that contains the resource - :param instance_sid: The Instance SID of the instance for which report insights will be fetched - """ - super().__init__(version) - - # Path Solution - self._solution = { - "instance_sid": instance_sid, - } - self._uri = "/Insights/Instances/{instance_sid}/AI/ReportInsights".format( - **self._solution - ) - - def fetch( - self, - max_rows: Union[int, object] = values.unset, - report_id: Union[str, object] = values.unset, - granularity: Union[str, object] = values.unset, - include_date: Union[datetime, object] = values.unset, - ) -> InsightsConversationalAiReportInsightsInstance: - """ - Fetch the InsightsConversationalAiReportInsightsInstance - - :param max_rows: Maximum number of rows to return - :param report_id: The type of report insights required to fetch.Like gauge,channel-metrics,queue-metrics - :param granularity: The time period for which report insights is needed - :param include_date: A reference date that should be included in the returned period - - :returns: The fetched InsightsConversationalAiReportInsightsInstance - """ - - data = values.of( - { - "MaxRows": max_rows, - "ReportId": report_id, - "Granularity": granularity, - "IncludeDate": serialize.iso8601_datetime(include_date), - } - ) - - payload = self._version.fetch(method="GET", uri=self._uri, params=data) - - return InsightsConversationalAiReportInsightsInstance( - self._version, - payload, - instance_sid=self._solution["instance_sid"], - ) - - async def fetch_async( - self, - max_rows: Union[int, object] = values.unset, - report_id: Union[str, object] = values.unset, - granularity: Union[str, object] = values.unset, - include_date: Union[datetime, object] = values.unset, - ) -> InsightsConversationalAiReportInsightsInstance: - """ - Asynchronous coroutine to fetch the InsightsConversationalAiReportInsightsInstance - - :param max_rows: Maximum number of rows to return - :param report_id: The type of report insights required to fetch.Like gauge,channel-metrics,queue-metrics - :param granularity: The time period for which report insights is needed - :param include_date: A reference date that should be included in the returned period - - :returns: The fetched InsightsConversationalAiReportInsightsInstance - """ - - data = values.of( - { - "MaxRows": max_rows, - "ReportId": report_id, - "Granularity": granularity, - "IncludeDate": serialize.iso8601_datetime(include_date), - } - ) - - payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data - ) - - return InsightsConversationalAiReportInsightsInstance( - self._version, - payload, - instance_sid=self._solution["instance_sid"], - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) - return "<Twilio.FlexApi.V1.InsightsConversationalAiReportInsightsContext {}>".format( - context - ) - - -class InsightsConversationalAiReportInsightsList(ListResource): - - def __init__(self, version: Version): - """ - Initialize the InsightsConversationalAiReportInsightsList - - :param version: Version that contains the resource - - """ - super().__init__(version) - - def get(self, instance_sid: str) -> InsightsConversationalAiReportInsightsContext: - """ - Constructs a InsightsConversationalAiReportInsightsContext - - :param instance_sid: The Instance SID of the instance for which report insights will be fetched - """ - return InsightsConversationalAiReportInsightsContext( - self._version, instance_sid=instance_sid - ) - - def __call__( - self, instance_sid: str - ) -> InsightsConversationalAiReportInsightsContext: - """ - Constructs a InsightsConversationalAiReportInsightsContext - - :param instance_sid: The Instance SID of the instance for which report insights will be fetched - """ - return InsightsConversationalAiReportInsightsContext( - self._version, instance_sid=instance_sid - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "<Twilio.FlexApi.V1.InsightsConversationalAiReportInsightsList>" diff --git a/twilio/rest/flex_api/v1/insights_questionnaires.py b/twilio/rest/flex_api/v1/insights_questionnaires.py index fe0338a9fe30105764757c648877ebd87bf5b206..807f12995510046d970cb3c56a0804309d37119a 100644 --- a/twilio/rest/flex_api/v1/insights_questionnaires.py +++ b/twilio/rest/flex_api/v1/insights_questionnaires.py @@ -316,7 +316,7 @@ class InsightsQuestionnairesContext(InstanceContext): """ data = values.of( { - "Active": active, + "Active": serialize.boolean_to_string(active), "Name": name, "Description": description, "QuestionSids": serialize.map(question_sids, lambda e: e), @@ -359,7 +359,7 @@ class InsightsQuestionnairesContext(InstanceContext): """ data = values.of( { - "Active": active, + "Active": serialize.boolean_to_string(active), "Name": name, "Description": description, "QuestionSids": serialize.map(question_sids, lambda e: e), @@ -447,7 +447,7 @@ class InsightsQuestionnairesList(ListResource): { "Name": name, "Description": description, - "Active": active, + "Active": serialize.boolean_to_string(active), "QuestionSids": serialize.map(question_sids, lambda e: e), } ) @@ -487,7 +487,7 @@ class InsightsQuestionnairesList(ListResource): { "Name": name, "Description": description, - "Active": active, + "Active": serialize.boolean_to_string(active), "QuestionSids": serialize.map(question_sids, lambda e: e), } ) @@ -657,7 +657,7 @@ class InsightsQuestionnairesList(ListResource): data = values.of( { "Authorization": authorization, - "IncludeInactive": include_inactive, + "IncludeInactive": serialize.boolean_to_string(include_inactive), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -690,7 +690,7 @@ class InsightsQuestionnairesList(ListResource): data = values.of( { "Authorization": authorization, - "IncludeInactive": include_inactive, + "IncludeInactive": serialize.boolean_to_string(include_inactive), "PageToken": page_token, "Page": page_number, "PageSize": page_size, diff --git a/twilio/rest/flex_api/v1/insights_questionnaires_question.py b/twilio/rest/flex_api/v1/insights_questionnaires_question.py index b796ff6afd29699a58924b2ff8b448d477aa1e88..e4f2f4a4f06af8b89cf66a652634097893ebe214 100644 --- a/twilio/rest/flex_api/v1/insights_questionnaires_question.py +++ b/twilio/rest/flex_api/v1/insights_questionnaires_question.py @@ -250,7 +250,7 @@ class InsightsQuestionnairesQuestionContext(InstanceContext): """ data = values.of( { - "AllowNa": allow_na, + "AllowNa": serialize.boolean_to_string(allow_na), "CategorySid": category_sid, "Question": question, "Description": description, @@ -294,7 +294,7 @@ class InsightsQuestionnairesQuestionContext(InstanceContext): """ data = values.of( { - "AllowNa": allow_na, + "AllowNa": serialize.boolean_to_string(allow_na), "CategorySid": category_sid, "Question": question, "Description": description, @@ -388,7 +388,7 @@ class InsightsQuestionnairesQuestionList(ListResource): "CategorySid": category_sid, "Question": question, "AnswerSetId": answer_set_id, - "AllowNa": allow_na, + "AllowNa": serialize.boolean_to_string(allow_na), "Description": description, } ) @@ -431,7 +431,7 @@ class InsightsQuestionnairesQuestionList(ListResource): "CategorySid": category_sid, "Question": question, "AnswerSetId": answer_set_id, - "AllowNa": allow_na, + "AllowNa": serialize.boolean_to_string(allow_na), "Description": description, } ) 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 649439ba2bcc45fe8909c5668600828fb271e20f..ba9f80f9a33990194feabd0ac4ec7d782f2a45a2 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 @@ -40,6 +40,7 @@ class InteractionChannelParticipantInstance(InstanceResource): :ivar interaction_sid: The Interaction Sid for this channel. :ivar channel_sid: The Channel Sid for this Participant. :ivar url: + :ivar routing_properties: The Participant's routing properties. """ def __init__( @@ -59,6 +60,9 @@ class InteractionChannelParticipantInstance(InstanceResource): self.interaction_sid: Optional[str] = payload.get("interaction_sid") self.channel_sid: Optional[str] = payload.get("channel_sid") self.url: Optional[str] = payload.get("url") + self.routing_properties: Optional[Dict[str, object]] = payload.get( + "routing_properties" + ) self._solution = { "interaction_sid": interaction_sid, @@ -273,12 +277,14 @@ class InteractionChannelParticipantList(ListResource): self, type: "InteractionChannelParticipantInstance.Type", media_properties: object, + routing_properties: Union[object, object] = values.unset, ) -> InteractionChannelParticipantInstance: """ Create the InteractionChannelParticipantInstance :param type: :param media_properties: JSON representing the Media Properties for the new Participant. + :param routing_properties: Object representing the Routing Properties for the new Participant. :returns: The created InteractionChannelParticipantInstance """ @@ -287,6 +293,7 @@ class InteractionChannelParticipantList(ListResource): { "Type": type, "MediaProperties": serialize.object(media_properties), + "RoutingProperties": serialize.object(routing_properties), } ) @@ -307,12 +314,14 @@ class InteractionChannelParticipantList(ListResource): self, type: "InteractionChannelParticipantInstance.Type", media_properties: object, + routing_properties: Union[object, object] = values.unset, ) -> InteractionChannelParticipantInstance: """ Asynchronously create the InteractionChannelParticipantInstance :param type: :param media_properties: JSON representing the Media Properties for the new Participant. + :param routing_properties: Object representing the Routing Properties for the new Participant. :returns: The created InteractionChannelParticipantInstance """ @@ -321,6 +330,7 @@ class InteractionChannelParticipantList(ListResource): { "Type": type, "MediaProperties": serialize.object(media_properties), + "RoutingProperties": serialize.object(routing_properties), } ) diff --git a/twilio/rest/flex_api/v1/plugin/__init__.py b/twilio/rest/flex_api/v1/plugin/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..09244d42deb38f6e8e19d1de615e6d0e7c4617d5 --- /dev/null +++ b/twilio/rest/flex_api/v1/plugin/__init__.py @@ -0,0 +1,653 @@ +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.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.flex_api.v1.plugin.plugin_versions import PluginVersionsList + + +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. + :ivar unique_name: The name that uniquely identifies this Flex Plugin resource. + :ivar friendly_name: The friendly name this Flex Plugin resource. + :ivar description: A descriptive string that you create to describe the plugin resource. It can be up to 500 characters long + :ivar archived: Whether the Flex Plugin is archived. The default value is false. + :ivar date_created: The date and time in GMT-7 when the Flex Plugin was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT-7 when the Flex Plugin was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the Flex Plugin resource. + :ivar links: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.description: Optional[str] = payload.get("description") + self.archived: Optional[bool] = payload.get("archived") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") + + self._solution = { + "sid": sid or self.sid, + } + self._context: Optional[PluginContext] = None + + @property + def _proxy(self) -> "PluginContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: PluginContext for this PluginInstance + """ + if self._context is None: + self._context = PluginContext( + self._version, + sid=self._solution["sid"], + ) + return self._context + + def fetch( + self, flex_metadata: Union[str, object] = values.unset + ) -> "PluginInstance": + """ + Fetch the PluginInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The fetched PluginInstance + """ + return self._proxy.fetch( + flex_metadata=flex_metadata, + ) + + async def fetch_async( + self, flex_metadata: Union[str, object] = values.unset + ) -> "PluginInstance": + """ + Asynchronous coroutine to fetch the PluginInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The fetched PluginInstance + """ + return await self._proxy.fetch_async( + flex_metadata=flex_metadata, + ) + + def update( + self, + flex_metadata: Union[str, object] = values.unset, + friendly_name: Union[str, object] = values.unset, + description: Union[str, object] = values.unset, + ) -> "PluginInstance": + """ + Update the PluginInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + :param friendly_name: The Flex Plugin's friendly name. + :param description: A descriptive string that you update to describe the plugin resource. It can be up to 500 characters long + + :returns: The updated PluginInstance + """ + return self._proxy.update( + flex_metadata=flex_metadata, + friendly_name=friendly_name, + description=description, + ) + + async def update_async( + self, + flex_metadata: Union[str, object] = values.unset, + friendly_name: Union[str, object] = values.unset, + description: Union[str, object] = values.unset, + ) -> "PluginInstance": + """ + Asynchronous coroutine to update the PluginInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + :param friendly_name: The Flex Plugin's friendly name. + :param description: A descriptive string that you update to describe the plugin resource. It can be up to 500 characters long + + :returns: The updated PluginInstance + """ + return await self._proxy.update_async( + flex_metadata=flex_metadata, + friendly_name=friendly_name, + description=description, + ) + + @property + def plugin_versions(self) -> PluginVersionsList: + """ + Access the plugin_versions + """ + return self._proxy.plugin_versions + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "<Twilio.FlexApi.V1.PluginInstance {}>".format(context) + + +class PluginContext(InstanceContext): + + def __init__(self, version: Version, sid: str): + """ + Initialize the PluginContext + + :param version: Version that contains the resource + :param sid: The SID of the Flex Plugin resource to update. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "sid": sid, + } + self._uri = "/PluginService/Plugins/{sid}".format(**self._solution) + + self._plugin_versions: Optional[PluginVersionsList] = None + + def fetch(self, flex_metadata: Union[str, object] = values.unset) -> PluginInstance: + """ + Fetch the PluginInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The fetched PluginInstance + """ + + data = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = self._version.fetch(method="GET", uri=self._uri, params=data) + + return PluginInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + async def fetch_async( + self, flex_metadata: Union[str, object] = values.unset + ) -> PluginInstance: + """ + Asynchronous coroutine to fetch the PluginInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The fetched PluginInstance + """ + + data = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = await self._version.fetch_async( + method="GET", uri=self._uri, params=data + ) + + return PluginInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + def update( + self, + flex_metadata: Union[str, object] = values.unset, + friendly_name: Union[str, object] = values.unset, + description: Union[str, object] = values.unset, + ) -> PluginInstance: + """ + Update the PluginInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + :param friendly_name: The Flex Plugin's friendly name. + :param description: A descriptive string that you update to describe the plugin resource. It can be up to 500 characters long + + :returns: The updated PluginInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "Description": description, + } + ) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = self._version.update( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return PluginInstance(self._version, payload, sid=self._solution["sid"]) + + async def update_async( + self, + flex_metadata: Union[str, object] = values.unset, + friendly_name: Union[str, object] = values.unset, + description: Union[str, object] = values.unset, + ) -> PluginInstance: + """ + Asynchronous coroutine to update the PluginInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + :param friendly_name: The Flex Plugin's friendly name. + :param description: A descriptive string that you update to describe the plugin resource. It can be up to 500 characters long + + :returns: The updated PluginInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "Description": description, + } + ) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = await self._version.update_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return PluginInstance(self._version, payload, sid=self._solution["sid"]) + + @property + def plugin_versions(self) -> PluginVersionsList: + """ + Access the plugin_versions + """ + if self._plugin_versions is None: + self._plugin_versions = PluginVersionsList( + self._version, + self._solution["sid"], + ) + return self._plugin_versions + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "<Twilio.FlexApi.V1.PluginContext {}>".format(context) + + +class PluginPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> PluginInstance: + """ + Build an instance of PluginInstance + + :param payload: Payload response from the API + """ + return PluginInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "<Twilio.FlexApi.V1.PluginPage>" + + +class PluginList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the PluginList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/PluginService/Plugins" + + def create( + self, + unique_name: str, + flex_metadata: Union[str, object] = values.unset, + friendly_name: Union[str, object] = values.unset, + description: Union[str, object] = values.unset, + ) -> PluginInstance: + """ + Create the PluginInstance + + :param unique_name: The Flex Plugin's unique name. + :param flex_metadata: The Flex-Metadata HTTP request header + :param friendly_name: The Flex Plugin's friendly name. + :param description: A descriptive string that you create to describe the plugin resource. It can be up to 500 characters long + + :returns: The created PluginInstance + """ + + data = values.of( + { + "UniqueName": unique_name, + "FriendlyName": friendly_name, + "Description": description, + } + ) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return PluginInstance(self._version, payload) + + async def create_async( + self, + unique_name: str, + flex_metadata: Union[str, object] = values.unset, + friendly_name: Union[str, object] = values.unset, + description: Union[str, object] = values.unset, + ) -> PluginInstance: + """ + Asynchronously create the PluginInstance + + :param unique_name: The Flex Plugin's unique name. + :param flex_metadata: The Flex-Metadata HTTP request header + :param friendly_name: The Flex Plugin's friendly name. + :param description: A descriptive string that you create to describe the plugin resource. It can be up to 500 characters long + + :returns: The created PluginInstance + """ + + data = values.of( + { + "UniqueName": unique_name, + "FriendlyName": friendly_name, + "Description": description, + } + ) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return PluginInstance(self._version, payload) + + def stream( + self, + flex_metadata: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[PluginInstance]: + """ + Streams PluginInstance 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 flex_metadata: The Flex-Metadata 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 + the default value of 50 records. If no page_size is defined + 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(flex_metadata=flex_metadata, page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + flex_metadata: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[PluginInstance]: + """ + Asynchronously streams PluginInstance 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 flex_metadata: The Flex-Metadata 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 + the default value of 50 records. If no page_size is defined + 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( + flex_metadata=flex_metadata, page_size=limits["page_size"] + ) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + flex_metadata: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[PluginInstance]: + """ + Lists PluginInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str flex_metadata: The Flex-Metadata 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 + the default value of 50 records. If no page_size is defined + 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( + flex_metadata=flex_metadata, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + flex_metadata: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[PluginInstance]: + """ + Asynchronously lists PluginInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str flex_metadata: The Flex-Metadata 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 + the default value of 50 records. If no page_size is defined + 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( + flex_metadata=flex_metadata, + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + flex_metadata: 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, + ) -> PluginPage: + """ + Retrieve a single page of PluginInstance records from the API. + Request is executed immediately + + :param flex_metadata: The Flex-Metadata 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 + + :returns: Page of PluginInstance + """ + data = values.of( + { + "Flex-Metadata": flex_metadata, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return PluginPage(self._version, response) + + async def page_async( + self, + flex_metadata: 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, + ) -> PluginPage: + """ + Asynchronously retrieve a single page of PluginInstance records from the API. + Request is executed immediately + + :param flex_metadata: The Flex-Metadata 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 + + :returns: Page of PluginInstance + """ + data = values.of( + { + "Flex-Metadata": flex_metadata, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return PluginPage(self._version, response) + + def get_page(self, target_url: str) -> PluginPage: + """ + Retrieve a specific page of PluginInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of PluginInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return PluginPage(self._version, response) + + async def get_page_async(self, target_url: str) -> PluginPage: + """ + Asynchronously retrieve a specific page of PluginInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of PluginInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return PluginPage(self._version, response) + + def get(self, sid: str) -> PluginContext: + """ + Constructs a PluginContext + + :param sid: The SID of the Flex Plugin resource to update. + """ + return PluginContext(self._version, sid=sid) + + def __call__(self, sid: str) -> PluginContext: + """ + Constructs a PluginContext + + :param sid: The SID of the Flex Plugin resource to update. + """ + return PluginContext(self._version, sid=sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "<Twilio.FlexApi.V1.PluginList>" diff --git a/twilio/rest/flex_api/v1/plugin/plugin_versions.py b/twilio/rest/flex_api/v1/plugin/plugin_versions.py new file mode 100644 index 0000000000000000000000000000000000000000..6f492dbad689a0e8f781c1b738f458ffab288f0c --- /dev/null +++ b/twilio/rest/flex_api/v1/plugin/plugin_versions.py @@ -0,0 +1,558 @@ +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, serialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page + + +class 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. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Plugin Version resource and owns this resource. + :ivar version: The unique version of this Flex Plugin Version. + :ivar plugin_url: The URL of where the Flex Plugin Version JavaScript bundle is hosted on. + :ivar changelog: A changelog that describes the changes this Flex Plugin Version brings. + :ivar private: Whether to inject credentials while accessing this Plugin Version. The default value is false. + :ivar archived: Whether the Flex Plugin Version is archived. The default value is false. + :ivar date_created: The date and time in GMT when the Flex Plugin Version was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the Flex Plugin Version resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + plugin_sid: str, + sid: Optional[str] = None, + ): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.plugin_sid: Optional[str] = payload.get("plugin_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.version: Optional[str] = payload.get("version") + self.plugin_url: Optional[str] = payload.get("plugin_url") + self.changelog: Optional[str] = payload.get("changelog") + self.private: Optional[bool] = payload.get("private") + self.archived: Optional[bool] = payload.get("archived") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.url: Optional[str] = payload.get("url") + + self._solution = { + "plugin_sid": plugin_sid, + "sid": sid or self.sid, + } + self._context: Optional[PluginVersionsContext] = None + + @property + def _proxy(self) -> "PluginVersionsContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: PluginVersionsContext for this PluginVersionsInstance + """ + if self._context is None: + self._context = PluginVersionsContext( + self._version, + plugin_sid=self._solution["plugin_sid"], + sid=self._solution["sid"], + ) + return self._context + + def fetch( + self, flex_metadata: Union[str, object] = values.unset + ) -> "PluginVersionsInstance": + """ + Fetch the PluginVersionsInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The fetched PluginVersionsInstance + """ + return self._proxy.fetch( + flex_metadata=flex_metadata, + ) + + async def fetch_async( + self, flex_metadata: Union[str, object] = values.unset + ) -> "PluginVersionsInstance": + """ + Asynchronous coroutine to fetch the PluginVersionsInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The fetched PluginVersionsInstance + """ + return await self._proxy.fetch_async( + flex_metadata=flex_metadata, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "<Twilio.FlexApi.V1.PluginVersionsInstance {}>".format(context) + + +class PluginVersionsContext(InstanceContext): + + def __init__(self, version: Version, plugin_sid: str, sid: str): + """ + Initialize the PluginVersionsContext + + :param version: Version that contains the resource + :param plugin_sid: The SID of the Flex Plugin the resource to belongs to. + :param sid: The SID of the Flex Plugin Version resource to fetch. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "plugin_sid": plugin_sid, + "sid": sid, + } + self._uri = "/PluginService/Plugins/{plugin_sid}/Versions/{sid}".format( + **self._solution + ) + + def fetch( + self, flex_metadata: Union[str, object] = values.unset + ) -> PluginVersionsInstance: + """ + Fetch the PluginVersionsInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The fetched PluginVersionsInstance + """ + + data = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = self._version.fetch(method="GET", uri=self._uri, params=data) + + return PluginVersionsInstance( + self._version, + payload, + plugin_sid=self._solution["plugin_sid"], + sid=self._solution["sid"], + ) + + async def fetch_async( + self, flex_metadata: Union[str, object] = values.unset + ) -> PluginVersionsInstance: + """ + Asynchronous coroutine to fetch the PluginVersionsInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The fetched PluginVersionsInstance + """ + + data = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = await self._version.fetch_async( + method="GET", uri=self._uri, params=data + ) + + return PluginVersionsInstance( + self._version, + payload, + plugin_sid=self._solution["plugin_sid"], + sid=self._solution["sid"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "<Twilio.FlexApi.V1.PluginVersionsContext {}>".format(context) + + +class PluginVersionsPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> PluginVersionsInstance: + """ + Build an instance of PluginVersionsInstance + + :param payload: Payload response from the API + """ + return PluginVersionsInstance( + self._version, payload, plugin_sid=self._solution["plugin_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "<Twilio.FlexApi.V1.PluginVersionsPage>" + + +class PluginVersionsList(ListResource): + + def __init__(self, version: Version, plugin_sid: str): + """ + Initialize the PluginVersionsList + + :param version: Version that contains the resource + :param plugin_sid: The SID of the Flex Plugin the resource to belongs to. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "plugin_sid": plugin_sid, + } + self._uri = "/PluginService/Plugins/{plugin_sid}/Versions".format( + **self._solution + ) + + def create( + self, + version: str, + plugin_url: str, + flex_metadata: Union[str, object] = values.unset, + changelog: Union[str, object] = values.unset, + private: Union[bool, object] = values.unset, + ) -> PluginVersionsInstance: + """ + Create the PluginVersionsInstance + + :param version: The Flex Plugin Version's version. + :param plugin_url: The URL of the Flex Plugin Version bundle + :param flex_metadata: The Flex-Metadata HTTP request header + :param changelog: The changelog of the Flex Plugin Version. + :param private: Whether this Flex Plugin Version requires authorization. + + :returns: The created PluginVersionsInstance + """ + + data = values.of( + { + "Version": version, + "PluginUrl": plugin_url, + "Changelog": changelog, + "Private": serialize.boolean_to_string(private), + } + ) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return PluginVersionsInstance( + self._version, payload, plugin_sid=self._solution["plugin_sid"] + ) + + async def create_async( + self, + version: str, + plugin_url: str, + flex_metadata: Union[str, object] = values.unset, + changelog: Union[str, object] = values.unset, + private: Union[bool, object] = values.unset, + ) -> PluginVersionsInstance: + """ + Asynchronously create the PluginVersionsInstance + + :param version: The Flex Plugin Version's version. + :param plugin_url: The URL of the Flex Plugin Version bundle + :param flex_metadata: The Flex-Metadata HTTP request header + :param changelog: The changelog of the Flex Plugin Version. + :param private: Whether this Flex Plugin Version requires authorization. + + :returns: The created PluginVersionsInstance + """ + + data = values.of( + { + "Version": version, + "PluginUrl": plugin_url, + "Changelog": changelog, + "Private": serialize.boolean_to_string(private), + } + ) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return PluginVersionsInstance( + self._version, payload, plugin_sid=self._solution["plugin_sid"] + ) + + def stream( + self, + flex_metadata: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[PluginVersionsInstance]: + """ + Streams PluginVersionsInstance 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 flex_metadata: The Flex-Metadata 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 + the default value of 50 records. If no page_size is defined + 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(flex_metadata=flex_metadata, page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + flex_metadata: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[PluginVersionsInstance]: + """ + Asynchronously streams PluginVersionsInstance 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 flex_metadata: The Flex-Metadata 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 + the default value of 50 records. If no page_size is defined + 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( + flex_metadata=flex_metadata, page_size=limits["page_size"] + ) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + flex_metadata: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[PluginVersionsInstance]: + """ + Lists PluginVersionsInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str flex_metadata: The Flex-Metadata 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 + the default value of 50 records. If no page_size is defined + 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( + flex_metadata=flex_metadata, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + flex_metadata: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[PluginVersionsInstance]: + """ + Asynchronously lists PluginVersionsInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str flex_metadata: The Flex-Metadata 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 + the default value of 50 records. If no page_size is defined + 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( + flex_metadata=flex_metadata, + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + flex_metadata: 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, + ) -> PluginVersionsPage: + """ + Retrieve a single page of PluginVersionsInstance records from the API. + Request is executed immediately + + :param flex_metadata: The Flex-Metadata 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 + + :returns: Page of PluginVersionsInstance + """ + data = values.of( + { + "Flex-Metadata": flex_metadata, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return PluginVersionsPage(self._version, response, self._solution) + + async def page_async( + self, + flex_metadata: 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, + ) -> PluginVersionsPage: + """ + Asynchronously retrieve a single page of PluginVersionsInstance records from the API. + Request is executed immediately + + :param flex_metadata: The Flex-Metadata 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 + + :returns: Page of PluginVersionsInstance + """ + data = values.of( + { + "Flex-Metadata": flex_metadata, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return PluginVersionsPage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> PluginVersionsPage: + """ + Retrieve a specific page of PluginVersionsInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of PluginVersionsInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return PluginVersionsPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> PluginVersionsPage: + """ + Asynchronously retrieve a specific page of PluginVersionsInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of PluginVersionsInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return PluginVersionsPage(self._version, response, self._solution) + + def get(self, sid: str) -> PluginVersionsContext: + """ + Constructs a PluginVersionsContext + + :param sid: The SID of the Flex Plugin Version resource to fetch. + """ + return PluginVersionsContext( + self._version, plugin_sid=self._solution["plugin_sid"], sid=sid + ) + + def __call__(self, sid: str) -> PluginVersionsContext: + """ + Constructs a PluginVersionsContext + + :param sid: The SID of the Flex Plugin Version resource to fetch. + """ + return PluginVersionsContext( + self._version, plugin_sid=self._solution["plugin_sid"], sid=sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "<Twilio.FlexApi.V1.PluginVersionsList>" diff --git a/twilio/rest/flex_api/v1/plugin_archive.py b/twilio/rest/flex_api/v1/plugin_archive.py new file mode 100644 index 0000000000000000000000000000000000000000..68f9bce384b36670f744accea5f244d276369675 --- /dev/null +++ b/twilio/rest/flex_api/v1/plugin_archive.py @@ -0,0 +1,220 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Flex + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from datetime import datetime +from typing import Any, Dict, Optional, Union +from twilio.base import deserialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class 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. + :ivar unique_name: The name that uniquely identifies this Flex Plugin resource. + :ivar friendly_name: The friendly name this Flex Plugin resource. + :ivar description: A descriptive string that you create to describe the plugin resource. It can be up to 500 characters long + :ivar archived: Whether the Flex Plugin is archived. The default value is false. + :ivar date_created: The date and time in GMT when the Flex Plugin 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 Flex Plugin was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the Flex Plugin resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.description: Optional[str] = payload.get("description") + self.archived: Optional[bool] = payload.get("archived") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") + + self._solution = { + "sid": sid or self.sid, + } + self._context: Optional[PluginArchiveContext] = None + + @property + def _proxy(self) -> "PluginArchiveContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: PluginArchiveContext for this PluginArchiveInstance + """ + if self._context is None: + self._context = PluginArchiveContext( + self._version, + sid=self._solution["sid"], + ) + return self._context + + def update( + self, flex_metadata: Union[str, object] = values.unset + ) -> "PluginArchiveInstance": + """ + Update the PluginArchiveInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The updated PluginArchiveInstance + """ + return self._proxy.update( + flex_metadata=flex_metadata, + ) + + async def update_async( + self, flex_metadata: Union[str, object] = values.unset + ) -> "PluginArchiveInstance": + """ + Asynchronous coroutine to update the PluginArchiveInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The updated PluginArchiveInstance + """ + return await self._proxy.update_async( + flex_metadata=flex_metadata, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "<Twilio.FlexApi.V1.PluginArchiveInstance {}>".format(context) + + +class PluginArchiveContext(InstanceContext): + + def __init__(self, version: Version, sid: str): + """ + Initialize the PluginArchiveContext + + :param version: Version that contains the resource + :param sid: The SID of the Flex Plugin resource to archive. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "sid": sid, + } + self._uri = "/PluginService/Plugins/{sid}/Archive".format(**self._solution) + + def update( + self, flex_metadata: Union[str, object] = values.unset + ) -> PluginArchiveInstance: + """ + Update the PluginArchiveInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The updated PluginArchiveInstance + """ + data = values.of({}) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = self._version.update( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return PluginArchiveInstance(self._version, payload, sid=self._solution["sid"]) + + async def update_async( + self, flex_metadata: Union[str, object] = values.unset + ) -> PluginArchiveInstance: + """ + Asynchronous coroutine to update the PluginArchiveInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The updated PluginArchiveInstance + """ + data = values.of({}) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = await self._version.update_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return PluginArchiveInstance(self._version, payload, sid=self._solution["sid"]) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "<Twilio.FlexApi.V1.PluginArchiveContext {}>".format(context) + + +class PluginArchiveList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the PluginArchiveList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, sid: str) -> PluginArchiveContext: + """ + Constructs a PluginArchiveContext + + :param sid: The SID of the Flex Plugin resource to archive. + """ + return PluginArchiveContext(self._version, sid=sid) + + def __call__(self, sid: str) -> PluginArchiveContext: + """ + Constructs a PluginArchiveContext + + :param sid: The SID of the Flex Plugin resource to archive. + """ + return PluginArchiveContext(self._version, sid=sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "<Twilio.FlexApi.V1.PluginArchiveList>" diff --git a/twilio/rest/flex_api/v1/plugin_configuration/__init__.py b/twilio/rest/flex_api/v1/plugin_configuration/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ebe173985bea0355d7c229e67bbf46aaa0a78953 --- /dev/null +++ b/twilio/rest/flex_api/v1/plugin_configuration/__init__.py @@ -0,0 +1,543 @@ +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, serialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page +from twilio.rest.flex_api.v1.plugin_configuration.configured_plugin import ( + ConfiguredPluginList, +) + + +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. + :ivar name: The name of this Flex Plugin Configuration. + :ivar description: The description of the Flex Plugin Configuration resource. + :ivar archived: Whether the Flex Plugin Configuration is archived. The default value is false. + :ivar date_created: The date and time in GMT when the Flex Plugin Configuration was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the Flex Plugin Configuration resource. + :ivar links: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.name: Optional[str] = payload.get("name") + self.description: Optional[str] = payload.get("description") + self.archived: Optional[bool] = payload.get("archived") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") + + self._solution = { + "sid": sid or self.sid, + } + self._context: Optional[PluginConfigurationContext] = None + + @property + def _proxy(self) -> "PluginConfigurationContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: PluginConfigurationContext for this PluginConfigurationInstance + """ + if self._context is None: + self._context = PluginConfigurationContext( + self._version, + sid=self._solution["sid"], + ) + return self._context + + def fetch( + self, flex_metadata: Union[str, object] = values.unset + ) -> "PluginConfigurationInstance": + """ + Fetch the PluginConfigurationInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The fetched PluginConfigurationInstance + """ + return self._proxy.fetch( + flex_metadata=flex_metadata, + ) + + async def fetch_async( + self, flex_metadata: Union[str, object] = values.unset + ) -> "PluginConfigurationInstance": + """ + Asynchronous coroutine to fetch the PluginConfigurationInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The fetched PluginConfigurationInstance + """ + return await self._proxy.fetch_async( + flex_metadata=flex_metadata, + ) + + @property + def plugins(self) -> ConfiguredPluginList: + """ + Access the plugins + """ + return self._proxy.plugins + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "<Twilio.FlexApi.V1.PluginConfigurationInstance {}>".format(context) + + +class PluginConfigurationContext(InstanceContext): + + def __init__(self, version: Version, sid: str): + """ + Initialize the PluginConfigurationContext + + :param version: Version that contains the resource + :param sid: The SID of the Flex Plugin Configuration resource to fetch. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "sid": sid, + } + self._uri = "/PluginService/Configurations/{sid}".format(**self._solution) + + self._plugins: Optional[ConfiguredPluginList] = None + + def fetch( + self, flex_metadata: Union[str, object] = values.unset + ) -> PluginConfigurationInstance: + """ + Fetch the PluginConfigurationInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The fetched PluginConfigurationInstance + """ + + data = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = self._version.fetch(method="GET", uri=self._uri, params=data) + + return PluginConfigurationInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + async def fetch_async( + self, flex_metadata: Union[str, object] = values.unset + ) -> PluginConfigurationInstance: + """ + Asynchronous coroutine to fetch the PluginConfigurationInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The fetched PluginConfigurationInstance + """ + + data = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = await self._version.fetch_async( + method="GET", uri=self._uri, params=data + ) + + return PluginConfigurationInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + @property + def plugins(self) -> ConfiguredPluginList: + """ + Access the plugins + """ + if self._plugins is None: + self._plugins = ConfiguredPluginList( + self._version, + self._solution["sid"], + ) + return self._plugins + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "<Twilio.FlexApi.V1.PluginConfigurationContext {}>".format(context) + + +class PluginConfigurationPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> PluginConfigurationInstance: + """ + Build an instance of PluginConfigurationInstance + + :param payload: Payload response from the API + """ + return PluginConfigurationInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "<Twilio.FlexApi.V1.PluginConfigurationPage>" + + +class PluginConfigurationList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the PluginConfigurationList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/PluginService/Configurations" + + def create( + self, + name: str, + flex_metadata: Union[str, object] = values.unset, + plugins: Union[List[object], object] = values.unset, + description: Union[str, object] = values.unset, + ) -> PluginConfigurationInstance: + """ + Create the PluginConfigurationInstance + + :param name: The Flex Plugin Configuration's name. + :param flex_metadata: The Flex-Metadata HTTP request header + :param plugins: A list of objects that describe the plugin versions included in the configuration. Each object contains the sid of the plugin version. + :param description: The Flex Plugin Configuration's description. + + :returns: The created PluginConfigurationInstance + """ + + data = values.of( + { + "Name": name, + "Plugins": serialize.map(plugins, lambda e: serialize.object(e)), + "Description": description, + } + ) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return PluginConfigurationInstance(self._version, payload) + + async def create_async( + self, + name: str, + flex_metadata: Union[str, object] = values.unset, + plugins: Union[List[object], object] = values.unset, + description: Union[str, object] = values.unset, + ) -> PluginConfigurationInstance: + """ + Asynchronously create the PluginConfigurationInstance + + :param name: The Flex Plugin Configuration's name. + :param flex_metadata: The Flex-Metadata HTTP request header + :param plugins: A list of objects that describe the plugin versions included in the configuration. Each object contains the sid of the plugin version. + :param description: The Flex Plugin Configuration's description. + + :returns: The created PluginConfigurationInstance + """ + + data = values.of( + { + "Name": name, + "Plugins": serialize.map(plugins, lambda e: serialize.object(e)), + "Description": description, + } + ) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return PluginConfigurationInstance(self._version, payload) + + def stream( + self, + flex_metadata: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[PluginConfigurationInstance]: + """ + Streams PluginConfigurationInstance 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 flex_metadata: The Flex-Metadata 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 + the default value of 50 records. If no page_size is defined + 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(flex_metadata=flex_metadata, page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + flex_metadata: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[PluginConfigurationInstance]: + """ + Asynchronously streams PluginConfigurationInstance 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 flex_metadata: The Flex-Metadata 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 + the default value of 50 records. If no page_size is defined + 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( + flex_metadata=flex_metadata, page_size=limits["page_size"] + ) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + flex_metadata: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[PluginConfigurationInstance]: + """ + Lists PluginConfigurationInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str flex_metadata: The Flex-Metadata 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 + the default value of 50 records. If no page_size is defined + 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( + flex_metadata=flex_metadata, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + flex_metadata: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[PluginConfigurationInstance]: + """ + Asynchronously lists PluginConfigurationInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str flex_metadata: The Flex-Metadata 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 + the default value of 50 records. If no page_size is defined + 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( + flex_metadata=flex_metadata, + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + flex_metadata: 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, + ) -> PluginConfigurationPage: + """ + Retrieve a single page of PluginConfigurationInstance records from the API. + Request is executed immediately + + :param flex_metadata: The Flex-Metadata 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 + + :returns: Page of PluginConfigurationInstance + """ + data = values.of( + { + "Flex-Metadata": flex_metadata, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return PluginConfigurationPage(self._version, response) + + async def page_async( + self, + flex_metadata: 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, + ) -> PluginConfigurationPage: + """ + Asynchronously retrieve a single page of PluginConfigurationInstance records from the API. + Request is executed immediately + + :param flex_metadata: The Flex-Metadata 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 + + :returns: Page of PluginConfigurationInstance + """ + data = values.of( + { + "Flex-Metadata": flex_metadata, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return PluginConfigurationPage(self._version, response) + + def get_page(self, target_url: str) -> PluginConfigurationPage: + """ + Retrieve a specific page of PluginConfigurationInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of PluginConfigurationInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return PluginConfigurationPage(self._version, response) + + async def get_page_async(self, target_url: str) -> PluginConfigurationPage: + """ + Asynchronously retrieve a specific page of PluginConfigurationInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of PluginConfigurationInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return PluginConfigurationPage(self._version, response) + + def get(self, sid: str) -> PluginConfigurationContext: + """ + Constructs a PluginConfigurationContext + + :param sid: The SID of the Flex Plugin Configuration resource to fetch. + """ + return PluginConfigurationContext(self._version, sid=sid) + + def __call__(self, sid: str) -> PluginConfigurationContext: + """ + Constructs a PluginConfigurationContext + + :param sid: The SID of the Flex Plugin Configuration resource to fetch. + """ + return PluginConfigurationContext(self._version, sid=sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "<Twilio.FlexApi.V1.PluginConfigurationList>" diff --git a/twilio/rest/flex_api/v1/plugin_configuration/configured_plugin.py b/twilio/rest/flex_api/v1/plugin_configuration/configured_plugin.py new file mode 100644 index 0000000000000000000000000000000000000000..6e54012eb05b1c6865bfae68e54364804efe4926 --- /dev/null +++ b/twilio/rest/flex_api/v1/plugin_configuration/configured_plugin.py @@ -0,0 +1,494 @@ +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.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 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. + :ivar plugin_sid: The SID of the Flex Plugin. + :ivar plugin_version_sid: The SID of the Flex Plugin Version. + :ivar phase: The phase this Flex Plugin would initialize at runtime. + :ivar plugin_url: The URL of where the Flex Plugin Version JavaScript bundle is hosted on. + :ivar unique_name: The name that uniquely identifies this Flex Plugin resource. + :ivar friendly_name: The friendly name of this Flex Plugin resource. + :ivar description: A descriptive string that you create to describe the plugin resource. It can be up to 500 characters long + :ivar plugin_archived: Whether the Flex Plugin is archived. The default value is false. + :ivar version: The latest version of this Flex Plugin Version. + :ivar changelog: A changelog that describes the changes this Flex Plugin Version brings. + :ivar plugin_version_archived: Whether the Flex Plugin Version is archived. The default value is false. + :ivar private: Whether to validate the request is authorized to access the Flex Plugin Version. + :ivar date_created: The date and time in GMT when the Flex Plugin was installed specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the Flex Plugin resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + configuration_sid: str, + plugin_sid: Optional[str] = None, + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.configuration_sid: Optional[str] = payload.get("configuration_sid") + self.plugin_sid: Optional[str] = payload.get("plugin_sid") + self.plugin_version_sid: Optional[str] = payload.get("plugin_version_sid") + self.phase: Optional[int] = deserialize.integer(payload.get("phase")) + self.plugin_url: Optional[str] = payload.get("plugin_url") + self.unique_name: Optional[str] = payload.get("unique_name") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.description: Optional[str] = payload.get("description") + self.plugin_archived: Optional[bool] = payload.get("plugin_archived") + self.version: Optional[str] = payload.get("version") + self.changelog: Optional[str] = payload.get("changelog") + self.plugin_version_archived: Optional[bool] = payload.get( + "plugin_version_archived" + ) + self.private: Optional[bool] = payload.get("private") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.url: Optional[str] = payload.get("url") + + self._solution = { + "configuration_sid": configuration_sid, + "plugin_sid": plugin_sid or self.plugin_sid, + } + self._context: Optional[ConfiguredPluginContext] = None + + @property + def _proxy(self) -> "ConfiguredPluginContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: ConfiguredPluginContext for this ConfiguredPluginInstance + """ + if self._context is None: + self._context = ConfiguredPluginContext( + self._version, + configuration_sid=self._solution["configuration_sid"], + plugin_sid=self._solution["plugin_sid"], + ) + return self._context + + def fetch( + self, flex_metadata: Union[str, object] = values.unset + ) -> "ConfiguredPluginInstance": + """ + Fetch the ConfiguredPluginInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The fetched ConfiguredPluginInstance + """ + return self._proxy.fetch( + flex_metadata=flex_metadata, + ) + + async def fetch_async( + self, flex_metadata: Union[str, object] = values.unset + ) -> "ConfiguredPluginInstance": + """ + Asynchronous coroutine to fetch the ConfiguredPluginInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The fetched ConfiguredPluginInstance + """ + return await self._proxy.fetch_async( + flex_metadata=flex_metadata, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "<Twilio.FlexApi.V1.ConfiguredPluginInstance {}>".format(context) + + +class ConfiguredPluginContext(InstanceContext): + + def __init__(self, version: Version, configuration_sid: str, plugin_sid: str): + """ + Initialize the ConfiguredPluginContext + + :param version: Version that contains the resource + :param configuration_sid: The SID of the Flex Plugin Configuration the resource to belongs to. + :param plugin_sid: The unique string that we created to identify the Flex Plugin resource. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "configuration_sid": configuration_sid, + "plugin_sid": plugin_sid, + } + self._uri = "/PluginService/Configurations/{configuration_sid}/Plugins/{plugin_sid}".format( + **self._solution + ) + + def fetch( + self, flex_metadata: Union[str, object] = values.unset + ) -> ConfiguredPluginInstance: + """ + Fetch the ConfiguredPluginInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The fetched ConfiguredPluginInstance + """ + + data = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = self._version.fetch(method="GET", uri=self._uri, params=data) + + return ConfiguredPluginInstance( + self._version, + payload, + configuration_sid=self._solution["configuration_sid"], + plugin_sid=self._solution["plugin_sid"], + ) + + async def fetch_async( + self, flex_metadata: Union[str, object] = values.unset + ) -> ConfiguredPluginInstance: + """ + Asynchronous coroutine to fetch the ConfiguredPluginInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The fetched ConfiguredPluginInstance + """ + + data = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = await self._version.fetch_async( + method="GET", uri=self._uri, params=data + ) + + return ConfiguredPluginInstance( + self._version, + payload, + configuration_sid=self._solution["configuration_sid"], + plugin_sid=self._solution["plugin_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 "<Twilio.FlexApi.V1.ConfiguredPluginContext {}>".format(context) + + +class ConfiguredPluginPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> ConfiguredPluginInstance: + """ + Build an instance of ConfiguredPluginInstance + + :param payload: Payload response from the API + """ + return ConfiguredPluginInstance( + self._version, + payload, + configuration_sid=self._solution["configuration_sid"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "<Twilio.FlexApi.V1.ConfiguredPluginPage>" + + +class ConfiguredPluginList(ListResource): + + def __init__(self, version: Version, configuration_sid: str): + """ + Initialize the ConfiguredPluginList + + :param version: Version that contains the resource + :param configuration_sid: The SID of the Flex Plugin Configuration the resource to belongs to. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "configuration_sid": configuration_sid, + } + self._uri = "/PluginService/Configurations/{configuration_sid}/Plugins".format( + **self._solution + ) + + def stream( + self, + flex_metadata: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[ConfiguredPluginInstance]: + """ + Streams ConfiguredPluginInstance 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 flex_metadata: The Flex-Metadata 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 + the default value of 50 records. If no page_size is defined + 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(flex_metadata=flex_metadata, page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + flex_metadata: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[ConfiguredPluginInstance]: + """ + Asynchronously streams ConfiguredPluginInstance 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 flex_metadata: The Flex-Metadata 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 + the default value of 50 records. If no page_size is defined + 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( + flex_metadata=flex_metadata, page_size=limits["page_size"] + ) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + flex_metadata: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[ConfiguredPluginInstance]: + """ + Lists ConfiguredPluginInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str flex_metadata: The Flex-Metadata 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 + the default value of 50 records. If no page_size is defined + 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( + flex_metadata=flex_metadata, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + flex_metadata: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[ConfiguredPluginInstance]: + """ + Asynchronously lists ConfiguredPluginInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str flex_metadata: The Flex-Metadata 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 + the default value of 50 records. If no page_size is defined + 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( + flex_metadata=flex_metadata, + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + flex_metadata: 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, + ) -> ConfiguredPluginPage: + """ + Retrieve a single page of ConfiguredPluginInstance records from the API. + Request is executed immediately + + :param flex_metadata: The Flex-Metadata 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 + + :returns: Page of ConfiguredPluginInstance + """ + data = values.of( + { + "Flex-Metadata": flex_metadata, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return ConfiguredPluginPage(self._version, response, self._solution) + + async def page_async( + self, + flex_metadata: 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, + ) -> ConfiguredPluginPage: + """ + Asynchronously retrieve a single page of ConfiguredPluginInstance records from the API. + Request is executed immediately + + :param flex_metadata: The Flex-Metadata 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 + + :returns: Page of ConfiguredPluginInstance + """ + data = values.of( + { + "Flex-Metadata": flex_metadata, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return ConfiguredPluginPage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> ConfiguredPluginPage: + """ + Retrieve a specific page of ConfiguredPluginInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ConfiguredPluginInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return ConfiguredPluginPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> ConfiguredPluginPage: + """ + Asynchronously retrieve a specific page of ConfiguredPluginInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ConfiguredPluginInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return ConfiguredPluginPage(self._version, response, self._solution) + + def get(self, plugin_sid: str) -> ConfiguredPluginContext: + """ + Constructs a ConfiguredPluginContext + + :param plugin_sid: The unique string that we created to identify the Flex Plugin resource. + """ + return ConfiguredPluginContext( + self._version, + configuration_sid=self._solution["configuration_sid"], + plugin_sid=plugin_sid, + ) + + def __call__(self, plugin_sid: str) -> ConfiguredPluginContext: + """ + Constructs a ConfiguredPluginContext + + :param plugin_sid: The unique string that we created to identify the Flex Plugin resource. + """ + return ConfiguredPluginContext( + self._version, + configuration_sid=self._solution["configuration_sid"], + plugin_sid=plugin_sid, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "<Twilio.FlexApi.V1.ConfiguredPluginList>" diff --git a/twilio/rest/flex_api/v1/plugin_configuration_archive.py b/twilio/rest/flex_api/v1/plugin_configuration_archive.py new file mode 100644 index 0000000000000000000000000000000000000000..97d2f8120dbdd0ff11a66c84329e143ed6f3d331 --- /dev/null +++ b/twilio/rest/flex_api/v1/plugin_configuration_archive.py @@ -0,0 +1,224 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Flex + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from datetime import datetime +from typing import Any, Dict, Optional, Union +from twilio.base import deserialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class 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. + :ivar name: The name of this Flex Plugin Configuration. + :ivar description: The description of the Flex Plugin Configuration resource. + :ivar archived: Whether the Flex Plugin Configuration is archived. The default value is false. + :ivar date_created: The date and time in GMT when the Flex Plugin Configuration was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the Flex Plugin Configuration resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.name: Optional[str] = payload.get("name") + self.description: Optional[str] = payload.get("description") + self.archived: Optional[bool] = payload.get("archived") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.url: Optional[str] = payload.get("url") + + self._solution = { + "sid": sid or self.sid, + } + self._context: Optional[PluginConfigurationArchiveContext] = None + + @property + def _proxy(self) -> "PluginConfigurationArchiveContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: PluginConfigurationArchiveContext for this PluginConfigurationArchiveInstance + """ + if self._context is None: + self._context = PluginConfigurationArchiveContext( + self._version, + sid=self._solution["sid"], + ) + return self._context + + def update( + self, flex_metadata: Union[str, object] = values.unset + ) -> "PluginConfigurationArchiveInstance": + """ + Update the PluginConfigurationArchiveInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The updated PluginConfigurationArchiveInstance + """ + return self._proxy.update( + flex_metadata=flex_metadata, + ) + + async def update_async( + self, flex_metadata: Union[str, object] = values.unset + ) -> "PluginConfigurationArchiveInstance": + """ + Asynchronous coroutine to update the PluginConfigurationArchiveInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The updated PluginConfigurationArchiveInstance + """ + return await self._proxy.update_async( + flex_metadata=flex_metadata, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "<Twilio.FlexApi.V1.PluginConfigurationArchiveInstance {}>".format( + context + ) + + +class PluginConfigurationArchiveContext(InstanceContext): + + def __init__(self, version: Version, sid: str): + """ + Initialize the PluginConfigurationArchiveContext + + :param version: Version that contains the resource + :param sid: The SID of the Flex Plugin Configuration resource to archive. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "sid": sid, + } + self._uri = "/PluginService/Configurations/{sid}/Archive".format( + **self._solution + ) + + def update( + self, flex_metadata: Union[str, object] = values.unset + ) -> PluginConfigurationArchiveInstance: + """ + Update the PluginConfigurationArchiveInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The updated PluginConfigurationArchiveInstance + """ + data = values.of({}) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = self._version.update( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return PluginConfigurationArchiveInstance( + self._version, payload, sid=self._solution["sid"] + ) + + async def update_async( + self, flex_metadata: Union[str, object] = values.unset + ) -> PluginConfigurationArchiveInstance: + """ + Asynchronous coroutine to update the PluginConfigurationArchiveInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The updated PluginConfigurationArchiveInstance + """ + data = values.of({}) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = await self._version.update_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return PluginConfigurationArchiveInstance( + self._version, payload, sid=self._solution["sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "<Twilio.FlexApi.V1.PluginConfigurationArchiveContext {}>".format( + context + ) + + +class PluginConfigurationArchiveList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the PluginConfigurationArchiveList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, sid: str) -> PluginConfigurationArchiveContext: + """ + Constructs a PluginConfigurationArchiveContext + + :param sid: The SID of the Flex Plugin Configuration resource to archive. + """ + return PluginConfigurationArchiveContext(self._version, sid=sid) + + def __call__(self, sid: str) -> PluginConfigurationArchiveContext: + """ + Constructs a PluginConfigurationArchiveContext + + :param sid: The SID of the Flex Plugin Configuration resource to archive. + """ + return PluginConfigurationArchiveContext(self._version, sid=sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "<Twilio.FlexApi.V1.PluginConfigurationArchiveList>" diff --git a/twilio/rest/flex_api/v1/plugin_release.py b/twilio/rest/flex_api/v1/plugin_release.py new file mode 100644 index 0000000000000000000000000000000000000000..f2e8efd306664c144341d2c1042de8c98de00535 --- /dev/null +++ b/twilio/rest/flex_api/v1/plugin_release.py @@ -0,0 +1,497 @@ +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.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 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. + :ivar configuration_sid: The SID of the Plugin Configuration resource to release. + :ivar date_created: The date and time in GMT when the Flex Plugin Release was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the Plugin Release resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.configuration_sid: Optional[str] = payload.get("configuration_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.url: Optional[str] = payload.get("url") + + self._solution = { + "sid": sid or self.sid, + } + self._context: Optional[PluginReleaseContext] = None + + @property + def _proxy(self) -> "PluginReleaseContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: PluginReleaseContext for this PluginReleaseInstance + """ + if self._context is None: + self._context = PluginReleaseContext( + self._version, + sid=self._solution["sid"], + ) + return self._context + + def fetch( + self, flex_metadata: Union[str, object] = values.unset + ) -> "PluginReleaseInstance": + """ + Fetch the PluginReleaseInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The fetched PluginReleaseInstance + """ + return self._proxy.fetch( + flex_metadata=flex_metadata, + ) + + async def fetch_async( + self, flex_metadata: Union[str, object] = values.unset + ) -> "PluginReleaseInstance": + """ + Asynchronous coroutine to fetch the PluginReleaseInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The fetched PluginReleaseInstance + """ + return await self._proxy.fetch_async( + flex_metadata=flex_metadata, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "<Twilio.FlexApi.V1.PluginReleaseInstance {}>".format(context) + + +class PluginReleaseContext(InstanceContext): + + def __init__(self, version: Version, sid: str): + """ + Initialize the PluginReleaseContext + + :param version: Version that contains the resource + :param sid: The SID of the Flex Plugin Release resource to fetch. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "sid": sid, + } + self._uri = "/PluginService/Releases/{sid}".format(**self._solution) + + def fetch( + self, flex_metadata: Union[str, object] = values.unset + ) -> PluginReleaseInstance: + """ + Fetch the PluginReleaseInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The fetched PluginReleaseInstance + """ + + data = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = self._version.fetch(method="GET", uri=self._uri, params=data) + + return PluginReleaseInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + async def fetch_async( + self, flex_metadata: Union[str, object] = values.unset + ) -> PluginReleaseInstance: + """ + Asynchronous coroutine to fetch the PluginReleaseInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The fetched PluginReleaseInstance + """ + + data = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = await self._version.fetch_async( + method="GET", uri=self._uri, params=data + ) + + return PluginReleaseInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "<Twilio.FlexApi.V1.PluginReleaseContext {}>".format(context) + + +class PluginReleasePage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> PluginReleaseInstance: + """ + Build an instance of PluginReleaseInstance + + :param payload: Payload response from the API + """ + return PluginReleaseInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "<Twilio.FlexApi.V1.PluginReleasePage>" + + +class PluginReleaseList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the PluginReleaseList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/PluginService/Releases" + + def create( + self, configuration_id: str, flex_metadata: Union[str, object] = values.unset + ) -> PluginReleaseInstance: + """ + Create the PluginReleaseInstance + + :param configuration_id: The SID or the Version of the Flex Plugin Configuration to release. + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The created PluginReleaseInstance + """ + + data = values.of( + { + "ConfigurationId": configuration_id, + } + ) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return PluginReleaseInstance(self._version, payload) + + async def create_async( + self, configuration_id: str, flex_metadata: Union[str, object] = values.unset + ) -> PluginReleaseInstance: + """ + Asynchronously create the PluginReleaseInstance + + :param configuration_id: The SID or the Version of the Flex Plugin Configuration to release. + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The created PluginReleaseInstance + """ + + data = values.of( + { + "ConfigurationId": configuration_id, + } + ) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return PluginReleaseInstance(self._version, payload) + + def stream( + self, + flex_metadata: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[PluginReleaseInstance]: + """ + Streams PluginReleaseInstance 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 flex_metadata: The Flex-Metadata 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 + the default value of 50 records. If no page_size is defined + 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(flex_metadata=flex_metadata, page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + flex_metadata: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[PluginReleaseInstance]: + """ + Asynchronously streams PluginReleaseInstance 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 flex_metadata: The Flex-Metadata 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 + the default value of 50 records. If no page_size is defined + 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( + flex_metadata=flex_metadata, page_size=limits["page_size"] + ) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + flex_metadata: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[PluginReleaseInstance]: + """ + Lists PluginReleaseInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str flex_metadata: The Flex-Metadata 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 + the default value of 50 records. If no page_size is defined + 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( + flex_metadata=flex_metadata, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + flex_metadata: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[PluginReleaseInstance]: + """ + Asynchronously lists PluginReleaseInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str flex_metadata: The Flex-Metadata 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 + the default value of 50 records. If no page_size is defined + 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( + flex_metadata=flex_metadata, + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + flex_metadata: 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, + ) -> PluginReleasePage: + """ + Retrieve a single page of PluginReleaseInstance records from the API. + Request is executed immediately + + :param flex_metadata: The Flex-Metadata 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 + + :returns: Page of PluginReleaseInstance + """ + data = values.of( + { + "Flex-Metadata": flex_metadata, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return PluginReleasePage(self._version, response) + + async def page_async( + self, + flex_metadata: 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, + ) -> PluginReleasePage: + """ + Asynchronously retrieve a single page of PluginReleaseInstance records from the API. + Request is executed immediately + + :param flex_metadata: The Flex-Metadata 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 + + :returns: Page of PluginReleaseInstance + """ + data = values.of( + { + "Flex-Metadata": flex_metadata, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return PluginReleasePage(self._version, response) + + def get_page(self, target_url: str) -> PluginReleasePage: + """ + Retrieve a specific page of PluginReleaseInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of PluginReleaseInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return PluginReleasePage(self._version, response) + + async def get_page_async(self, target_url: str) -> PluginReleasePage: + """ + Asynchronously retrieve a specific page of PluginReleaseInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of PluginReleaseInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return PluginReleasePage(self._version, response) + + def get(self, sid: str) -> PluginReleaseContext: + """ + Constructs a PluginReleaseContext + + :param sid: The SID of the Flex Plugin Release resource to fetch. + """ + return PluginReleaseContext(self._version, sid=sid) + + def __call__(self, sid: str) -> PluginReleaseContext: + """ + Constructs a PluginReleaseContext + + :param sid: The SID of the Flex Plugin Release resource to fetch. + """ + return PluginReleaseContext(self._version, sid=sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "<Twilio.FlexApi.V1.PluginReleaseList>" diff --git a/twilio/rest/flex_api/v1/plugin_version_archive.py b/twilio/rest/flex_api/v1/plugin_version_archive.py new file mode 100644 index 0000000000000000000000000000000000000000..ae8d2f3dffb9fe262562790ea940e3d200e548e1 --- /dev/null +++ b/twilio/rest/flex_api/v1/plugin_version_archive.py @@ -0,0 +1,246 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Flex + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from datetime import datetime +from typing import Any, Dict, Optional, Union +from twilio.base import deserialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class 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. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Plugin Version resource and owns this resource. + :ivar version: The unique version of this Flex Plugin Version. + :ivar plugin_url: The URL of where the Flex Plugin Version JavaScript bundle is hosted on. + :ivar changelog: A changelog that describes the changes this Flex Plugin Version brings. + :ivar private: Whether to inject credentials while accessing this Plugin Version. The default value is false. + :ivar archived: Whether the Flex Plugin Version is archived. The default value is false. + :ivar date_created: The date and time in GMT when the Flex Plugin Version was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the Flex Plugin Version resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + plugin_sid: Optional[str] = None, + sid: Optional[str] = None, + ): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.plugin_sid: Optional[str] = payload.get("plugin_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.version: Optional[str] = payload.get("version") + self.plugin_url: Optional[str] = payload.get("plugin_url") + self.changelog: Optional[str] = payload.get("changelog") + self.private: Optional[bool] = payload.get("private") + self.archived: Optional[bool] = payload.get("archived") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.url: Optional[str] = payload.get("url") + + self._solution = { + "plugin_sid": plugin_sid or self.plugin_sid, + "sid": sid or self.sid, + } + self._context: Optional[PluginVersionArchiveContext] = None + + @property + def _proxy(self) -> "PluginVersionArchiveContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: PluginVersionArchiveContext for this PluginVersionArchiveInstance + """ + if self._context is None: + self._context = PluginVersionArchiveContext( + self._version, + plugin_sid=self._solution["plugin_sid"], + sid=self._solution["sid"], + ) + return self._context + + def update( + self, flex_metadata: Union[str, object] = values.unset + ) -> "PluginVersionArchiveInstance": + """ + Update the PluginVersionArchiveInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The updated PluginVersionArchiveInstance + """ + return self._proxy.update( + flex_metadata=flex_metadata, + ) + + async def update_async( + self, flex_metadata: Union[str, object] = values.unset + ) -> "PluginVersionArchiveInstance": + """ + Asynchronous coroutine to update the PluginVersionArchiveInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The updated PluginVersionArchiveInstance + """ + return await self._proxy.update_async( + flex_metadata=flex_metadata, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "<Twilio.FlexApi.V1.PluginVersionArchiveInstance {}>".format(context) + + +class PluginVersionArchiveContext(InstanceContext): + + def __init__(self, version: Version, plugin_sid: str, sid: str): + """ + Initialize the PluginVersionArchiveContext + + :param version: Version that contains the resource + :param plugin_sid: The SID of the Flex Plugin the resource to belongs to. + :param sid: The SID of the Flex Plugin Version resource to archive. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "plugin_sid": plugin_sid, + "sid": sid, + } + self._uri = "/PluginService/Plugins/{plugin_sid}/Versions/{sid}/Archive".format( + **self._solution + ) + + def update( + self, flex_metadata: Union[str, object] = values.unset + ) -> PluginVersionArchiveInstance: + """ + Update the PluginVersionArchiveInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The updated PluginVersionArchiveInstance + """ + data = values.of({}) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = self._version.update( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return PluginVersionArchiveInstance( + self._version, + payload, + plugin_sid=self._solution["plugin_sid"], + sid=self._solution["sid"], + ) + + async def update_async( + self, flex_metadata: Union[str, object] = values.unset + ) -> PluginVersionArchiveInstance: + """ + Asynchronous coroutine to update the PluginVersionArchiveInstance + + :param flex_metadata: The Flex-Metadata HTTP request header + + :returns: The updated PluginVersionArchiveInstance + """ + data = values.of({}) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + } + ) + + payload = await self._version.update_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return PluginVersionArchiveInstance( + self._version, + payload, + plugin_sid=self._solution["plugin_sid"], + sid=self._solution["sid"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "<Twilio.FlexApi.V1.PluginVersionArchiveContext {}>".format(context) + + +class PluginVersionArchiveList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the PluginVersionArchiveList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, plugin_sid: str, sid: str) -> PluginVersionArchiveContext: + """ + Constructs a PluginVersionArchiveContext + + :param plugin_sid: The SID of the Flex Plugin the resource to belongs to. + :param sid: The SID of the Flex Plugin Version resource to archive. + """ + return PluginVersionArchiveContext( + self._version, plugin_sid=plugin_sid, sid=sid + ) + + def __call__(self, plugin_sid: str, sid: str) -> PluginVersionArchiveContext: + """ + Constructs a PluginVersionArchiveContext + + :param plugin_sid: The SID of the Flex Plugin the resource to belongs to. + :param sid: The SID of the Flex Plugin Version resource to archive. + """ + return PluginVersionArchiveContext( + self._version, plugin_sid=plugin_sid, sid=sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "<Twilio.FlexApi.V1.PluginVersionArchiveList>" diff --git a/twilio/rest/frontline_api/v1/user.py b/twilio/rest/frontline_api/v1/user.py index b14fbd09890e2483098914567ac2a38becbaa198..8c9dd93853cca16c2bb717bec85860e108463b09 100644 --- a/twilio/rest/frontline_api/v1/user.py +++ b/twilio/rest/frontline_api/v1/user.py @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, Optional, Union -from twilio.base import values +from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -222,7 +222,7 @@ class UserContext(InstanceContext): "FriendlyName": friendly_name, "Avatar": avatar, "State": state, - "IsAvailable": is_available, + "IsAvailable": serialize.boolean_to_string(is_available), } ) @@ -256,7 +256,7 @@ class UserContext(InstanceContext): "FriendlyName": friendly_name, "Avatar": avatar, "State": state, - "IsAvailable": is_available, + "IsAvailable": serialize.boolean_to_string(is_available), } ) diff --git a/twilio/rest/insights/v1/call/annotation.py b/twilio/rest/insights/v1/call/annotation.py index 0d3f7bb4f4bc19dd563d1fd304f2be2e5c8bfb03..d560003c0ad0a54eaf629c51a67a5540eb247f10 100644 --- a/twilio/rest/insights/v1/call/annotation.py +++ b/twilio/rest/insights/v1/call/annotation.py @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, List, Optional, Union -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -269,7 +269,7 @@ class AnnotationContext(InstanceContext): "AnsweredBy": answered_by, "ConnectivityIssue": connectivity_issue, "QualityIssues": quality_issues, - "Spam": spam, + "Spam": serialize.boolean_to_string(spam), "CallScore": call_score, "Comment": comment, "Incident": incident, @@ -316,7 +316,7 @@ class AnnotationContext(InstanceContext): "AnsweredBy": answered_by, "ConnectivityIssue": connectivity_issue, "QualityIssues": quality_issues, - "Spam": spam, + "Spam": serialize.boolean_to_string(spam), "CallScore": call_score, "Comment": comment, "Incident": incident, diff --git a/twilio/rest/insights/v1/call_summaries.py b/twilio/rest/insights/v1/call_summaries.py index 78cd5b506e103672bab07585d5828e7d9cc170b0..f68744eefc27fd3ca2aa1d99fe82bbd0950eaef9 100644 --- a/twilio/rest/insights/v1/call_summaries.py +++ b/twilio/rest/insights/v1/call_summaries.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -651,9 +651,9 @@ class CallSummariesList(ListResource): "ToCarrier": to_carrier, "FromCountryCode": from_country_code, "ToCountryCode": to_country_code, - "Branded": branded, - "VerifiedCaller": verified_caller, - "HasTag": has_tag, + "Branded": serialize.boolean_to_string(branded), + "VerifiedCaller": serialize.boolean_to_string(verified_caller), + "HasTag": serialize.boolean_to_string(has_tag), "StartTime": start_time, "EndTime": end_time, "CallType": call_type, @@ -662,12 +662,12 @@ class CallSummariesList(ListResource): "ProcessingState": processing_state, "SortBy": sort_by, "Subaccount": subaccount, - "AbnormalSession": abnormal_session, + "AbnormalSession": serialize.boolean_to_string(abnormal_session), "AnsweredBy": answered_by, "AnsweredByAnnotation": answered_by_annotation, "ConnectivityIssueAnnotation": connectivity_issue_annotation, "QualityIssueAnnotation": quality_issue_annotation, - "SpamAnnotation": spam_annotation, + "SpamAnnotation": serialize.boolean_to_string(spam_annotation), "CallScoreAnnotation": call_score_annotation, "PageToken": page_token, "Page": page_number, @@ -752,9 +752,9 @@ class CallSummariesList(ListResource): "ToCarrier": to_carrier, "FromCountryCode": from_country_code, "ToCountryCode": to_country_code, - "Branded": branded, - "VerifiedCaller": verified_caller, - "HasTag": has_tag, + "Branded": serialize.boolean_to_string(branded), + "VerifiedCaller": serialize.boolean_to_string(verified_caller), + "HasTag": serialize.boolean_to_string(has_tag), "StartTime": start_time, "EndTime": end_time, "CallType": call_type, @@ -763,12 +763,12 @@ class CallSummariesList(ListResource): "ProcessingState": processing_state, "SortBy": sort_by, "Subaccount": subaccount, - "AbnormalSession": abnormal_session, + "AbnormalSession": serialize.boolean_to_string(abnormal_session), "AnsweredBy": answered_by, "AnsweredByAnnotation": answered_by_annotation, "ConnectivityIssueAnnotation": connectivity_issue_annotation, "QualityIssueAnnotation": quality_issue_annotation, - "SpamAnnotation": spam_annotation, + "SpamAnnotation": serialize.boolean_to_string(spam_annotation), "CallScoreAnnotation": call_score_annotation, "PageToken": page_token, "Page": page_number, diff --git a/twilio/rest/insights/v1/setting.py b/twilio/rest/insights/v1/setting.py index f0bb5f60d82849d7f2cf5c158d3c1a704940e7bb..c385fc424e30ca04227b195acc1a1827c1bed8fe 100644 --- a/twilio/rest/insights/v1/setting.py +++ b/twilio/rest/insights/v1/setting.py @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, Optional, Union -from twilio.base import values +from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -211,8 +211,8 @@ class SettingContext(InstanceContext): """ data = values.of( { - "AdvancedFeatures": advanced_features, - "VoiceTrace": voice_trace, + "AdvancedFeatures": serialize.boolean_to_string(advanced_features), + "VoiceTrace": serialize.boolean_to_string(voice_trace), "SubaccountSid": subaccount_sid, } ) @@ -242,8 +242,8 @@ class SettingContext(InstanceContext): """ data = values.of( { - "AdvancedFeatures": advanced_features, - "VoiceTrace": voice_trace, + "AdvancedFeatures": serialize.boolean_to_string(advanced_features), + "VoiceTrace": serialize.boolean_to_string(voice_trace), "SubaccountSid": subaccount_sid, } ) diff --git a/twilio/rest/intelligence/v2/service.py b/twilio/rest/intelligence/v2/service.py index 0761da54459ada73d85cc37cd67506b625615f8b..d983be5b2e92d9191a56fdedd09fd452c6757669 100644 --- a/twilio/rest/intelligence/v2/service.py +++ b/twilio/rest/intelligence/v2/service.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -334,13 +334,13 @@ class ServiceContext(InstanceContext): """ data = values.of( { - "AutoTranscribe": auto_transcribe, - "DataLogging": data_logging, + "AutoTranscribe": serialize.boolean_to_string(auto_transcribe), + "DataLogging": serialize.boolean_to_string(data_logging), "FriendlyName": friendly_name, "LanguageCode": language_code, "UniqueName": unique_name, - "AutoRedaction": auto_redaction, - "MediaRedaction": media_redaction, + "AutoRedaction": serialize.boolean_to_string(auto_redaction), + "MediaRedaction": serialize.boolean_to_string(media_redaction), "WebhookUrl": webhook_url, "WebhookHttpMethod": webhook_http_method, } @@ -388,13 +388,13 @@ class ServiceContext(InstanceContext): """ data = values.of( { - "AutoTranscribe": auto_transcribe, - "DataLogging": data_logging, + "AutoTranscribe": serialize.boolean_to_string(auto_transcribe), + "DataLogging": serialize.boolean_to_string(data_logging), "FriendlyName": friendly_name, "LanguageCode": language_code, "UniqueName": unique_name, - "AutoRedaction": auto_redaction, - "MediaRedaction": media_redaction, + "AutoRedaction": serialize.boolean_to_string(auto_redaction), + "MediaRedaction": serialize.boolean_to_string(media_redaction), "WebhookUrl": webhook_url, "WebhookHttpMethod": webhook_http_method, } @@ -484,12 +484,12 @@ class ServiceList(ListResource): data = values.of( { "UniqueName": unique_name, - "AutoTranscribe": auto_transcribe, - "DataLogging": data_logging, + "AutoTranscribe": serialize.boolean_to_string(auto_transcribe), + "DataLogging": serialize.boolean_to_string(data_logging), "FriendlyName": friendly_name, "LanguageCode": language_code, - "AutoRedaction": auto_redaction, - "MediaRedaction": media_redaction, + "AutoRedaction": serialize.boolean_to_string(auto_redaction), + "MediaRedaction": serialize.boolean_to_string(media_redaction), "WebhookUrl": webhook_url, "WebhookHttpMethod": webhook_http_method, } @@ -534,12 +534,12 @@ class ServiceList(ListResource): data = values.of( { "UniqueName": unique_name, - "AutoTranscribe": auto_transcribe, - "DataLogging": data_logging, + "AutoTranscribe": serialize.boolean_to_string(auto_transcribe), + "DataLogging": serialize.boolean_to_string(data_logging), "FriendlyName": friendly_name, "LanguageCode": language_code, - "AutoRedaction": auto_redaction, - "MediaRedaction": media_redaction, + "AutoRedaction": serialize.boolean_to_string(auto_redaction), + "MediaRedaction": serialize.boolean_to_string(media_redaction), "WebhookUrl": webhook_url, "WebhookHttpMethod": webhook_http_method, } diff --git a/twilio/rest/intelligence/v2/transcript/media.py b/twilio/rest/intelligence/v2/transcript/media.py index cb129b436a5cc3591d4bde1cbd19900a6e5fbffa..74d3ab99594e35722026e4449ed7c58ee8c07552 100644 --- a/twilio/rest/intelligence/v2/transcript/media.py +++ b/twilio/rest/intelligence/v2/transcript/media.py @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, Optional, Union -from twilio.base import values +from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -122,7 +122,7 @@ class MediaContext(InstanceContext): data = values.of( { - "Redacted": redacted, + "Redacted": serialize.boolean_to_string(redacted), } ) @@ -147,7 +147,7 @@ class MediaContext(InstanceContext): data = values.of( { - "Redacted": redacted, + "Redacted": serialize.boolean_to_string(redacted), } ) diff --git a/twilio/rest/intelligence/v2/transcript/operator_result.py b/twilio/rest/intelligence/v2/transcript/operator_result.py index 0865673329c86e7d84e67a9fc03134d512a1d146..9d1d614f4dd749b9839f1550dfbf0ffcfc1ccad6 100644 --- a/twilio/rest/intelligence/v2/transcript/operator_result.py +++ b/twilio/rest/intelligence/v2/transcript/operator_result.py @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -183,7 +183,7 @@ class OperatorResultContext(InstanceContext): data = values.of( { - "Redacted": redacted, + "Redacted": serialize.boolean_to_string(redacted), } ) @@ -209,7 +209,7 @@ class OperatorResultContext(InstanceContext): data = values.of( { - "Redacted": redacted, + "Redacted": serialize.boolean_to_string(redacted), } ) @@ -408,7 +408,7 @@ class OperatorResultList(ListResource): """ data = values.of( { - "Redacted": redacted, + "Redacted": serialize.boolean_to_string(redacted), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -438,7 +438,7 @@ class OperatorResultList(ListResource): """ data = values.of( { - "Redacted": redacted, + "Redacted": serialize.boolean_to_string(redacted), "PageToken": page_token, "Page": page_number, "PageSize": page_size, diff --git a/twilio/rest/intelligence/v2/transcript/sentence.py b/twilio/rest/intelligence/v2/transcript/sentence.py index f419135419f9c0bfea2e6877275a357a4c31bda3..5bdd18b00fbb51df6b1004ef96cc7a6bc6600cd4 100644 --- a/twilio/rest/intelligence/v2/transcript/sentence.py +++ b/twilio/rest/intelligence/v2/transcript/sentence.py @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -237,7 +237,7 @@ class SentenceList(ListResource): """ data = values.of( { - "Redacted": redacted, + "Redacted": serialize.boolean_to_string(redacted), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -267,7 +267,7 @@ class SentenceList(ListResource): """ data = values.of( { - "Redacted": redacted, + "Redacted": serialize.boolean_to_string(redacted), "PageToken": page_token, "Page": page_number, "PageSize": page_size, diff --git a/twilio/rest/ip_messaging/v1/credential.py b/twilio/rest/ip_messaging/v1/credential.py index 01423f4900530603ae35e71130c79f54839b631e..eac8e38cf5956bf2776d09e5e174f1031ef7cd1f 100644 --- a/twilio/rest/ip_messaging/v1/credential.py +++ b/twilio/rest/ip_messaging/v1/credential.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -289,7 +289,7 @@ class CredentialContext(InstanceContext): "FriendlyName": friendly_name, "Certificate": certificate, "PrivateKey": private_key, - "Sandbox": sandbox, + "Sandbox": serialize.boolean_to_string(sandbox), "ApiKey": api_key, "Secret": secret, } @@ -329,7 +329,7 @@ class CredentialContext(InstanceContext): "FriendlyName": friendly_name, "Certificate": certificate, "PrivateKey": private_key, - "Sandbox": sandbox, + "Sandbox": serialize.boolean_to_string(sandbox), "ApiKey": api_key, "Secret": secret, } @@ -415,7 +415,7 @@ class CredentialList(ListResource): "FriendlyName": friendly_name, "Certificate": certificate, "PrivateKey": private_key, - "Sandbox": sandbox, + "Sandbox": serialize.boolean_to_string(sandbox), "ApiKey": api_key, "Secret": secret, } @@ -459,7 +459,7 @@ class CredentialList(ListResource): "FriendlyName": friendly_name, "Certificate": certificate, "PrivateKey": private_key, - "Sandbox": sandbox, + "Sandbox": serialize.boolean_to_string(sandbox), "ApiKey": api_key, "Secret": secret, } diff --git a/twilio/rest/ip_messaging/v1/service/__init__.py b/twilio/rest/ip_messaging/v1/service/__init__.py index 8e080657b52d08150f4b97a0f5200c2c4b4c79b0..ad4f002513215f6b7cce9783bd2f8bf70540ab95 100644 --- a/twilio/rest/ip_messaging/v1/service/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/__init__.py @@ -732,17 +732,27 @@ class ServiceContext(InstanceContext): "DefaultServiceRoleSid": default_service_role_sid, "DefaultChannelRoleSid": default_channel_role_sid, "DefaultChannelCreatorRoleSid": default_channel_creator_role_sid, - "ReadStatusEnabled": read_status_enabled, - "ReachabilityEnabled": reachability_enabled, + "ReadStatusEnabled": serialize.boolean_to_string(read_status_enabled), + "ReachabilityEnabled": serialize.boolean_to_string( + reachability_enabled + ), "TypingIndicatorTimeout": typing_indicator_timeout, "ConsumptionReportInterval": consumption_report_interval, - "Notifications.NewMessage.Enabled": notifications_new_message_enabled, + "Notifications.NewMessage.Enabled": serialize.boolean_to_string( + notifications_new_message_enabled + ), "Notifications.NewMessage.Template": notifications_new_message_template, - "Notifications.AddedToChannel.Enabled": notifications_added_to_channel_enabled, + "Notifications.AddedToChannel.Enabled": serialize.boolean_to_string( + notifications_added_to_channel_enabled + ), "Notifications.AddedToChannel.Template": notifications_added_to_channel_template, - "Notifications.RemovedFromChannel.Enabled": notifications_removed_from_channel_enabled, + "Notifications.RemovedFromChannel.Enabled": serialize.boolean_to_string( + notifications_removed_from_channel_enabled + ), "Notifications.RemovedFromChannel.Template": notifications_removed_from_channel_template, - "Notifications.InvitedToChannel.Enabled": notifications_invited_to_channel_enabled, + "Notifications.InvitedToChannel.Enabled": serialize.boolean_to_string( + notifications_invited_to_channel_enabled + ), "Notifications.InvitedToChannel.Template": notifications_invited_to_channel_template, "PreWebhookUrl": pre_webhook_url, "PostWebhookUrl": post_webhook_url, @@ -916,17 +926,27 @@ class ServiceContext(InstanceContext): "DefaultServiceRoleSid": default_service_role_sid, "DefaultChannelRoleSid": default_channel_role_sid, "DefaultChannelCreatorRoleSid": default_channel_creator_role_sid, - "ReadStatusEnabled": read_status_enabled, - "ReachabilityEnabled": reachability_enabled, + "ReadStatusEnabled": serialize.boolean_to_string(read_status_enabled), + "ReachabilityEnabled": serialize.boolean_to_string( + reachability_enabled + ), "TypingIndicatorTimeout": typing_indicator_timeout, "ConsumptionReportInterval": consumption_report_interval, - "Notifications.NewMessage.Enabled": notifications_new_message_enabled, + "Notifications.NewMessage.Enabled": serialize.boolean_to_string( + notifications_new_message_enabled + ), "Notifications.NewMessage.Template": notifications_new_message_template, - "Notifications.AddedToChannel.Enabled": notifications_added_to_channel_enabled, + "Notifications.AddedToChannel.Enabled": serialize.boolean_to_string( + notifications_added_to_channel_enabled + ), "Notifications.AddedToChannel.Template": notifications_added_to_channel_template, - "Notifications.RemovedFromChannel.Enabled": notifications_removed_from_channel_enabled, + "Notifications.RemovedFromChannel.Enabled": serialize.boolean_to_string( + notifications_removed_from_channel_enabled + ), "Notifications.RemovedFromChannel.Template": notifications_removed_from_channel_template, - "Notifications.InvitedToChannel.Enabled": notifications_invited_to_channel_enabled, + "Notifications.InvitedToChannel.Enabled": serialize.boolean_to_string( + notifications_invited_to_channel_enabled + ), "Notifications.InvitedToChannel.Template": notifications_invited_to_channel_template, "PreWebhookUrl": pre_webhook_url, "PostWebhookUrl": post_webhook_url, diff --git a/twilio/rest/ip_messaging/v2/credential.py b/twilio/rest/ip_messaging/v2/credential.py index f81892c742429d05d1f1d11196e8663447d19dec..beec9fbebec28c93e3dedef704db7c7a552f3900 100644 --- a/twilio/rest/ip_messaging/v2/credential.py +++ b/twilio/rest/ip_messaging/v2/credential.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -289,7 +289,7 @@ class CredentialContext(InstanceContext): "FriendlyName": friendly_name, "Certificate": certificate, "PrivateKey": private_key, - "Sandbox": sandbox, + "Sandbox": serialize.boolean_to_string(sandbox), "ApiKey": api_key, "Secret": secret, } @@ -329,7 +329,7 @@ class CredentialContext(InstanceContext): "FriendlyName": friendly_name, "Certificate": certificate, "PrivateKey": private_key, - "Sandbox": sandbox, + "Sandbox": serialize.boolean_to_string(sandbox), "ApiKey": api_key, "Secret": secret, } @@ -415,7 +415,7 @@ class CredentialList(ListResource): "FriendlyName": friendly_name, "Certificate": certificate, "PrivateKey": private_key, - "Sandbox": sandbox, + "Sandbox": serialize.boolean_to_string(sandbox), "ApiKey": api_key, "Secret": secret, } @@ -459,7 +459,7 @@ class CredentialList(ListResource): "FriendlyName": friendly_name, "Certificate": certificate, "PrivateKey": private_key, - "Sandbox": sandbox, + "Sandbox": serialize.boolean_to_string(sandbox), "ApiKey": api_key, "Secret": secret, } diff --git a/twilio/rest/ip_messaging/v2/service/__init__.py b/twilio/rest/ip_messaging/v2/service/__init__.py index 227789bab87604682e2e1331a3616b109dcfac05..b107a119766e54458d94c2e00878462bdcd438b7 100644 --- a/twilio/rest/ip_messaging/v2/service/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/__init__.py @@ -571,21 +571,33 @@ class ServiceContext(InstanceContext): "DefaultServiceRoleSid": default_service_role_sid, "DefaultChannelRoleSid": default_channel_role_sid, "DefaultChannelCreatorRoleSid": default_channel_creator_role_sid, - "ReadStatusEnabled": read_status_enabled, - "ReachabilityEnabled": reachability_enabled, + "ReadStatusEnabled": serialize.boolean_to_string(read_status_enabled), + "ReachabilityEnabled": serialize.boolean_to_string( + reachability_enabled + ), "TypingIndicatorTimeout": typing_indicator_timeout, "ConsumptionReportInterval": consumption_report_interval, - "Notifications.NewMessage.Enabled": notifications_new_message_enabled, + "Notifications.NewMessage.Enabled": serialize.boolean_to_string( + notifications_new_message_enabled + ), "Notifications.NewMessage.Template": notifications_new_message_template, "Notifications.NewMessage.Sound": notifications_new_message_sound, - "Notifications.NewMessage.BadgeCountEnabled": notifications_new_message_badge_count_enabled, - "Notifications.AddedToChannel.Enabled": notifications_added_to_channel_enabled, + "Notifications.NewMessage.BadgeCountEnabled": serialize.boolean_to_string( + notifications_new_message_badge_count_enabled + ), + "Notifications.AddedToChannel.Enabled": serialize.boolean_to_string( + notifications_added_to_channel_enabled + ), "Notifications.AddedToChannel.Template": notifications_added_to_channel_template, "Notifications.AddedToChannel.Sound": notifications_added_to_channel_sound, - "Notifications.RemovedFromChannel.Enabled": notifications_removed_from_channel_enabled, + "Notifications.RemovedFromChannel.Enabled": serialize.boolean_to_string( + notifications_removed_from_channel_enabled + ), "Notifications.RemovedFromChannel.Template": notifications_removed_from_channel_template, "Notifications.RemovedFromChannel.Sound": notifications_removed_from_channel_sound, - "Notifications.InvitedToChannel.Enabled": notifications_invited_to_channel_enabled, + "Notifications.InvitedToChannel.Enabled": serialize.boolean_to_string( + notifications_invited_to_channel_enabled + ), "Notifications.InvitedToChannel.Template": notifications_invited_to_channel_template, "Notifications.InvitedToChannel.Sound": notifications_invited_to_channel_sound, "PreWebhookUrl": pre_webhook_url, @@ -597,7 +609,9 @@ class ServiceContext(InstanceContext): "Media.CompatibilityMessage": media_compatibility_message, "PreWebhookRetryCount": pre_webhook_retry_count, "PostWebhookRetryCount": post_webhook_retry_count, - "Notifications.LogEnabled": notifications_log_enabled, + "Notifications.LogEnabled": serialize.boolean_to_string( + notifications_log_enabled + ), } ) @@ -688,21 +702,33 @@ class ServiceContext(InstanceContext): "DefaultServiceRoleSid": default_service_role_sid, "DefaultChannelRoleSid": default_channel_role_sid, "DefaultChannelCreatorRoleSid": default_channel_creator_role_sid, - "ReadStatusEnabled": read_status_enabled, - "ReachabilityEnabled": reachability_enabled, + "ReadStatusEnabled": serialize.boolean_to_string(read_status_enabled), + "ReachabilityEnabled": serialize.boolean_to_string( + reachability_enabled + ), "TypingIndicatorTimeout": typing_indicator_timeout, "ConsumptionReportInterval": consumption_report_interval, - "Notifications.NewMessage.Enabled": notifications_new_message_enabled, + "Notifications.NewMessage.Enabled": serialize.boolean_to_string( + notifications_new_message_enabled + ), "Notifications.NewMessage.Template": notifications_new_message_template, "Notifications.NewMessage.Sound": notifications_new_message_sound, - "Notifications.NewMessage.BadgeCountEnabled": notifications_new_message_badge_count_enabled, - "Notifications.AddedToChannel.Enabled": notifications_added_to_channel_enabled, + "Notifications.NewMessage.BadgeCountEnabled": serialize.boolean_to_string( + notifications_new_message_badge_count_enabled + ), + "Notifications.AddedToChannel.Enabled": serialize.boolean_to_string( + notifications_added_to_channel_enabled + ), "Notifications.AddedToChannel.Template": notifications_added_to_channel_template, "Notifications.AddedToChannel.Sound": notifications_added_to_channel_sound, - "Notifications.RemovedFromChannel.Enabled": notifications_removed_from_channel_enabled, + "Notifications.RemovedFromChannel.Enabled": serialize.boolean_to_string( + notifications_removed_from_channel_enabled + ), "Notifications.RemovedFromChannel.Template": notifications_removed_from_channel_template, "Notifications.RemovedFromChannel.Sound": notifications_removed_from_channel_sound, - "Notifications.InvitedToChannel.Enabled": notifications_invited_to_channel_enabled, + "Notifications.InvitedToChannel.Enabled": serialize.boolean_to_string( + notifications_invited_to_channel_enabled + ), "Notifications.InvitedToChannel.Template": notifications_invited_to_channel_template, "Notifications.InvitedToChannel.Sound": notifications_invited_to_channel_sound, "PreWebhookUrl": pre_webhook_url, @@ -714,7 +740,9 @@ class ServiceContext(InstanceContext): "Media.CompatibilityMessage": media_compatibility_message, "PreWebhookRetryCount": pre_webhook_retry_count, "PostWebhookRetryCount": post_webhook_retry_count, - "Notifications.LogEnabled": notifications_log_enabled, + "Notifications.LogEnabled": serialize.boolean_to_string( + notifications_log_enabled + ), } ) diff --git a/twilio/rest/lookups/v2/phone_number.py b/twilio/rest/lookups/v2/phone_number.py index 97ef39b9407f1e0e5c9750969fd232d24691762c..57491aa0a9d8d96a8ceebf4207e6952c86cd812b 100644 --- a/twilio/rest/lookups/v2/phone_number.py +++ b/twilio/rest/lookups/v2/phone_number.py @@ -40,7 +40,7 @@ class PhoneNumberInstance(InstanceResource): :ivar caller_name: An object that contains caller name information based on [CNAM](https://support.twilio.com/hc/en-us/articles/360051670533-Getting-Started-with-CNAM-Caller-ID). :ivar sim_swap: An object that contains information on the last date the subscriber identity module (SIM) was changed for a mobile phone number. :ivar call_forwarding: An object that contains information on the unconditional call forwarding status of mobile phone number. - :ivar live_activity: An object that contains live activity information for a mobile phone number. + :ivar line_status: An object that contains line status information for a mobile phone number. :ivar line_type_intelligence: An object that contains line type information including the carrier name, mobile country code, and mobile network code. :ivar identity_match: An object that contains identity match information. The result of comparing user-provided information including name, address, date of birth, national ID, against authoritative phone-based data sources :ivar reassigned_number: An object that contains reassigned number information. Reassigned Numbers will return a phone number's reassignment status given a phone number and date @@ -70,7 +70,7 @@ class PhoneNumberInstance(InstanceResource): self.call_forwarding: Optional[Dict[str, object]] = payload.get( "call_forwarding" ) - self.live_activity: Optional[Dict[str, object]] = payload.get("live_activity") + self.line_status: Optional[Dict[str, object]] = payload.get("line_status") self.line_type_intelligence: Optional[Dict[str, object]] = payload.get( "line_type_intelligence" ) @@ -125,7 +125,7 @@ class PhoneNumberInstance(InstanceResource): """ Fetch the PhoneNumberInstance - :param fields: A comma-separated list of fields to return. Possible values are caller_name, sim_swap, call_forwarding, live_activity, line_type_intelligence, identity_match, reassigned_number. + :param fields: A comma-separated list of fields to return. Possible values are validation, caller_name, sim_swap, call_forwarding, line_status, line_type_intelligence, identity_match, reassigned_number, sms_pumping_risk, phone_number_quality_score. :param country_code: The [country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) used if the phone number provided is in national format. :param first_name: User’s first name. This query parameter is only used (optionally) for identity_match package requests. :param last_name: User’s last name. This query parameter is only used (optionally) for identity_match package requests. @@ -176,7 +176,7 @@ class PhoneNumberInstance(InstanceResource): """ Asynchronous coroutine to fetch the PhoneNumberInstance - :param fields: A comma-separated list of fields to return. Possible values are caller_name, sim_swap, call_forwarding, live_activity, line_type_intelligence, identity_match, reassigned_number. + :param fields: A comma-separated list of fields to return. Possible values are validation, caller_name, sim_swap, call_forwarding, line_status, line_type_intelligence, identity_match, reassigned_number, sms_pumping_risk, phone_number_quality_score. :param country_code: The [country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) used if the phone number provided is in national format. :param first_name: User’s first name. This query parameter is only used (optionally) for identity_match package requests. :param last_name: User’s last name. This query parameter is only used (optionally) for identity_match package requests. @@ -254,7 +254,7 @@ class PhoneNumberContext(InstanceContext): """ Fetch the PhoneNumberInstance - :param fields: A comma-separated list of fields to return. Possible values are caller_name, sim_swap, call_forwarding, live_activity, line_type_intelligence, identity_match, reassigned_number. + :param fields: A comma-separated list of fields to return. Possible values are validation, caller_name, sim_swap, call_forwarding, line_status, line_type_intelligence, identity_match, reassigned_number, sms_pumping_risk, phone_number_quality_score. :param country_code: The [country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) used if the phone number provided is in national format. :param first_name: User’s first name. This query parameter is only used (optionally) for identity_match package requests. :param last_name: User’s last name. This query parameter is only used (optionally) for identity_match package requests. @@ -316,7 +316,7 @@ class PhoneNumberContext(InstanceContext): """ Asynchronous coroutine to fetch the PhoneNumberInstance - :param fields: A comma-separated list of fields to return. Possible values are caller_name, sim_swap, call_forwarding, live_activity, line_type_intelligence, identity_match, reassigned_number. + :param fields: A comma-separated list of fields to return. Possible values are validation, caller_name, sim_swap, call_forwarding, line_status, line_type_intelligence, identity_match, reassigned_number, sms_pumping_risk, phone_number_quality_score. :param country_code: The [country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) used if the phone number provided is in national format. :param first_name: User’s first name. This query parameter is only used (optionally) for identity_match package requests. :param last_name: User’s last name. This query parameter is only used (optionally) for identity_match package requests. diff --git a/twilio/rest/media/v1/player_streamer/__init__.py b/twilio/rest/media/v1/player_streamer/__init__.py index 6ea0889fc38e99be21e5d54a5c5828bdff1f80cc..86832ba99037a8d51fba0c584dcf3698120b0ecf 100644 --- a/twilio/rest/media/v1/player_streamer/__init__.py +++ b/twilio/rest/media/v1/player_streamer/__init__.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -349,7 +349,7 @@ class PlayerStreamerList(ListResource): data = values.of( { - "Video": video, + "Video": serialize.boolean_to_string(video), "StatusCallback": status_callback, "StatusCallbackMethod": status_callback_method, "MaxDuration": max_duration, @@ -384,7 +384,7 @@ class PlayerStreamerList(ListResource): data = values.of( { - "Video": video, + "Video": serialize.boolean_to_string(video), "StatusCallback": status_callback, "StatusCallbackMethod": status_callback_method, "MaxDuration": max_duration, diff --git a/twilio/rest/messaging/v1/brand_registration/__init__.py b/twilio/rest/messaging/v1/brand_registration/__init__.py index 5c6dbc82465f9a3c57dd4e95a1172f8d651b0e41..b02af9491978aea9aa77267e174092e0c63f8c0b 100644 --- a/twilio/rest/messaging/v1/brand_registration/__init__.py +++ b/twilio/rest/messaging/v1/brand_registration/__init__.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -58,10 +58,11 @@ class BrandRegistrationInstance(InstanceResource): :ivar brand_type: Type of brand. One of: \"STANDARD\", \"SOLE_PROPRIETOR\". SOLE_PROPRIETOR is for the low volume, SOLE_PROPRIETOR campaign use case. There can only be one SOLE_PROPRIETOR campaign created per SOLE_PROPRIETOR brand. STANDARD is for all other campaign use cases. Multiple campaign use cases can be created per STANDARD brand. :ivar status: :ivar tcr_id: Campaign Registry (TCR) Brand ID. Assigned only after successful brand registration. - :ivar failure_reason: A reason why brand registration has failed. Only applicable when status is FAILED. + :ivar failure_reason: DEPRECATED. A reason why brand registration has failed. Only applicable when status is FAILED. + :ivar errors: A list of errors that occurred during the brand registration process. :ivar url: The absolute URL of the Brand Registration resource. :ivar brand_score: The secondary vetting score if it was done. Otherwise, it will be the brand score if it's returned from TCR. It may be null if no score is available. - :ivar brand_feedback: Feedback on how to improve brand score + :ivar brand_feedback: DEPRECATED. Feedback on how to improve brand score :ivar identity_status: :ivar russell_3000: Publicly traded company identified in the Russell 3000 Index :ivar government_entity: Identified as a government entity @@ -96,6 +97,7 @@ class BrandRegistrationInstance(InstanceResource): ) self.tcr_id: Optional[str] = payload.get("tcr_id") self.failure_reason: Optional[str] = payload.get("failure_reason") + self.errors: Optional[List[Dict[str, object]]] = payload.get("errors") self.url: Optional[str] = payload.get("url") self.brand_score: Optional[int] = deserialize.integer( payload.get("brand_score") @@ -382,8 +384,10 @@ class BrandRegistrationList(ListResource): "CustomerProfileBundleSid": customer_profile_bundle_sid, "A2PProfileBundleSid": a2p_profile_bundle_sid, "BrandType": brand_type, - "Mock": mock, - "SkipAutomaticSecVet": skip_automatic_sec_vet, + "Mock": serialize.boolean_to_string(mock), + "SkipAutomaticSecVet": serialize.boolean_to_string( + skip_automatic_sec_vet + ), } ) @@ -420,8 +424,10 @@ class BrandRegistrationList(ListResource): "CustomerProfileBundleSid": customer_profile_bundle_sid, "A2PProfileBundleSid": a2p_profile_bundle_sid, "BrandType": brand_type, - "Mock": mock, - "SkipAutomaticSecVet": skip_automatic_sec_vet, + "Mock": serialize.boolean_to_string(mock), + "SkipAutomaticSecVet": serialize.boolean_to_string( + skip_automatic_sec_vet + ), } ) diff --git a/twilio/rest/messaging/v1/domain_config.py b/twilio/rest/messaging/v1/domain_config.py index 4889827a605322f141cc0785c30409c79e511dc5..25d69342d0fcf650af59182033d100e13a7deda7 100644 --- a/twilio/rest/messaging/v1/domain_config.py +++ b/twilio/rest/messaging/v1/domain_config.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, Optional, Union -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -230,8 +230,8 @@ class DomainConfigContext(InstanceContext): { "FallbackUrl": fallback_url, "CallbackUrl": callback_url, - "ContinueOnFailure": continue_on_failure, - "DisableHttps": disable_https, + "ContinueOnFailure": serialize.boolean_to_string(continue_on_failure), + "DisableHttps": serialize.boolean_to_string(disable_https), } ) @@ -266,8 +266,8 @@ class DomainConfigContext(InstanceContext): { "FallbackUrl": fallback_url, "CallbackUrl": callback_url, - "ContinueOnFailure": continue_on_failure, - "DisableHttps": disable_https, + "ContinueOnFailure": serialize.boolean_to_string(continue_on_failure), + "DisableHttps": serialize.boolean_to_string(disable_https), } ) diff --git a/twilio/rest/messaging/v1/service/__init__.py b/twilio/rest/messaging/v1/service/__init__.py index 3695b744f7c96bdd2264aea8599c55b5b38e0e88..75c798f4c4b10bd65ab3e641365ff80714dfddbe 100644 --- a/twilio/rest/messaging/v1/service/__init__.py +++ b/twilio/rest/messaging/v1/service/__init__.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -477,16 +477,22 @@ class ServiceContext(InstanceContext): "FallbackUrl": fallback_url, "FallbackMethod": fallback_method, "StatusCallback": status_callback, - "StickySender": sticky_sender, - "MmsConverter": mms_converter, - "SmartEncoding": smart_encoding, + "StickySender": serialize.boolean_to_string(sticky_sender), + "MmsConverter": serialize.boolean_to_string(mms_converter), + "SmartEncoding": serialize.boolean_to_string(smart_encoding), "ScanMessageContent": scan_message_content, - "FallbackToLongCode": fallback_to_long_code, - "AreaCodeGeomatch": area_code_geomatch, + "FallbackToLongCode": serialize.boolean_to_string( + fallback_to_long_code + ), + "AreaCodeGeomatch": serialize.boolean_to_string(area_code_geomatch), "ValidityPeriod": validity_period, - "SynchronousValidation": synchronous_validation, + "SynchronousValidation": serialize.boolean_to_string( + synchronous_validation + ), "Usecase": usecase, - "UseInboundWebhookOnNumber": use_inbound_webhook_on_number, + "UseInboundWebhookOnNumber": serialize.boolean_to_string( + use_inbound_webhook_on_number + ), } ) @@ -549,16 +555,22 @@ class ServiceContext(InstanceContext): "FallbackUrl": fallback_url, "FallbackMethod": fallback_method, "StatusCallback": status_callback, - "StickySender": sticky_sender, - "MmsConverter": mms_converter, - "SmartEncoding": smart_encoding, + "StickySender": serialize.boolean_to_string(sticky_sender), + "MmsConverter": serialize.boolean_to_string(mms_converter), + "SmartEncoding": serialize.boolean_to_string(smart_encoding), "ScanMessageContent": scan_message_content, - "FallbackToLongCode": fallback_to_long_code, - "AreaCodeGeomatch": area_code_geomatch, + "FallbackToLongCode": serialize.boolean_to_string( + fallback_to_long_code + ), + "AreaCodeGeomatch": serialize.boolean_to_string(area_code_geomatch), "ValidityPeriod": validity_period, - "SynchronousValidation": synchronous_validation, + "SynchronousValidation": serialize.boolean_to_string( + synchronous_validation + ), "Usecase": usecase, - "UseInboundWebhookOnNumber": use_inbound_webhook_on_number, + "UseInboundWebhookOnNumber": serialize.boolean_to_string( + use_inbound_webhook_on_number + ), } ) @@ -736,16 +748,22 @@ class ServiceList(ListResource): "FallbackUrl": fallback_url, "FallbackMethod": fallback_method, "StatusCallback": status_callback, - "StickySender": sticky_sender, - "MmsConverter": mms_converter, - "SmartEncoding": smart_encoding, + "StickySender": serialize.boolean_to_string(sticky_sender), + "MmsConverter": serialize.boolean_to_string(mms_converter), + "SmartEncoding": serialize.boolean_to_string(smart_encoding), "ScanMessageContent": scan_message_content, - "FallbackToLongCode": fallback_to_long_code, - "AreaCodeGeomatch": area_code_geomatch, + "FallbackToLongCode": serialize.boolean_to_string( + fallback_to_long_code + ), + "AreaCodeGeomatch": serialize.boolean_to_string(area_code_geomatch), "ValidityPeriod": validity_period, - "SynchronousValidation": synchronous_validation, + "SynchronousValidation": serialize.boolean_to_string( + synchronous_validation + ), "Usecase": usecase, - "UseInboundWebhookOnNumber": use_inbound_webhook_on_number, + "UseInboundWebhookOnNumber": serialize.boolean_to_string( + use_inbound_webhook_on_number + ), } ) @@ -809,16 +827,22 @@ class ServiceList(ListResource): "FallbackUrl": fallback_url, "FallbackMethod": fallback_method, "StatusCallback": status_callback, - "StickySender": sticky_sender, - "MmsConverter": mms_converter, - "SmartEncoding": smart_encoding, + "StickySender": serialize.boolean_to_string(sticky_sender), + "MmsConverter": serialize.boolean_to_string(mms_converter), + "SmartEncoding": serialize.boolean_to_string(smart_encoding), "ScanMessageContent": scan_message_content, - "FallbackToLongCode": fallback_to_long_code, - "AreaCodeGeomatch": area_code_geomatch, + "FallbackToLongCode": serialize.boolean_to_string( + fallback_to_long_code + ), + "AreaCodeGeomatch": serialize.boolean_to_string(area_code_geomatch), "ValidityPeriod": validity_period, - "SynchronousValidation": synchronous_validation, + "SynchronousValidation": serialize.boolean_to_string( + synchronous_validation + ), "Usecase": usecase, - "UseInboundWebhookOnNumber": use_inbound_webhook_on_number, + "UseInboundWebhookOnNumber": serialize.boolean_to_string( + use_inbound_webhook_on_number + ), } ) 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 cc23f0caf5e29789d4ebe2ffda38716415497b13..9034e4e2eb2da7ddea6ffd1829d84936dab2315a 100644 --- a/twilio/rest/messaging/v1/service/us_app_to_person.py +++ b/twilio/rest/messaging/v1/service/us_app_to_person.py @@ -346,13 +346,13 @@ class UsAppToPersonContext(InstanceContext): """ data = values.of( { - "HasEmbeddedLinks": has_embedded_links, - "HasEmbeddedPhone": has_embedded_phone, + "HasEmbeddedLinks": serialize.boolean_to_string(has_embedded_links), + "HasEmbeddedPhone": serialize.boolean_to_string(has_embedded_phone), "MessageSamples": serialize.map(message_samples, lambda e: e), "MessageFlow": message_flow, "Description": description, - "AgeGated": age_gated, - "DirectLending": direct_lending, + "AgeGated": serialize.boolean_to_string(age_gated), + "DirectLending": serialize.boolean_to_string(direct_lending), } ) @@ -394,13 +394,13 @@ class UsAppToPersonContext(InstanceContext): """ data = values.of( { - "HasEmbeddedLinks": has_embedded_links, - "HasEmbeddedPhone": has_embedded_phone, + "HasEmbeddedLinks": serialize.boolean_to_string(has_embedded_links), + "HasEmbeddedPhone": serialize.boolean_to_string(has_embedded_phone), "MessageSamples": serialize.map(message_samples, lambda e: e), "MessageFlow": message_flow, "Description": description, - "AgeGated": age_gated, - "DirectLending": direct_lending, + "AgeGated": serialize.boolean_to_string(age_gated), + "DirectLending": serialize.boolean_to_string(direct_lending), } ) @@ -519,17 +519,17 @@ class UsAppToPersonList(ListResource): "MessageFlow": message_flow, "MessageSamples": serialize.map(message_samples, lambda e: e), "UsAppToPersonUsecase": us_app_to_person_usecase, - "HasEmbeddedLinks": has_embedded_links, - "HasEmbeddedPhone": has_embedded_phone, + "HasEmbeddedLinks": serialize.boolean_to_string(has_embedded_links), + "HasEmbeddedPhone": serialize.boolean_to_string(has_embedded_phone), "OptInMessage": opt_in_message, "OptOutMessage": opt_out_message, "HelpMessage": help_message, "OptInKeywords": serialize.map(opt_in_keywords, lambda e: e), "OptOutKeywords": serialize.map(opt_out_keywords, lambda e: e), "HelpKeywords": serialize.map(help_keywords, lambda e: e), - "SubscriberOptIn": subscriber_opt_in, - "AgeGated": age_gated, - "DirectLending": direct_lending, + "SubscriberOptIn": serialize.boolean_to_string(subscriber_opt_in), + "AgeGated": serialize.boolean_to_string(age_gated), + "DirectLending": serialize.boolean_to_string(direct_lending), } ) @@ -594,17 +594,17 @@ class UsAppToPersonList(ListResource): "MessageFlow": message_flow, "MessageSamples": serialize.map(message_samples, lambda e: e), "UsAppToPersonUsecase": us_app_to_person_usecase, - "HasEmbeddedLinks": has_embedded_links, - "HasEmbeddedPhone": has_embedded_phone, + "HasEmbeddedLinks": serialize.boolean_to_string(has_embedded_links), + "HasEmbeddedPhone": serialize.boolean_to_string(has_embedded_phone), "OptInMessage": opt_in_message, "OptOutMessage": opt_out_message, "HelpMessage": help_message, "OptInKeywords": serialize.map(opt_in_keywords, lambda e: e), "OptOutKeywords": serialize.map(opt_out_keywords, lambda e: e), "HelpKeywords": serialize.map(help_keywords, lambda e: e), - "SubscriberOptIn": subscriber_opt_in, - "AgeGated": age_gated, - "DirectLending": direct_lending, + "SubscriberOptIn": serialize.boolean_to_string(subscriber_opt_in), + "AgeGated": serialize.boolean_to_string(age_gated), + "DirectLending": serialize.boolean_to_string(direct_lending), } ) 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 c4f513ab1bf538c83612a4d1ece1f9a52b9729a6..debcf940d9809122af7412c4d7ab8558bb3afa0d 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 @@ -85,6 +85,7 @@ class UsAppToPersonUsecaseList(ListResource): "BrandRegistrationSid": brand_registration_sid, } ) + payload = self._version.fetch(method="GET", uri=self._uri, params=params) return UsAppToPersonUsecaseInstance( @@ -108,6 +109,7 @@ class UsAppToPersonUsecaseList(ListResource): "BrandRegistrationSid": brand_registration_sid, } ) + payload = await self._version.fetch_async( method="GET", uri=self._uri, params=params ) diff --git a/twilio/rest/messaging/v1/tollfree_verification.py b/twilio/rest/messaging/v1/tollfree_verification.py index af57cfc5fc676a992807c454db382bc5473404a7..e742c5719113de4230202227ff5df14a6fe399d3 100644 --- a/twilio/rest/messaging/v1/tollfree_verification.py +++ b/twilio/rest/messaging/v1/tollfree_verification.py @@ -56,7 +56,7 @@ class TollfreeVerificationInstance(InstanceResource): :ivar business_contact_first_name: The first name of the contact for the business or organization using the Tollfree number. :ivar business_contact_last_name: The last name of the contact for the business or organization using the Tollfree number. :ivar business_contact_email: The email address of the contact for the business or organization using the Tollfree number. - :ivar business_contact_phone: The phone number 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_summary: Use this to further explain how messaging is used by the business or organization. @@ -72,6 +72,7 @@ class TollfreeVerificationInstance(InstanceResource): :ivar error_code: The error code given when a Tollfree Verification has been rejected. :ivar edit_expiration: The date and time when the ability to edit a rejected verification expires. :ivar edit_allowed: If a rejected verification is allowed to be edited/resubmitted. Some rejection reasons allow editing and some do not. + :ivar rejection_reasons: A list of rejection reasons and codes describing why a Tollfree Verification has been rejected. :ivar resource_links: The URLs of the documents associated with the Tollfree Verification resource. :ivar external_reference_id: An optional external reference ID supplied by customer and echoed back on status retrieval. """ @@ -147,6 +148,9 @@ class TollfreeVerificationInstance(InstanceResource): payload.get("edit_expiration") ) self.edit_allowed: Optional[bool] = payload.get("edit_allowed") + self.rejection_reasons: Optional[List[Dict[str, object]]] = payload.get( + "rejection_reasons" + ) self.resource_links: Optional[Dict[str, object]] = payload.get("resource_links") self.external_reference_id: Optional[str] = payload.get("external_reference_id") @@ -254,7 +258,7 @@ class TollfreeVerificationInstance(InstanceResource): :param business_contact_first_name: The first name of the contact for the business or organization using the Tollfree number. :param business_contact_last_name: The last name of the contact for the business or organization using the Tollfree number. :param business_contact_email: The email address of the contact for the business or organization using the Tollfree number. - :param business_contact_phone: The phone number of the contact for the business or organization using the Tollfree number. + :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'. :returns: The updated TollfreeVerificationInstance @@ -331,7 +335,7 @@ class TollfreeVerificationInstance(InstanceResource): :param business_contact_first_name: The first name of the contact for the business or organization using the Tollfree number. :param business_contact_last_name: The last name of the contact for the business or organization using the Tollfree number. :param business_contact_email: The email address of the contact for the business or organization using the Tollfree number. - :param business_contact_phone: The phone number of the contact for the business or organization using the Tollfree number. + :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'. :returns: The updated TollfreeVerificationInstance @@ -497,7 +501,7 @@ class TollfreeVerificationContext(InstanceContext): :param business_contact_first_name: The first name of the contact for the business or organization using the Tollfree number. :param business_contact_last_name: The last name of the contact for the business or organization using the Tollfree number. :param business_contact_email: The email address of the contact for the business or organization using the Tollfree number. - :param business_contact_phone: The phone number of the contact for the business or organization using the Tollfree number. + :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'. :returns: The updated TollfreeVerificationInstance @@ -586,7 +590,7 @@ class TollfreeVerificationContext(InstanceContext): :param business_contact_first_name: The first name of the contact for the business or organization using the Tollfree number. :param business_contact_last_name: The last name of the contact for the business or organization using the Tollfree number. :param business_contact_email: The email address of the contact for the business or organization using the Tollfree number. - :param business_contact_phone: The phone number of the contact for the business or organization using the Tollfree number. + :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'. :returns: The updated TollfreeVerificationInstance @@ -719,7 +723,7 @@ class TollfreeVerificationList(ListResource): :param business_contact_first_name: The first name of the contact for the business or organization using the Tollfree number. :param business_contact_last_name: The last name of the contact for the business or organization using the Tollfree number. :param business_contact_email: The email address of the contact for the business or organization using the Tollfree number. - :param business_contact_phone: The phone number of the contact for the business or organization using the Tollfree number. + :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. :returns: The created TollfreeVerificationInstance @@ -811,7 +815,7 @@ class TollfreeVerificationList(ListResource): :param business_contact_first_name: The first name of the contact for the business or organization using the Tollfree number. :param business_contact_last_name: The last name of the contact for the business or organization using the Tollfree number. :param business_contact_email: The email address of the contact for the business or organization using the Tollfree number. - :param business_contact_phone: The phone number of the contact for the business or organization using the Tollfree number. + :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. :returns: The created TollfreeVerificationInstance diff --git a/twilio/rest/microvisor/v1/device/__init__.py b/twilio/rest/microvisor/v1/device/__init__.py index 56904ee1f70addf8edaa1cdc2ffdfcdfbd601f4a..42a17340f63e42c4b19047e0b6d4f10064ae0761 100644 --- a/twilio/rest/microvisor/v1/device/__init__.py +++ b/twilio/rest/microvisor/v1/device/__init__.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -245,8 +245,8 @@ class DeviceContext(InstanceContext): { "UniqueName": unique_name, "TargetApp": target_app, - "LoggingEnabled": logging_enabled, - "RestartApp": restart_app, + "LoggingEnabled": serialize.boolean_to_string(logging_enabled), + "RestartApp": serialize.boolean_to_string(restart_app), } ) @@ -279,8 +279,8 @@ class DeviceContext(InstanceContext): { "UniqueName": unique_name, "TargetApp": target_app, - "LoggingEnabled": logging_enabled, - "RestartApp": restart_app, + "LoggingEnabled": serialize.boolean_to_string(logging_enabled), + "RestartApp": serialize.boolean_to_string(restart_app), } ) diff --git a/twilio/rest/notify/v1/credential.py b/twilio/rest/notify/v1/credential.py index 3dd6380ceec2c73a4783af4554bd6dba46242379..5cb86363a32ebb90006b7852f44d37db04e06531 100644 --- a/twilio/rest/notify/v1/credential.py +++ b/twilio/rest/notify/v1/credential.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -289,7 +289,7 @@ class CredentialContext(InstanceContext): "FriendlyName": friendly_name, "Certificate": certificate, "PrivateKey": private_key, - "Sandbox": sandbox, + "Sandbox": serialize.boolean_to_string(sandbox), "ApiKey": api_key, "Secret": secret, } @@ -329,7 +329,7 @@ class CredentialContext(InstanceContext): "FriendlyName": friendly_name, "Certificate": certificate, "PrivateKey": private_key, - "Sandbox": sandbox, + "Sandbox": serialize.boolean_to_string(sandbox), "ApiKey": api_key, "Secret": secret, } @@ -415,7 +415,7 @@ class CredentialList(ListResource): "FriendlyName": friendly_name, "Certificate": certificate, "PrivateKey": private_key, - "Sandbox": sandbox, + "Sandbox": serialize.boolean_to_string(sandbox), "ApiKey": api_key, "Secret": secret, } @@ -459,7 +459,7 @@ class CredentialList(ListResource): "FriendlyName": friendly_name, "Certificate": certificate, "PrivateKey": private_key, - "Sandbox": sandbox, + "Sandbox": serialize.boolean_to_string(sandbox), "ApiKey": api_key, "Secret": secret, } diff --git a/twilio/rest/notify/v1/service/__init__.py b/twilio/rest/notify/v1/service/__init__.py index 912d6ba9cd4e3cd0f3d262c7e7e1f02bccc57df2..0cd9adb6856924e58f3ace1bdea3bc6225507096 100644 --- a/twilio/rest/notify/v1/service/__init__.py +++ b/twilio/rest/notify/v1/service/__init__.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -408,11 +408,13 @@ class ServiceContext(InstanceContext): "DefaultGcmNotificationProtocolVersion": default_gcm_notification_protocol_version, "FcmCredentialSid": fcm_credential_sid, "DefaultFcmNotificationProtocolVersion": default_fcm_notification_protocol_version, - "LogEnabled": log_enabled, + "LogEnabled": serialize.boolean_to_string(log_enabled), "AlexaSkillId": alexa_skill_id, "DefaultAlexaNotificationProtocolVersion": default_alexa_notification_protocol_version, "DeliveryCallbackUrl": delivery_callback_url, - "DeliveryCallbackEnabled": delivery_callback_enabled, + "DeliveryCallbackEnabled": serialize.boolean_to_string( + delivery_callback_enabled + ), } ) @@ -472,11 +474,13 @@ class ServiceContext(InstanceContext): "DefaultGcmNotificationProtocolVersion": default_gcm_notification_protocol_version, "FcmCredentialSid": fcm_credential_sid, "DefaultFcmNotificationProtocolVersion": default_fcm_notification_protocol_version, - "LogEnabled": log_enabled, + "LogEnabled": serialize.boolean_to_string(log_enabled), "AlexaSkillId": alexa_skill_id, "DefaultAlexaNotificationProtocolVersion": default_alexa_notification_protocol_version, "DeliveryCallbackUrl": delivery_callback_url, - "DeliveryCallbackEnabled": delivery_callback_enabled, + "DeliveryCallbackEnabled": serialize.boolean_to_string( + delivery_callback_enabled + ), } ) @@ -603,11 +607,13 @@ class ServiceList(ListResource): "DefaultGcmNotificationProtocolVersion": default_gcm_notification_protocol_version, "FcmCredentialSid": fcm_credential_sid, "DefaultFcmNotificationProtocolVersion": default_fcm_notification_protocol_version, - "LogEnabled": log_enabled, + "LogEnabled": serialize.boolean_to_string(log_enabled), "AlexaSkillId": alexa_skill_id, "DefaultAlexaNotificationProtocolVersion": default_alexa_notification_protocol_version, "DeliveryCallbackUrl": delivery_callback_url, - "DeliveryCallbackEnabled": delivery_callback_enabled, + "DeliveryCallbackEnabled": serialize.boolean_to_string( + delivery_callback_enabled + ), } ) @@ -668,11 +674,13 @@ class ServiceList(ListResource): "DefaultGcmNotificationProtocolVersion": default_gcm_notification_protocol_version, "FcmCredentialSid": fcm_credential_sid, "DefaultFcmNotificationProtocolVersion": default_fcm_notification_protocol_version, - "LogEnabled": log_enabled, + "LogEnabled": serialize.boolean_to_string(log_enabled), "AlexaSkillId": alexa_skill_id, "DefaultAlexaNotificationProtocolVersion": default_alexa_notification_protocol_version, "DeliveryCallbackUrl": delivery_callback_url, - "DeliveryCallbackEnabled": delivery_callback_enabled, + "DeliveryCallbackEnabled": serialize.boolean_to_string( + delivery_callback_enabled + ), } ) diff --git a/twilio/rest/numbers/v1/__init__.py b/twilio/rest/numbers/v1/__init__.py index 384b0d95e3e8e3bb841602f071d45fa28b71eb23..9da80f3a3457cce3306002d94ae81548a32b19b7 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -16,7 +16,9 @@ from typing import Optional from twilio.base.version import Version from twilio.base.domain import Domain from twilio.rest.numbers.v1.bulk_eligibility import BulkEligibilityList +from twilio.rest.numbers.v1.eligibility import EligibilityList from twilio.rest.numbers.v1.porting_bulk_portability import PortingBulkPortabilityList +from twilio.rest.numbers.v1.porting_port_in import PortingPortInList from twilio.rest.numbers.v1.porting_port_in_fetch import PortingPortInFetchList from twilio.rest.numbers.v1.porting_portability import PortingPortabilityList @@ -31,8 +33,10 @@ class V1(Version): """ super().__init__(domain, "v1") self._bulk_eligibilities: Optional[BulkEligibilityList] = None + self._eligibilities: Optional[EligibilityList] = None self._porting_bulk_portabilities: Optional[PortingBulkPortabilityList] = None - self._porting_port_ins: Optional[PortingPortInFetchList] = None + self._porting_port_ins: Optional[PortingPortInList] = None + self._porting_port_ins_fetch: Optional[PortingPortInFetchList] = None self._porting_portabilities: Optional[PortingPortabilityList] = None @property @@ -41,6 +45,12 @@ class V1(Version): self._bulk_eligibilities = BulkEligibilityList(self) return self._bulk_eligibilities + @property + def eligibilities(self) -> EligibilityList: + if self._eligibilities is None: + self._eligibilities = EligibilityList(self) + return self._eligibilities + @property def porting_bulk_portabilities(self) -> PortingBulkPortabilityList: if self._porting_bulk_portabilities is None: @@ -48,11 +58,17 @@ class V1(Version): return self._porting_bulk_portabilities @property - def porting_port_ins(self) -> PortingPortInFetchList: + def porting_port_ins(self) -> PortingPortInList: if self._porting_port_ins is None: - self._porting_port_ins = PortingPortInFetchList(self) + self._porting_port_ins = PortingPortInList(self) return self._porting_port_ins + @property + def porting_port_ins_fetch(self) -> PortingPortInFetchList: + if self._porting_port_ins_fetch is None: + self._porting_port_ins_fetch = PortingPortInFetchList(self) + return self._porting_port_ins_fetch + @property def porting_portabilities(self) -> PortingPortabilityList: if self._porting_portabilities is None: diff --git a/twilio/rest/numbers/v1/bulk_eligibility.py b/twilio/rest/numbers/v1/bulk_eligibility.py index 64be314b44116e62c0a6c80baeb69d6c587e56e5..3915116416e35838f1073d7bc26c396cf48ebd69 100644 --- a/twilio/rest/numbers/v1/bulk_eligibility.py +++ b/twilio/rest/numbers/v1/bulk_eligibility.py @@ -13,8 +13,8 @@ r""" """ from datetime import datetime -from typing import Any, Dict, List, Optional -from twilio.base import deserialize +from typing import Any, Dict, List, Optional, Union +from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -178,6 +178,47 @@ class BulkEligibilityList(ListResource): """ super().__init__(version) + self._uri = "/HostedNumber/Eligibility/Bulk" + + def create( + self, body: Union[object, object] = values.unset + ) -> BulkEligibilityInstance: + """ + Create the BulkEligibilityInstance + + :param body: + + :returns: The created BulkEligibilityInstance + """ + data = body.to_dict() + + headers = {"Content-Type": "application/json"} + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return BulkEligibilityInstance(self._version, payload) + + async def create_async( + self, body: Union[object, object] = values.unset + ) -> BulkEligibilityInstance: + """ + Asynchronously create the BulkEligibilityInstance + + :param body: + + :returns: The created BulkEligibilityInstance + """ + + data = body.to_dict() + headers = {"Content-Type": "application/json"} + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return BulkEligibilityInstance(self._version, payload) + def get(self, request_id: str) -> BulkEligibilityContext: """ Constructs a BulkEligibilityContext diff --git a/twilio/rest/numbers/v1/eligibility.py b/twilio/rest/numbers/v1/eligibility.py new file mode 100644 index 0000000000000000000000000000000000000000..3b8b5be345dfa1b75deec0b02f6d33c41be7fdec --- /dev/null +++ b/twilio/rest/numbers/v1/eligibility.py @@ -0,0 +1,99 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Numbers + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from typing import Any, Dict, List, Optional, Union +from twilio.base import values + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class 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. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.results: Optional[List[Dict[str, object]]] = payload.get("results") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "<Twilio.Numbers.V1.EligibilityInstance>" + + +class EligibilityList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the EligibilityList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/HostedNumber/Eligibility" + + def create(self, body: Union[object, object] = values.unset) -> EligibilityInstance: + """ + Create the EligibilityInstance + + :param body: + + :returns: The created EligibilityInstance + """ + data = body.to_dict() + + headers = {"Content-Type": "application/json"} + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return EligibilityInstance(self._version, payload) + + async def create_async( + self, body: Union[object, object] = values.unset + ) -> EligibilityInstance: + """ + Asynchronously create the EligibilityInstance + + :param body: + + :returns: The created EligibilityInstance + """ + + data = body.to_dict() + headers = {"Content-Type": "application/json"} + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return EligibilityInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "<Twilio.Numbers.V1.EligibilityList>" diff --git a/twilio/rest/numbers/v1/porting_port_in.py b/twilio/rest/numbers/v1/porting_port_in.py new file mode 100644 index 0000000000000000000000000000000000000000..b0cd0fdfc1cd6a59c9fa50b13e9bd7946c27cdab --- /dev/null +++ b/twilio/rest/numbers/v1/porting_port_in.py @@ -0,0 +1,103 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Numbers + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from typing import Any, Dict, Optional, Union +from twilio.base import values + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class PortingPortInInstance(InstanceResource): + """ + :ivar port_in_request_sid: The SID of the Port In request. This is a unique identifier of the port in request. + :ivar url: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.port_in_request_sid: Optional[str] = payload.get("port_in_request_sid") + self.url: Optional[str] = payload.get("url") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "<Twilio.Numbers.V1.PortingPortInInstance>" + + +class PortingPortInList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the PortingPortInList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Porting/PortIn" + + def create( + self, body: Union[object, object] = values.unset + ) -> PortingPortInInstance: + """ + Create the PortingPortInInstance + + :param body: + + :returns: The created PortingPortInInstance + """ + data = body.to_dict() + + headers = {"Content-Type": "application/json"} + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return PortingPortInInstance(self._version, payload) + + async def create_async( + self, body: Union[object, object] = values.unset + ) -> PortingPortInInstance: + """ + Asynchronously create the PortingPortInInstance + + :param body: + + :returns: The created PortingPortInInstance + """ + + data = body.to_dict() + headers = {"Content-Type": "application/json"} + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return PortingPortInInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "<Twilio.Numbers.V1.PortingPortInList>" diff --git a/twilio/rest/numbers/v2/bulk_hosted_number_order.py b/twilio/rest/numbers/v2/bulk_hosted_number_order.py index 31f95814f0dde8756d63382b6c34561faadbf95a..0e75a5067b942b36af27eae5f5aec422b05716fd 100644 --- a/twilio/rest/numbers/v2/bulk_hosted_number_order.py +++ b/twilio/rest/numbers/v2/bulk_hosted_number_order.py @@ -216,6 +216,47 @@ class BulkHostedNumberOrderList(ListResource): """ super().__init__(version) + self._uri = "/HostedNumber/Orders/Bulk" + + def create( + self, body: Union[object, object] = values.unset + ) -> BulkHostedNumberOrderInstance: + """ + Create the BulkHostedNumberOrderInstance + + :param body: + + :returns: The created BulkHostedNumberOrderInstance + """ + data = body.to_dict() + + headers = {"Content-Type": "application/json"} + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return BulkHostedNumberOrderInstance(self._version, payload) + + async def create_async( + self, body: Union[object, object] = values.unset + ) -> BulkHostedNumberOrderInstance: + """ + Asynchronously create the BulkHostedNumberOrderInstance + + :param body: + + :returns: The created BulkHostedNumberOrderInstance + """ + + data = body.to_dict() + headers = {"Content-Type": "application/json"} + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return BulkHostedNumberOrderInstance(self._version, payload) + def get(self, bulk_hosting_sid: str) -> BulkHostedNumberOrderContext: """ Constructs a BulkHostedNumberOrderContext diff --git a/twilio/rest/numbers/v2/hosted_number_order.py b/twilio/rest/numbers/v2/hosted_number_order.py index c20fc517c816666f0056359d5a5e47fa468cfcfc..2063e7a87d256d9ff5bb14be1e331e3585ffda57 100644 --- a/twilio/rest/numbers/v2/hosted_number_order.py +++ b/twilio/rest/numbers/v2/hosted_number_order.py @@ -331,7 +331,7 @@ class HostedNumberOrderList(ListResource): "SmsUrl": sms_url, "SmsMethod": sms_method, "SmsFallbackUrl": sms_fallback_url, - "SmsCapability": sms_capability, + "SmsCapability": serialize.boolean_to_string(sms_capability), "SmsFallbackMethod": sms_fallback_method, "StatusCallbackUrl": status_callback_url, "StatusCallbackMethod": status_callback_method, @@ -402,7 +402,7 @@ class HostedNumberOrderList(ListResource): "SmsUrl": sms_url, "SmsMethod": sms_method, "SmsFallbackUrl": sms_fallback_url, - "SmsCapability": sms_capability, + "SmsCapability": serialize.boolean_to_string(sms_capability), "SmsFallbackMethod": sms_fallback_method, "StatusCallbackUrl": status_callback_url, "StatusCallbackMethod": status_callback_method, @@ -615,7 +615,7 @@ class HostedNumberOrderList(ListResource): data = values.of( { "Status": status, - "SmsCapability": sms_capability, + "SmsCapability": serialize.boolean_to_string(sms_capability), "PhoneNumber": phone_number, "IncomingPhoneNumberSid": incoming_phone_number_sid, "FriendlyName": friendly_name, @@ -657,7 +657,7 @@ class HostedNumberOrderList(ListResource): data = values.of( { "Status": status, - "SmsCapability": sms_capability, + "SmsCapability": serialize.boolean_to_string(sms_capability), "PhoneNumber": phone_number, "IncomingPhoneNumberSid": incoming_phone_number_sid, "FriendlyName": friendly_name, diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py index 5e1eec5b162cfaf2ada46b5ad28ac738ba914cd9..d37caa0fb8b6ab0e3e8bcb5d81a7d5bf6188468f 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py @@ -851,7 +851,7 @@ class BundleList(ListResource): "RegulationSid": regulation_sid, "IsoCountry": iso_country, "NumberType": number_type, - "HasValidUntilDate": has_valid_until_date, + "HasValidUntilDate": serialize.boolean_to_string(has_valid_until_date), "SortBy": sort_by, "SortDirection": sort_direction, "ValidUntilDate": serialize.iso8601_datetime(valid_until_date), @@ -911,7 +911,7 @@ class BundleList(ListResource): "RegulationSid": regulation_sid, "IsoCountry": iso_country, "NumberType": number_type, - "HasValidUntilDate": has_valid_until_date, + "HasValidUntilDate": serialize.boolean_to_string(has_valid_until_date), "SortBy": sort_by, "SortDirection": sort_direction, "ValidUntilDate": serialize.iso8601_datetime(valid_until_date), diff --git a/twilio/rest/oauth/OauthBase.py b/twilio/rest/oauth/OauthBase.py new file mode 100644 index 0000000000000000000000000000000000000000..87cbbac2488c6114d2aacf978eefac304cefe758 --- /dev/null +++ b/twilio/rest/oauth/OauthBase.py @@ -0,0 +1,44 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from typing import Optional + +from twilio.base.domain import Domain +from twilio.rest import Client +from twilio.rest.oauth.v1 import V1 + + +class OauthBase(Domain): + + def __init__(self, twilio: Client): + """ + Initialize the Oauth Domain + + :returns: Domain for Oauth + """ + super().__init__(twilio, "https://oauth.twilio.com") + self._v1: Optional[V1] = None + + @property + def v1(self) -> V1: + """ + :returns: Versions v1 of Oauth + """ + if self._v1 is None: + self._v1 = V1(self) + return self._v1 + + def __repr__(self) -> str: + """ + Provide a friendly representation + :returns: Machine friendly representation + """ + return "<Twilio.Oauth>" diff --git a/twilio/rest/oauth/v1/__init__.py b/twilio/rest/oauth/v1/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e05c7de5200bd25374d594288943e5bc2c16b523 --- /dev/null +++ b/twilio/rest/oauth/v1/__init__.py @@ -0,0 +1,51 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Oauth + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from typing import Optional +from twilio.base.version import Version +from twilio.base.domain import Domain +from twilio.rest.oauth.v1.authorize import AuthorizeList +from twilio.rest.oauth.v1.token import TokenList + + +class V1(Version): + + def __init__(self, domain: Domain): + """ + Initialize the V1 version of Oauth + + :param domain: The Twilio.oauth domain + """ + super().__init__(domain, "v1") + self._authorize: Optional[AuthorizeList] = None + self._token: Optional[TokenList] = None + + @property + def authorize(self) -> AuthorizeList: + if self._authorize is None: + self._authorize = AuthorizeList(self) + return self._authorize + + @property + def token(self) -> TokenList: + if self._token is None: + self._token = TokenList(self) + return self._token + + def __repr__(self) -> str: + """ + Provide a friendly representation + :returns: Machine friendly representation + """ + return "<Twilio.Oauth.V1>" diff --git a/twilio/rest/oauth/v1/authorize.py b/twilio/rest/oauth/v1/authorize.py new file mode 100644 index 0000000000000000000000000000000000000000..9798a73f3f742f05a293ab4635c83312df444275 --- /dev/null +++ b/twilio/rest/oauth/v1/authorize.py @@ -0,0 +1,122 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Oauth + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from typing import Any, Dict, Optional, Union +from twilio.base import values + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class AuthorizeInstance(InstanceResource): + """ + :ivar redirect_to: The callback URL + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.redirect_to: Optional[str] = payload.get("redirect_to") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "<Twilio.Oauth.V1.AuthorizeInstance>" + + +class AuthorizeList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the AuthorizeList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/authorize" + + def fetch( + self, + response_type: Union[str, object] = values.unset, + client_id: Union[str, object] = values.unset, + redirect_uri: Union[str, object] = values.unset, + scope: Union[str, object] = values.unset, + state: Union[str, object] = values.unset, + ) -> AuthorizeInstance: + """ + Asynchronously fetch the AuthorizeInstance + + :param response_type: Response Type:param client_id: The Client Identifier:param redirect_uri: The url to which response will be redirected to:param scope: The scope of the access request:param state: An opaque value which can be used to maintain state between the request and callback + :returns: The fetched AuthorizeInstance + """ + + params = values.of( + { + "ResponseType": response_type, + "ClientId": client_id, + "RedirectUri": redirect_uri, + "Scope": scope, + "State": state, + } + ) + + payload = self._version.fetch(method="GET", uri=self._uri, params=params) + + return AuthorizeInstance(self._version, payload) + + async def fetch_async( + self, + response_type: Union[str, object] = values.unset, + client_id: Union[str, object] = values.unset, + redirect_uri: Union[str, object] = values.unset, + scope: Union[str, object] = values.unset, + state: Union[str, object] = values.unset, + ) -> AuthorizeInstance: + """ + Asynchronously fetch the AuthorizeInstance + + :param response_type: Response Type:param client_id: The Client Identifier:param redirect_uri: The url to which response will be redirected to:param scope: The scope of the access request:param state: An opaque value which can be used to maintain state between the request and callback + :returns: The fetched AuthorizeInstance + """ + + params = values.of( + { + "ResponseType": response_type, + "ClientId": client_id, + "RedirectUri": redirect_uri, + "Scope": scope, + "State": state, + } + ) + + payload = await self._version.fetch_async( + method="GET", uri=self._uri, params=params + ) + + return AuthorizeInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "<Twilio.Oauth.V1.AuthorizeList>" diff --git a/twilio/rest/oauth/v1/token.py b/twilio/rest/oauth/v1/token.py new file mode 100644 index 0000000000000000000000000000000000000000..eb6d9d1b74acc5e59e9ece9acaf5eef07bb9f817 --- /dev/null +++ b/twilio/rest/oauth/v1/token.py @@ -0,0 +1,155 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Oauth + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from datetime import datetime +from typing import Any, Dict, Optional, Union +from twilio.base import deserialize, values + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class TokenInstance(InstanceResource): + """ + :ivar access_token: Token which carries the necessary information to access a Twilio resource directly. + :ivar refresh_token: Token which carries the information necessary to get a new access token. + :ivar id_token: Token which carries the information necessary of user profile. + :ivar token_type: Token type + :ivar expires_in: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.access_token: Optional[str] = payload.get("access_token") + self.refresh_token: Optional[str] = payload.get("refresh_token") + self.id_token: Optional[str] = payload.get("id_token") + self.token_type: Optional[str] = payload.get("token_type") + self.expires_in: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("expires_in") + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "<Twilio.Oauth.V1.TokenInstance>" + + +class TokenList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the TokenList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/token" + + def create( + self, + grant_type: str, + client_id: str, + client_secret: str, + code: Union[str, object] = values.unset, + redirect_uri: Union[str, object] = values.unset, + audience: Union[str, object] = values.unset, + ) -> TokenInstance: + """ + Create the TokenInstance + + :param grant_type: Grant type is a credential representing resource owner's authorization which can be used by client to obtain access token. + :param client_id: A 34 character string that uniquely identifies this OAuth App. + :param client_secret: The credential for confidential OAuth App. + :param code: JWT token related to the authorization code grant type. + :param redirect_uri: The redirect uri + :param audience: The targeted audience uri + + :returns: The created TokenInstance + """ + + data = values.of( + { + "GrantType": grant_type, + "ClientId": client_id, + "ClientSecret": client_secret, + "Code": code, + "RedirectUri": redirect_uri, + "Audience": audience, + } + ) + + payload = self._version.create( + method="POST", + uri=self._uri, + data=data, + ) + + return TokenInstance(self._version, payload) + + async def create_async( + self, + grant_type: str, + client_id: str, + client_secret: str, + code: Union[str, object] = values.unset, + redirect_uri: Union[str, object] = values.unset, + audience: Union[str, object] = values.unset, + ) -> TokenInstance: + """ + Asynchronously create the TokenInstance + + :param grant_type: Grant type is a credential representing resource owner's authorization which can be used by client to obtain access token. + :param client_id: A 34 character string that uniquely identifies this OAuth App. + :param client_secret: The credential for confidential OAuth App. + :param code: JWT token related to the authorization code grant type. + :param redirect_uri: The redirect uri + :param audience: The targeted audience uri + + :returns: The created TokenInstance + """ + + data = values.of( + { + "GrantType": grant_type, + "ClientId": client_id, + "ClientSecret": client_secret, + "Code": code, + "RedirectUri": redirect_uri, + "Audience": audience, + } + ) + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + data=data, + ) + + return TokenInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "<Twilio.Oauth.V1.TokenList>" diff --git a/twilio/rest/preview/__init__.py b/twilio/rest/preview/__init__.py index 6933f3627ce8b94b15dccc9c43b25839129fae33..79d870e134b13bf83a3e8c6862c473855bb3590b 100644 --- a/twilio/rest/preview/__init__.py +++ b/twilio/rest/preview/__init__.py @@ -9,7 +9,6 @@ from twilio.rest.preview.hosted_numbers.hosted_number_order import HostedNumberO from twilio.rest.preview.marketplace.available_add_on import AvailableAddOnList from twilio.rest.preview.marketplace.installed_add_on import InstalledAddOnList from twilio.rest.preview.sync.service import ServiceList -from twilio.rest.preview.understand.assistant import AssistantList from twilio.rest.preview.wireless.command import CommandList from twilio.rest.preview.wireless.rate_plan import RatePlanList from twilio.rest.preview.wireless.sim import SimList @@ -70,15 +69,6 @@ class Preview(PreviewBase): ) return self.sync.services - @property - def assistants(self) -> AssistantList: - warn( - "assistants is deprecated. Use understand.assistants instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.understand.assistants - @property def commands(self) -> CommandList: warn( diff --git a/twilio/rest/preview/deployed_devices/fleet/device.py b/twilio/rest/preview/deployed_devices/fleet/device.py index 8f20074915759c5ac337f186f5fdd616167bb3b2..7e9b81814086f03d364f537a4e0ca93f47431c8e 100644 --- a/twilio/rest/preview/deployed_devices/fleet/device.py +++ b/twilio/rest/preview/deployed_devices/fleet/device.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -287,7 +287,7 @@ class DeviceContext(InstanceContext): "FriendlyName": friendly_name, "Identity": identity, "DeploymentSid": deployment_sid, - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), } ) @@ -326,7 +326,7 @@ class DeviceContext(InstanceContext): "FriendlyName": friendly_name, "Identity": identity, "DeploymentSid": deployment_sid, - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), } ) @@ -418,7 +418,7 @@ class DeviceList(ListResource): "FriendlyName": friendly_name, "Identity": identity, "DeploymentSid": deployment_sid, - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), } ) @@ -458,7 +458,7 @@ class DeviceList(ListResource): "FriendlyName": friendly_name, "Identity": identity, "DeploymentSid": deployment_sid, - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), } ) diff --git a/twilio/rest/preview/hosted_numbers/hosted_number_order.py b/twilio/rest/preview/hosted_numbers/hosted_number_order.py index 70b9f309babfd699233ed039afc67116e3b1f60e..7e68f57b56586b3b4bc0012cf3da217ba2032186 100644 --- a/twilio/rest/preview/hosted_numbers/hosted_number_order.py +++ b/twilio/rest/preview/hosted_numbers/hosted_number_order.py @@ -550,7 +550,7 @@ class HostedNumberOrderList(ListResource): data = values.of( { "PhoneNumber": phone_number, - "SmsCapability": sms_capability, + "SmsCapability": serialize.boolean_to_string(sms_capability), "AccountSid": account_sid, "FriendlyName": friendly_name, "UniqueName": unique_name, @@ -626,7 +626,7 @@ class HostedNumberOrderList(ListResource): data = values.of( { "PhoneNumber": phone_number, - "SmsCapability": sms_capability, + "SmsCapability": serialize.boolean_to_string(sms_capability), "AccountSid": account_sid, "FriendlyName": friendly_name, "UniqueName": unique_name, diff --git a/twilio/rest/preview/marketplace/installed_add_on/__init__.py b/twilio/rest/preview/marketplace/installed_add_on/__init__.py index 5a0530aef46a40c5cb3ef1fb9727d111448d6064..d067f9fe79bee21353e84ba60feb2a64c65092a5 100644 --- a/twilio/rest/preview/marketplace/installed_add_on/__init__.py +++ b/twilio/rest/preview/marketplace/installed_add_on/__init__.py @@ -380,7 +380,9 @@ class InstalledAddOnList(ListResource): data = values.of( { "AvailableAddOnSid": available_add_on_sid, - "AcceptTermsOfService": accept_terms_of_service, + "AcceptTermsOfService": serialize.boolean_to_string( + accept_terms_of_service + ), "Configuration": serialize.object(configuration), "UniqueName": unique_name, } @@ -415,7 +417,9 @@ class InstalledAddOnList(ListResource): data = values.of( { "AvailableAddOnSid": available_add_on_sid, - "AcceptTermsOfService": accept_terms_of_service, + "AcceptTermsOfService": serialize.boolean_to_string( + accept_terms_of_service + ), "Configuration": serialize.object(configuration), "UniqueName": unique_name, } 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 a6002fa0d19059c3615c020b54c8258a8724aba2..f8e65d12c1f0af3c67e87293cde633462475ab21 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 @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import values +from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -196,7 +196,7 @@ class InstalledAddOnExtensionContext(InstanceContext): """ data = values.of( { - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), } ) @@ -223,7 +223,7 @@ class InstalledAddOnExtensionContext(InstanceContext): """ data = values.of( { - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), } ) diff --git a/twilio/rest/preview/sync/service/__init__.py b/twilio/rest/preview/sync/service/__init__.py index e270895fbfe26f256e3c5e7f80fb5b55f5ba8d38..cb8cdf7910857dbb5def2b10d61381eaa74d88d5 100644 --- a/twilio/rest/preview/sync/service/__init__.py +++ b/twilio/rest/preview/sync/service/__init__.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -300,8 +300,10 @@ class ServiceContext(InstanceContext): { "WebhookUrl": webhook_url, "FriendlyName": friendly_name, - "ReachabilityWebhooksEnabled": reachability_webhooks_enabled, - "AclEnabled": acl_enabled, + "ReachabilityWebhooksEnabled": serialize.boolean_to_string( + reachability_webhooks_enabled + ), + "AclEnabled": serialize.boolean_to_string(acl_enabled), } ) @@ -334,8 +336,10 @@ class ServiceContext(InstanceContext): { "WebhookUrl": webhook_url, "FriendlyName": friendly_name, - "ReachabilityWebhooksEnabled": reachability_webhooks_enabled, - "AclEnabled": acl_enabled, + "ReachabilityWebhooksEnabled": serialize.boolean_to_string( + reachability_webhooks_enabled + ), + "AclEnabled": serialize.boolean_to_string(acl_enabled), } ) @@ -447,8 +451,10 @@ class ServiceList(ListResource): { "FriendlyName": friendly_name, "WebhookUrl": webhook_url, - "ReachabilityWebhooksEnabled": reachability_webhooks_enabled, - "AclEnabled": acl_enabled, + "ReachabilityWebhooksEnabled": serialize.boolean_to_string( + reachability_webhooks_enabled + ), + "AclEnabled": serialize.boolean_to_string(acl_enabled), } ) @@ -482,8 +488,10 @@ class ServiceList(ListResource): { "FriendlyName": friendly_name, "WebhookUrl": webhook_url, - "ReachabilityWebhooksEnabled": reachability_webhooks_enabled, - "AclEnabled": acl_enabled, + "ReachabilityWebhooksEnabled": serialize.boolean_to_string( + reachability_webhooks_enabled + ), + "AclEnabled": serialize.boolean_to_string(acl_enabled), } ) diff --git a/twilio/rest/preview/sync/service/document/document_permission.py b/twilio/rest/preview/sync/service/document/document_permission.py index 7439d34341fc4aa5f92f7f56fe77ec720d7d3015..48addbb1639b24b099496f3dc4640df19313a311 100644 --- a/twilio/rest/preview/sync/service/document/document_permission.py +++ b/twilio/rest/preview/sync/service/document/document_permission.py @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import values +from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -263,9 +263,9 @@ class DocumentPermissionContext(InstanceContext): """ data = values.of( { - "Read": read, - "Write": write, - "Manage": manage, + "Read": serialize.boolean_to_string(read), + "Write": serialize.boolean_to_string(write), + "Manage": serialize.boolean_to_string(manage), } ) @@ -297,9 +297,9 @@ class DocumentPermissionContext(InstanceContext): """ data = values.of( { - "Read": read, - "Write": write, - "Manage": manage, + "Read": serialize.boolean_to_string(read), + "Write": serialize.boolean_to_string(write), + "Manage": serialize.boolean_to_string(manage), } ) diff --git a/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py b/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py index 0f4f9e4b280766171b27f863a0e788e6ef0c9d06..2fcaca5b26ace78cc7aaff18525e993761a1e380 100644 --- a/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py +++ b/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import values +from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -265,9 +265,9 @@ class SyncListPermissionContext(InstanceContext): """ data = values.of( { - "Read": read, - "Write": write, - "Manage": manage, + "Read": serialize.boolean_to_string(read), + "Write": serialize.boolean_to_string(write), + "Manage": serialize.boolean_to_string(manage), } ) @@ -299,9 +299,9 @@ class SyncListPermissionContext(InstanceContext): """ data = values.of( { - "Read": read, - "Write": write, - "Manage": manage, + "Read": serialize.boolean_to_string(read), + "Write": serialize.boolean_to_string(write), + "Manage": serialize.boolean_to_string(manage), } ) diff --git a/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py b/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py index 999713e0e97d5dd0f4104c36f2988a9100c5af9c..b626f07bdc390af9a8bb8e087d772ec3a480986f 100644 --- a/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py +++ b/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import values +from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -263,9 +263,9 @@ class SyncMapPermissionContext(InstanceContext): """ data = values.of( { - "Read": read, - "Write": write, - "Manage": manage, + "Read": serialize.boolean_to_string(read), + "Write": serialize.boolean_to_string(write), + "Manage": serialize.boolean_to_string(manage), } ) @@ -297,9 +297,9 @@ class SyncMapPermissionContext(InstanceContext): """ data = values.of( { - "Read": read, - "Write": write, - "Manage": manage, + "Read": serialize.boolean_to_string(read), + "Write": serialize.boolean_to_string(write), + "Manage": serialize.boolean_to_string(manage), } ) diff --git a/twilio/rest/preview/wireless/rate_plan.py b/twilio/rest/preview/wireless/rate_plan.py index abd9cbecc25ef6dc9ba2b2d2e516328ecbde2b6b..f3484efa661b64932ffa7c9a6bb51c3d005a350e 100644 --- a/twilio/rest/preview/wireless/rate_plan.py +++ b/twilio/rest/preview/wireless/rate_plan.py @@ -381,13 +381,15 @@ class RatePlanList(ListResource): { "UniqueName": unique_name, "FriendlyName": friendly_name, - "DataEnabled": data_enabled, + "DataEnabled": serialize.boolean_to_string(data_enabled), "DataLimit": data_limit, "DataMetering": data_metering, - "MessagingEnabled": messaging_enabled, - "VoiceEnabled": voice_enabled, - "CommandsEnabled": commands_enabled, - "NationalRoamingEnabled": national_roaming_enabled, + "MessagingEnabled": serialize.boolean_to_string(messaging_enabled), + "VoiceEnabled": serialize.boolean_to_string(voice_enabled), + "CommandsEnabled": serialize.boolean_to_string(commands_enabled), + "NationalRoamingEnabled": serialize.boolean_to_string( + national_roaming_enabled + ), "InternationalRoaming": serialize.map( international_roaming, lambda e: e ), @@ -436,13 +438,15 @@ class RatePlanList(ListResource): { "UniqueName": unique_name, "FriendlyName": friendly_name, - "DataEnabled": data_enabled, + "DataEnabled": serialize.boolean_to_string(data_enabled), "DataLimit": data_limit, "DataMetering": data_metering, - "MessagingEnabled": messaging_enabled, - "VoiceEnabled": voice_enabled, - "CommandsEnabled": commands_enabled, - "NationalRoamingEnabled": national_roaming_enabled, + "MessagingEnabled": serialize.boolean_to_string(messaging_enabled), + "VoiceEnabled": serialize.boolean_to_string(voice_enabled), + "CommandsEnabled": serialize.boolean_to_string(commands_enabled), + "NationalRoamingEnabled": serialize.boolean_to_string( + national_roaming_enabled + ), "InternationalRoaming": serialize.map( international_roaming, lambda e: e ), diff --git a/twilio/rest/preview_messaging/PreviewMessagingBase.py b/twilio/rest/preview_messaging/PreviewMessagingBase.py new file mode 100644 index 0000000000000000000000000000000000000000..12b19f4cf153543e10e398ac3df4def1dc5b6a01 --- /dev/null +++ b/twilio/rest/preview_messaging/PreviewMessagingBase.py @@ -0,0 +1,44 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from typing import Optional + +from twilio.base.domain import Domain +from twilio.rest import Client +from twilio.rest.preview_messaging.v1 import V1 + + +class PreviewMessagingBase(Domain): + + def __init__(self, twilio: Client): + """ + Initialize the PreviewMessaging Domain + + :returns: Domain for PreviewMessaging + """ + super().__init__(twilio, "https://preview.messaging.twilio.com") + self._v1: Optional[V1] = None + + @property + def v1(self) -> V1: + """ + :returns: Versions v1 of PreviewMessaging + """ + if self._v1 is None: + self._v1 = V1(self) + return self._v1 + + def __repr__(self) -> str: + """ + Provide a friendly representation + :returns: Machine friendly representation + """ + return "<Twilio.PreviewMessaging>" diff --git a/twilio/rest/preview_messaging/__init__.py b/twilio/rest/preview_messaging/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..73bf67969d28fb0ab3542bc6435397fe0f29e22d --- /dev/null +++ b/twilio/rest/preview_messaging/__init__.py @@ -0,0 +1,13 @@ +from twilio.rest.preview_messaging.PreviewMessagingBase import PreviewMessagingBase +from twilio.rest.preview_messaging.v1.broadcast import BroadcastList +from twilio.rest.preview_messaging.v1.message import MessageList + + +class PreviewMessaging(PreviewMessagingBase): + @property + def broadcast(self) -> BroadcastList: + return self.v1.broadcasts + + @property + def messages(self) -> MessageList: + return self.v1.messages diff --git a/twilio/rest/preview_messaging/v1/__init__.py b/twilio/rest/preview_messaging/v1/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..424af648e8ec9801c23eff28b55d8bf291719bd8 --- /dev/null +++ b/twilio/rest/preview_messaging/v1/__init__.py @@ -0,0 +1,51 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Bulk Messaging and Broadcast + Bulk Sending is a public Twilio REST API for 1:Many Message creation up to 100 recipients. Broadcast is a public Twilio REST API for 1:Many Message creation up to 10,000 recipients via file upload. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from typing import Optional +from twilio.base.version import Version +from twilio.base.domain import Domain +from twilio.rest.preview_messaging.v1.broadcast import BroadcastList +from twilio.rest.preview_messaging.v1.message import MessageList + + +class V1(Version): + + def __init__(self, domain: Domain): + """ + Initialize the V1 version of PreviewMessaging + + :param domain: The Twilio.preview_messaging domain + """ + super().__init__(domain, "v1") + self._broadcasts: Optional[BroadcastList] = None + self._messages: Optional[MessageList] = None + + @property + def broadcasts(self) -> BroadcastList: + if self._broadcasts is None: + self._broadcasts = BroadcastList(self) + return self._broadcasts + + @property + def messages(self) -> MessageList: + if self._messages is None: + self._messages = MessageList(self) + return self._messages + + def __repr__(self) -> str: + """ + Provide a friendly representation + :returns: Machine friendly representation + """ + return "<Twilio.PreviewMessaging.V1>" diff --git a/twilio/rest/preview_messaging/v1/broadcast.py b/twilio/rest/preview_messaging/v1/broadcast.py new file mode 100644 index 0000000000000000000000000000000000000000..e41e066badbf6784c61cd44a1c3b5dc31499b850 --- /dev/null +++ b/twilio/rest/preview_messaging/v1/broadcast.py @@ -0,0 +1,125 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Bulk Messaging and Broadcast + Bulk Sending is a public Twilio REST API for 1:Many Message creation up to 100 recipients. Broadcast is a public Twilio REST API for 1:Many Message creation up to 10,000 recipients via file upload. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from datetime import datetime +from typing import Any, Dict, Optional, Union +from twilio.base import deserialize, values + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class BroadcastInstance(InstanceResource): + """ + :ivar broadcast_sid: Numeric ID indentifying individual Broadcast requests + :ivar created_date: Timestamp of when the Broadcast was created + :ivar updated_date: Timestamp of when the Broadcast was last updated + :ivar broadcast_status: Status of the Broadcast request. Valid values are None, Pending-Upload, Uploaded, Queued, Executing, Execution-Failure, Execution-Completed, Cancelation-Requested, and Canceled + :ivar execution_details: + :ivar results_file: Path to a file detailing successful requests and errors from Broadcast execution + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.broadcast_sid: Optional[str] = payload.get("broadcast_sid") + self.created_date: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("created_date") + ) + self.updated_date: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("updated_date") + ) + self.broadcast_status: Optional[str] = payload.get("broadcast_status") + self.execution_details: Optional[str] = payload.get("execution_details") + self.results_file: Optional[str] = payload.get("results_file") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "<Twilio.PreviewMessaging.V1.BroadcastInstance>" + + +class BroadcastList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the BroadcastList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Broadcasts" + + def create( + self, x_twilio_request_key: Union[str, object] = values.unset + ) -> BroadcastInstance: + """ + Create the BroadcastInstance + + :param x_twilio_request_key: Idempotency key provided by the client + + :returns: The created BroadcastInstance + """ + + data = values.of({}) + headers = values.of( + { + "X-Twilio-Request-Key": x_twilio_request_key, + } + ) + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return BroadcastInstance(self._version, payload) + + async def create_async( + self, x_twilio_request_key: Union[str, object] = values.unset + ) -> BroadcastInstance: + """ + Asynchronously create the BroadcastInstance + + :param x_twilio_request_key: Idempotency key provided by the client + + :returns: The created BroadcastInstance + """ + + data = values.of({}) + headers = values.of( + { + "X-Twilio-Request-Key": x_twilio_request_key, + } + ) + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return BroadcastInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "<Twilio.PreviewMessaging.V1.BroadcastList>" diff --git a/twilio/rest/preview_messaging/v1/message.py b/twilio/rest/preview_messaging/v1/message.py new file mode 100644 index 0000000000000000000000000000000000000000..c6212c7f4f63baea315141cf61712f7e56741c26 --- /dev/null +++ b/twilio/rest/preview_messaging/v1/message.py @@ -0,0 +1,203 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Bulk Messaging and Broadcast + Bulk Sending is a public Twilio REST API for 1:Many Message creation up to 100 recipients. Broadcast is a public Twilio REST API for 1:Many Message creation up to 10,000 recipients via file upload. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from typing import Any, Dict, List, Optional +from twilio.base import deserialize + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class MessageInstance(InstanceResource): + """ + :ivar total_message_count: The number of Messages processed in the request, equal to the sum of success_count and error_count. + :ivar success_count: The number of Messages successfully created. + :ivar error_count: The number of Messages unsuccessfully processed in the request. + :ivar message_receipts: + :ivar failed_message_receipts: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.total_message_count: Optional[int] = deserialize.integer( + payload.get("total_message_count") + ) + self.success_count: Optional[int] = deserialize.integer( + payload.get("success_count") + ) + self.error_count: Optional[int] = deserialize.integer( + payload.get("error_count") + ) + self.message_receipts: Optional[List[str]] = payload.get("message_receipts") + self.failed_message_receipts: Optional[List[str]] = payload.get( + "failed_message_receipts" + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "<Twilio.PreviewMessaging.V1.MessageInstance>" + + +class MessageList(ListResource): + + class CreateMessagesRequest(object): + """ + :ivar messages: + :ivar from_: A Twilio phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, an [alphanumeric sender ID](https://www.twilio.com/docs/sms/send-messages#use-an-alphanumeric-sender-id), or a [Channel Endpoint address](https://www.twilio.com/docs/sms/channels#channel-addresses) that is enabled for the type of message you want to send. Phone numbers or [short codes](https://www.twilio.com/docs/sms/api/short-code) purchased from Twilio also work here. You cannot, for example, spoof messages from a private cell phone number. If you are using `messaging_service_sid`, this parameter must be empty. + :ivar messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/sms/services#send-a-message-with-copilot) you want to associate with the Message. Set this parameter to use the [Messaging Service Settings and Copilot Features](https://www.twilio.com/console/sms/services) you have configured and leave the `from` parameter empty. When only this parameter is set, Twilio will use your enabled Copilot Features to select the `from` phone number for delivery. + :ivar body: The text of the message you want to send. Can be up to 1,600 characters in length. + :ivar content_sid: The SID of the preconfigured [Content Template](https://www.twilio.com/docs/content-api/create-and-send-your-first-content-api-template#create-a-template) you want to associate with the Message. Must be used in conjuction with a preconfigured [Messaging Service Settings and Copilot Features](https://www.twilio.com/console/sms/services) When this parameter is set, Twilio will use your configured content template and the provided `ContentVariables`. This Twilio product is currently in Private Beta. + :ivar media_url: The URL of the media to send with the message. The media can be of type `gif`, `png`, and `jpeg` and will be formatted correctly on the recipient's device. The media size limit is 5MB for supported file types (JPEG, PNG, GIF) and 500KB for [other types](https://www.twilio.com/docs/sms/accepted-mime-types) of accepted media. To send more than one image in the message body, provide multiple `media_url` parameters in the POST request. You can include up to 10 `media_url` parameters per message. You can send images in an SMS message in only the US and Canada. + :ivar status_callback: The URL we should call using the \"status_callback_method\" to send status information to your application. If specified, we POST these message status changes to the URL - queued, failed, sent, delivered, or undelivered. Twilio will POST its [standard request parameters](https://www.twilio.com/docs/messaging/twiml#request-parameters) as well as some additional parameters including \"MessageSid\", \"MessageStatus\", and \"ErrorCode\". If you include this parameter with the \"messaging_service_sid\", we use this URL instead of the Status Callback URL of the [Messaging Service](https://www.twilio.com/docs/messaging/services/api). URLs must contain a valid hostname and underscores are not allowed. + :ivar validity_period: How long in seconds the message can remain in our outgoing message queue. After this period elapses, the message fails and we call your status callback. Can be between 1 and the default value of 14,400 seconds. After a message has been accepted by a carrier, however, we cannot guarantee that the message will not be queued after this period. We recommend that this value be at least 5 seconds. + :ivar send_at: The time at which Twilio will send the message. This parameter can be used to schedule a message to be sent at a particular time. Must be in ISO 8601 format. + :ivar schedule_type: This parameter indicates your intent to schedule a message. Pass the value `fixed` to schedule a message at a fixed time. This parameter works in conjuction with the `SendAt` parameter. + :ivar shorten_urls: Determines the usage of Click Tracking. Setting it to `true` will instruct Twilio to replace all links in the Message with a shortened version based on the associated Domain Sid and track clicks on them. If this parameter is not set on an API call, we will use the value set on the Messaging Service. If this parameter is not set and the value is not configured on the Messaging Service used this will default to `false`. + :ivar send_as_mms: If set to True, Twilio will deliver the message as a single MMS message, regardless of the presence of media. + :ivar max_price: The maximum total price in US dollars that you will pay for the message to be delivered. Can be a decimal value that has up to 4 decimal places. All messages are queued for delivery and the message cost is checked before the message is sent. If the cost exceeds max_price, the message will fail and a status of Failed is sent to the status callback. If MaxPrice is not set, the message cost is not checked. + :ivar attempt: Total number of attempts made ( including this ) to send out the message regardless of the provider used + :ivar smart_encoded: This parameter indicates whether to detect Unicode characters that have a similar GSM-7 character and replace them. Can be true or false. + :ivar force_delivery: This parameter allows Twilio to send SMS traffic to carriers without checking/caring whether the destination number is a mobile or a landline. + :ivar application_sid: The SID of the application that should receive message status. We POST a message_sid parameter and a message_status parameter with a value of sent or failed to the application's message_status_callback. If a status_callback parameter is also passed, it will be ignored and the application's message_status_callback parameter will be used. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.messages: Optional[List[MessageList.MessagingV1Message]] = payload.get( + "messages" + ) + self.from_: Optional[str] = payload.get("from_") + self.messaging_service_sid: Optional[str] = payload.get( + "messaging_service_sid" + ) + self.body: Optional[str] = payload.get("body") + self.content_sid: Optional[str] = payload.get("content_sid") + self.media_url: Optional[List[str]] = payload.get("media_url") + self.status_callback: Optional[str] = payload.get("status_callback") + self.validity_period: Optional[int] = payload.get("validity_period") + self.send_at: Optional[str] = payload.get("send_at") + self.schedule_type: Optional[str] = payload.get("schedule_type") + self.shorten_urls: Optional[bool] = payload.get("shorten_urls") + self.send_as_mms: Optional[bool] = payload.get("send_as_mms") + self.max_price: Optional[float] = payload.get("max_price") + self.attempt: Optional[int] = payload.get("attempt") + self.smart_encoded: Optional[bool] = payload.get("smart_encoded") + self.force_delivery: Optional[bool] = payload.get("force_delivery") + self.application_sid: Optional[str] = payload.get("application_sid") + + def to_dict(self): + return { + "messages": [messages.to_dict() for messages in self.messages], + "from": self.from_, + "messaging_service_sid": self.messaging_service_sid, + "body": self.body, + "content_sid": self.content_sid, + "media_url": self.media_url, + "status_callback": self.status_callback, + "validity_period": self.validity_period, + "send_at": self.send_at, + "schedule_type": self.schedule_type, + "shorten_urls": self.shorten_urls, + "send_as_mms": self.send_as_mms, + "max_price": self.max_price, + "attempt": self.attempt, + "smart_encoded": self.smart_encoded, + "force_delivery": self.force_delivery, + "application_sid": self.application_sid, + } + + class MessagingV1Message(object): + """ + :ivar to: The destination phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format for SMS/MMS or [Channel user address](https://www.twilio.com/docs/sms/channels#channel-addresses) for other 3rd-party channels. + :ivar body: The text of the message you want to send. Can be up to 1,600 characters in length. Overrides the request-level body and content template if provided. + :ivar content_variables: Key-value pairs of variable names to substitution values. Refer to the [Twilio Content API Resources](https://www.twilio.com/docs/content-api/content-api-resources#send-a-message-with-preconfigured-content) for more details. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.to: Optional[str] = payload.get("to") + self.body: Optional[str] = payload.get("body") + self.content_variables: Optional[dict[str, str]] = payload.get( + "content_variables" + ) + + def to_dict(self): + return { + "to": self.to, + "body": self.body, + "content_variables": self.content_variables, + } + + def __init__(self, version: Version): + """ + Initialize the MessageList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Messages" + + def create(self, create_messages_request: CreateMessagesRequest) -> MessageInstance: + """ + Create the MessageInstance + + :param create_messages_request: + + :returns: The created MessageInstance + """ + data = create_messages_request.to_dict() + + headers = {"Content-Type": "application/json"} + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return MessageInstance(self._version, payload) + + async def create_async( + self, create_messages_request: CreateMessagesRequest + ) -> MessageInstance: + """ + Asynchronously create the MessageInstance + + :param create_messages_request: + + :returns: The created MessageInstance + """ + + data = create_messages_request.to_dict() + headers = {"Content-Type": "application/json"} + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return MessageInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "<Twilio.PreviewMessaging.V1.MessageList>" diff --git a/twilio/rest/proxy/v1/service/phone_number.py b/twilio/rest/proxy/v1/service/phone_number.py index c4252b3980d243860f5ce30746950b5e011ca646..366b9ba11f179559c90a63c156fc53d9a5713a9b 100644 --- a/twilio/rest/proxy/v1/service/phone_number.py +++ b/twilio/rest/proxy/v1/service/phone_number.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -257,7 +257,7 @@ class PhoneNumberContext(InstanceContext): """ data = values.of( { - "IsReserved": is_reserved, + "IsReserved": serialize.boolean_to_string(is_reserved), } ) @@ -286,7 +286,7 @@ class PhoneNumberContext(InstanceContext): """ data = values.of( { - "IsReserved": is_reserved, + "IsReserved": serialize.boolean_to_string(is_reserved), } ) @@ -372,7 +372,7 @@ class PhoneNumberList(ListResource): { "Sid": sid, "PhoneNumber": phone_number, - "IsReserved": is_reserved, + "IsReserved": serialize.boolean_to_string(is_reserved), } ) @@ -406,7 +406,7 @@ class PhoneNumberList(ListResource): { "Sid": sid, "PhoneNumber": phone_number, - "IsReserved": is_reserved, + "IsReserved": serialize.boolean_to_string(is_reserved), } ) diff --git a/twilio/rest/proxy/v1/service/short_code.py b/twilio/rest/proxy/v1/service/short_code.py index 7fc108e673d42a74f34e99cce58a568891959ca6..712d6f82fa6f3fb1780f58195c157298dfe8a351 100644 --- a/twilio/rest/proxy/v1/service/short_code.py +++ b/twilio/rest/proxy/v1/service/short_code.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -251,7 +251,7 @@ class ShortCodeContext(InstanceContext): """ data = values.of( { - "IsReserved": is_reserved, + "IsReserved": serialize.boolean_to_string(is_reserved), } ) @@ -280,7 +280,7 @@ class ShortCodeContext(InstanceContext): """ data = values.of( { - "IsReserved": is_reserved, + "IsReserved": serialize.boolean_to_string(is_reserved), } ) diff --git a/twilio/rest/serverless/v1/service/__init__.py b/twilio/rest/serverless/v1/service/__init__.py index 493b1a2e05ec1c281eddfd634550e4ff468138f9..0fe404c8f18cdd402b0ad2de715ee914e2bf7d72 100644 --- a/twilio/rest/serverless/v1/service/__init__.py +++ b/twilio/rest/serverless/v1/service/__init__.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -299,9 +299,9 @@ class ServiceContext(InstanceContext): """ data = values.of( { - "IncludeCredentials": include_credentials, + "IncludeCredentials": serialize.boolean_to_string(include_credentials), "FriendlyName": friendly_name, - "UiEditable": ui_editable, + "UiEditable": serialize.boolean_to_string(ui_editable), } ) @@ -330,9 +330,9 @@ class ServiceContext(InstanceContext): """ data = values.of( { - "IncludeCredentials": include_credentials, + "IncludeCredentials": serialize.boolean_to_string(include_credentials), "FriendlyName": friendly_name, - "UiEditable": ui_editable, + "UiEditable": serialize.boolean_to_string(ui_editable), } ) @@ -456,8 +456,8 @@ class ServiceList(ListResource): { "UniqueName": unique_name, "FriendlyName": friendly_name, - "IncludeCredentials": include_credentials, - "UiEditable": ui_editable, + "IncludeCredentials": serialize.boolean_to_string(include_credentials), + "UiEditable": serialize.boolean_to_string(ui_editable), } ) @@ -491,8 +491,8 @@ class ServiceList(ListResource): { "UniqueName": unique_name, "FriendlyName": friendly_name, - "IncludeCredentials": include_credentials, - "UiEditable": ui_editable, + "IncludeCredentials": serialize.boolean_to_string(include_credentials), + "UiEditable": serialize.boolean_to_string(ui_editable), } ) diff --git a/twilio/rest/supersim/v1/esim_profile.py b/twilio/rest/supersim/v1/esim_profile.py index c8ecb02ae073615f6cf14d40c415ec4950584d3e..847bcae33a84c3cb593da2f5b39f6594d8ceb9ba 100644 --- a/twilio/rest/supersim/v1/esim_profile.py +++ b/twilio/rest/supersim/v1/esim_profile.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -240,7 +240,7 @@ class EsimProfileList(ListResource): { "CallbackUrl": callback_url, "CallbackMethod": callback_method, - "GenerateMatchingId": generate_matching_id, + "GenerateMatchingId": serialize.boolean_to_string(generate_matching_id), "Eid": eid, } ) @@ -275,7 +275,7 @@ class EsimProfileList(ListResource): { "CallbackUrl": callback_url, "CallbackMethod": callback_method, - "GenerateMatchingId": generate_matching_id, + "GenerateMatchingId": serialize.boolean_to_string(generate_matching_id), "Eid": eid, } ) diff --git a/twilio/rest/supersim/v1/fleet.py b/twilio/rest/supersim/v1/fleet.py index 2447057a7f4058fabe5389a1b1a8400575de88d8..2003eb77b50b378ebffa2e1e43f3a329f9bf0c34 100644 --- a/twilio/rest/supersim/v1/fleet.py +++ b/twilio/rest/supersim/v1/fleet.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -403,11 +403,11 @@ class FleetList(ListResource): { "NetworkAccessProfile": network_access_profile, "UniqueName": unique_name, - "DataEnabled": data_enabled, + "DataEnabled": serialize.boolean_to_string(data_enabled), "DataLimit": data_limit, "IpCommandsUrl": ip_commands_url, "IpCommandsMethod": ip_commands_method, - "SmsCommandsEnabled": sms_commands_enabled, + "SmsCommandsEnabled": serialize.boolean_to_string(sms_commands_enabled), "SmsCommandsUrl": sms_commands_url, "SmsCommandsMethod": sms_commands_method, } @@ -453,11 +453,11 @@ class FleetList(ListResource): { "NetworkAccessProfile": network_access_profile, "UniqueName": unique_name, - "DataEnabled": data_enabled, + "DataEnabled": serialize.boolean_to_string(data_enabled), "DataLimit": data_limit, "IpCommandsUrl": ip_commands_url, "IpCommandsMethod": ip_commands_method, - "SmsCommandsEnabled": sms_commands_enabled, + "SmsCommandsEnabled": serialize.boolean_to_string(sms_commands_enabled), "SmsCommandsUrl": sms_commands_url, "SmsCommandsMethod": sms_commands_method, } diff --git a/twilio/rest/sync/v1/service/__init__.py b/twilio/rest/sync/v1/service/__init__.py index 9fd7c22e30da1f2cc67768df643d75407069ca3c..0bf1045f2b265daff4558ad74ef4a4575ed26f6e 100644 --- a/twilio/rest/sync/v1/service/__init__.py +++ b/twilio/rest/sync/v1/service/__init__.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -347,11 +347,17 @@ class ServiceContext(InstanceContext): { "WebhookUrl": webhook_url, "FriendlyName": friendly_name, - "ReachabilityWebhooksEnabled": reachability_webhooks_enabled, - "AclEnabled": acl_enabled, - "ReachabilityDebouncingEnabled": reachability_debouncing_enabled, + "ReachabilityWebhooksEnabled": serialize.boolean_to_string( + reachability_webhooks_enabled + ), + "AclEnabled": serialize.boolean_to_string(acl_enabled), + "ReachabilityDebouncingEnabled": serialize.boolean_to_string( + reachability_debouncing_enabled + ), "ReachabilityDebouncingWindow": reachability_debouncing_window, - "WebhooksFromRestEnabled": webhooks_from_rest_enabled, + "WebhooksFromRestEnabled": serialize.boolean_to_string( + webhooks_from_rest_enabled + ), } ) @@ -390,11 +396,17 @@ class ServiceContext(InstanceContext): { "WebhookUrl": webhook_url, "FriendlyName": friendly_name, - "ReachabilityWebhooksEnabled": reachability_webhooks_enabled, - "AclEnabled": acl_enabled, - "ReachabilityDebouncingEnabled": reachability_debouncing_enabled, + "ReachabilityWebhooksEnabled": serialize.boolean_to_string( + reachability_webhooks_enabled + ), + "AclEnabled": serialize.boolean_to_string(acl_enabled), + "ReachabilityDebouncingEnabled": serialize.boolean_to_string( + reachability_debouncing_enabled + ), "ReachabilityDebouncingWindow": reachability_debouncing_window, - "WebhooksFromRestEnabled": webhooks_from_rest_enabled, + "WebhooksFromRestEnabled": serialize.boolean_to_string( + webhooks_from_rest_enabled + ), } ) @@ -524,11 +536,17 @@ class ServiceList(ListResource): { "FriendlyName": friendly_name, "WebhookUrl": webhook_url, - "ReachabilityWebhooksEnabled": reachability_webhooks_enabled, - "AclEnabled": acl_enabled, - "ReachabilityDebouncingEnabled": reachability_debouncing_enabled, + "ReachabilityWebhooksEnabled": serialize.boolean_to_string( + reachability_webhooks_enabled + ), + "AclEnabled": serialize.boolean_to_string(acl_enabled), + "ReachabilityDebouncingEnabled": serialize.boolean_to_string( + reachability_debouncing_enabled + ), "ReachabilityDebouncingWindow": reachability_debouncing_window, - "WebhooksFromRestEnabled": webhooks_from_rest_enabled, + "WebhooksFromRestEnabled": serialize.boolean_to_string( + webhooks_from_rest_enabled + ), } ) @@ -568,11 +586,17 @@ class ServiceList(ListResource): { "FriendlyName": friendly_name, "WebhookUrl": webhook_url, - "ReachabilityWebhooksEnabled": reachability_webhooks_enabled, - "AclEnabled": acl_enabled, - "ReachabilityDebouncingEnabled": reachability_debouncing_enabled, + "ReachabilityWebhooksEnabled": serialize.boolean_to_string( + reachability_webhooks_enabled + ), + "AclEnabled": serialize.boolean_to_string(acl_enabled), + "ReachabilityDebouncingEnabled": serialize.boolean_to_string( + reachability_debouncing_enabled + ), "ReachabilityDebouncingWindow": reachability_debouncing_window, - "WebhooksFromRestEnabled": webhooks_from_rest_enabled, + "WebhooksFromRestEnabled": serialize.boolean_to_string( + webhooks_from_rest_enabled + ), } ) diff --git a/twilio/rest/sync/v1/service/document/document_permission.py b/twilio/rest/sync/v1/service/document/document_permission.py index d8f157fb4ec79028c8a50360242e9713db6e5f9a..40f524832c1b8514b9b804110b6ee9cfb062d1cc 100644 --- a/twilio/rest/sync/v1/service/document/document_permission.py +++ b/twilio/rest/sync/v1/service/document/document_permission.py @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import values +from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -263,9 +263,9 @@ class DocumentPermissionContext(InstanceContext): """ data = values.of( { - "Read": read, - "Write": write, - "Manage": manage, + "Read": serialize.boolean_to_string(read), + "Write": serialize.boolean_to_string(write), + "Manage": serialize.boolean_to_string(manage), } ) @@ -297,9 +297,9 @@ class DocumentPermissionContext(InstanceContext): """ data = values.of( { - "Read": read, - "Write": write, - "Manage": manage, + "Read": serialize.boolean_to_string(read), + "Write": serialize.boolean_to_string(write), + "Manage": serialize.boolean_to_string(manage), } ) 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 228ab0d19287e7f959e263c957db3f6809e3d2ee..07fce14b95b122995cce95ac43af3325fd78a15c 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 @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import values +from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -265,9 +265,9 @@ class SyncListPermissionContext(InstanceContext): """ data = values.of( { - "Read": read, - "Write": write, - "Manage": manage, + "Read": serialize.boolean_to_string(read), + "Write": serialize.boolean_to_string(write), + "Manage": serialize.boolean_to_string(manage), } ) @@ -299,9 +299,9 @@ class SyncListPermissionContext(InstanceContext): """ data = values.of( { - "Read": read, - "Write": write, - "Manage": manage, + "Read": serialize.boolean_to_string(read), + "Write": serialize.boolean_to_string(write), + "Manage": serialize.boolean_to_string(manage), } ) 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 3f204d65ba0e09cc9626de25e79284938d4b8ccc..ba056906c7bf8c74c69d5b3b39d65ae12c5cb59c 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 @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import values +from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -263,9 +263,9 @@ class SyncMapPermissionContext(InstanceContext): """ data = values.of( { - "Read": read, - "Write": write, - "Manage": manage, + "Read": serialize.boolean_to_string(read), + "Write": serialize.boolean_to_string(write), + "Manage": serialize.boolean_to_string(manage), } ) @@ -297,9 +297,9 @@ class SyncMapPermissionContext(InstanceContext): """ data = values.of( { - "Read": read, - "Write": write, - "Manage": manage, + "Read": serialize.boolean_to_string(read), + "Write": serialize.boolean_to_string(write), + "Manage": serialize.boolean_to_string(manage), } ) diff --git a/twilio/rest/taskrouter/v1/workspace/__init__.py b/twilio/rest/taskrouter/v1/workspace/__init__.py index 0b0136fedc1e5b0e3616aed8af6ed81bca027dcb..f1202197c43837828578bbfc79dd53dbd79fa9dc 100644 --- a/twilio/rest/taskrouter/v1/workspace/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/__init__.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -416,7 +416,7 @@ class WorkspaceContext(InstanceContext): "EventCallbackUrl": event_callback_url, "EventsFilter": events_filter, "FriendlyName": friendly_name, - "MultiTaskEnabled": multi_task_enabled, + "MultiTaskEnabled": serialize.boolean_to_string(multi_task_enabled), "TimeoutActivitySid": timeout_activity_sid, "PrioritizeQueueOrder": prioritize_queue_order, } @@ -461,7 +461,7 @@ class WorkspaceContext(InstanceContext): "EventCallbackUrl": event_callback_url, "EventsFilter": events_filter, "FriendlyName": friendly_name, - "MultiTaskEnabled": multi_task_enabled, + "MultiTaskEnabled": serialize.boolean_to_string(multi_task_enabled), "TimeoutActivitySid": timeout_activity_sid, "PrioritizeQueueOrder": prioritize_queue_order, } @@ -666,7 +666,7 @@ class WorkspaceList(ListResource): "FriendlyName": friendly_name, "EventCallbackUrl": event_callback_url, "EventsFilter": events_filter, - "MultiTaskEnabled": multi_task_enabled, + "MultiTaskEnabled": serialize.boolean_to_string(multi_task_enabled), "Template": template, "PrioritizeQueueOrder": prioritize_queue_order, } @@ -709,7 +709,7 @@ class WorkspaceList(ListResource): "FriendlyName": friendly_name, "EventCallbackUrl": event_callback_url, "EventsFilter": events_filter, - "MultiTaskEnabled": multi_task_enabled, + "MultiTaskEnabled": serialize.boolean_to_string(multi_task_enabled), "Template": template, "PrioritizeQueueOrder": prioritize_queue_order, } diff --git a/twilio/rest/taskrouter/v1/workspace/activity.py b/twilio/rest/taskrouter/v1/workspace/activity.py index 3ab15acf8ed0fca3744c5d12e8e23689689526c3..bae49d5efa49b7a77a4a78793e3f6af624be8659 100644 --- a/twilio/rest/taskrouter/v1/workspace/activity.py +++ b/twilio/rest/taskrouter/v1/workspace/activity.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -361,7 +361,7 @@ class ActivityList(ListResource): data = values.of( { "FriendlyName": friendly_name, - "Available": available, + "Available": serialize.boolean_to_string(available), } ) @@ -390,7 +390,7 @@ class ActivityList(ListResource): data = values.of( { "FriendlyName": friendly_name, - "Available": available, + "Available": serialize.boolean_to_string(available), } ) diff --git a/twilio/rest/taskrouter/v1/workspace/task/__init__.py b/twilio/rest/taskrouter/v1/workspace/task/__init__.py index 708db25105ec9eba3fe52dec49548c47296b7f77..f5c306b65a53f7662fbb291f0a440f6cbeee9f38 100644 --- a/twilio/rest/taskrouter/v1/workspace/task/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/task/__init__.py @@ -855,7 +855,7 @@ class TaskList(ListResource): "TaskQueueName": task_queue_name, "EvaluateTaskAttributes": evaluate_task_attributes, "Ordering": ordering, - "HasAddons": has_addons, + "HasAddons": serialize.boolean_to_string(has_addons), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -909,7 +909,7 @@ class TaskList(ListResource): "TaskQueueName": task_queue_name, "EvaluateTaskAttributes": evaluate_task_attributes, "Ordering": ordering, - "HasAddons": has_addons, + "HasAddons": serialize.boolean_to_string(has_addons), "PageToken": page_token, "Page": page_number, "PageSize": page_size, diff --git a/twilio/rest/taskrouter/v1/workspace/task/reservation.py b/twilio/rest/taskrouter/v1/workspace/task/reservation.py index 7ac7807c0e0f47606c76101e49b7c53de3f20825..50b1ed127397fd8e13d96625d57110ba2aadc24b 100644 --- a/twilio/rest/taskrouter/v1/workspace/task/reservation.py +++ b/twilio/rest/taskrouter/v1/workspace/task/reservation.py @@ -723,9 +723,9 @@ class ReservationContext(InstanceContext): "CallTo": call_to, "CallUrl": call_url, "CallStatusCallbackUrl": call_status_callback_url, - "CallAccept": call_accept, + "CallAccept": serialize.boolean_to_string(call_accept), "RedirectCallSid": redirect_call_sid, - "RedirectAccept": redirect_accept, + "RedirectAccept": serialize.boolean_to_string(redirect_accept), "RedirectUrl": redirect_url, "To": to, "From": from_, @@ -735,14 +735,18 @@ class ReservationContext(InstanceContext): status_callback_event, lambda e: e ), "Timeout": timeout, - "Record": record, - "Muted": muted, + "Record": serialize.boolean_to_string(record), + "Muted": serialize.boolean_to_string(muted), "Beep": beep, - "StartConferenceOnEnter": start_conference_on_enter, - "EndConferenceOnExit": end_conference_on_exit, + "StartConferenceOnEnter": serialize.boolean_to_string( + start_conference_on_enter + ), + "EndConferenceOnExit": serialize.boolean_to_string( + end_conference_on_exit + ), "WaitUrl": wait_url, "WaitMethod": wait_method, - "EarlyMedia": early_media, + "EarlyMedia": serialize.boolean_to_string(early_media), "MaxParticipants": max_participants, "ConferenceStatusCallback": conference_status_callback, "ConferenceStatusCallbackMethod": conference_status_callback_method, @@ -765,8 +769,12 @@ class ReservationContext(InstanceContext): "PostWorkActivitySid": post_work_activity_sid, "SupervisorMode": supervisor_mode, "Supervisor": supervisor, - "EndConferenceOnCustomerExit": end_conference_on_customer_exit, - "BeepOnCustomerEntrance": beep_on_customer_entrance, + "EndConferenceOnCustomerExit": serialize.boolean_to_string( + end_conference_on_customer_exit + ), + "BeepOnCustomerEntrance": serialize.boolean_to_string( + beep_on_customer_entrance + ), "JitterBufferSize": jitter_buffer_size, } ) @@ -930,9 +938,9 @@ class ReservationContext(InstanceContext): "CallTo": call_to, "CallUrl": call_url, "CallStatusCallbackUrl": call_status_callback_url, - "CallAccept": call_accept, + "CallAccept": serialize.boolean_to_string(call_accept), "RedirectCallSid": redirect_call_sid, - "RedirectAccept": redirect_accept, + "RedirectAccept": serialize.boolean_to_string(redirect_accept), "RedirectUrl": redirect_url, "To": to, "From": from_, @@ -942,14 +950,18 @@ class ReservationContext(InstanceContext): status_callback_event, lambda e: e ), "Timeout": timeout, - "Record": record, - "Muted": muted, + "Record": serialize.boolean_to_string(record), + "Muted": serialize.boolean_to_string(muted), "Beep": beep, - "StartConferenceOnEnter": start_conference_on_enter, - "EndConferenceOnExit": end_conference_on_exit, + "StartConferenceOnEnter": serialize.boolean_to_string( + start_conference_on_enter + ), + "EndConferenceOnExit": serialize.boolean_to_string( + end_conference_on_exit + ), "WaitUrl": wait_url, "WaitMethod": wait_method, - "EarlyMedia": early_media, + "EarlyMedia": serialize.boolean_to_string(early_media), "MaxParticipants": max_participants, "ConferenceStatusCallback": conference_status_callback, "ConferenceStatusCallbackMethod": conference_status_callback_method, @@ -972,8 +984,12 @@ class ReservationContext(InstanceContext): "PostWorkActivitySid": post_work_activity_sid, "SupervisorMode": supervisor_mode, "Supervisor": supervisor, - "EndConferenceOnCustomerExit": end_conference_on_customer_exit, - "BeepOnCustomerEntrance": beep_on_customer_entrance, + "EndConferenceOnCustomerExit": serialize.boolean_to_string( + end_conference_on_customer_exit + ), + "BeepOnCustomerEntrance": serialize.boolean_to_string( + beep_on_customer_entrance + ), "JitterBufferSize": jitter_buffer_size, } ) diff --git a/twilio/rest/taskrouter/v1/workspace/task_channel.py b/twilio/rest/taskrouter/v1/workspace/task_channel.py index 780c4ef9fa31f323455792851bcae27882a11eb7..099f85efb1f2b14eb2b777fde784b5079d67727d 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_channel.py +++ b/twilio/rest/taskrouter/v1/workspace/task_channel.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -267,7 +267,9 @@ class TaskChannelContext(InstanceContext): data = values.of( { "FriendlyName": friendly_name, - "ChannelOptimizedRouting": channel_optimized_routing, + "ChannelOptimizedRouting": serialize.boolean_to_string( + channel_optimized_routing + ), } ) @@ -300,7 +302,9 @@ class TaskChannelContext(InstanceContext): data = values.of( { "FriendlyName": friendly_name, - "ChannelOptimizedRouting": channel_optimized_routing, + "ChannelOptimizedRouting": serialize.boolean_to_string( + channel_optimized_routing + ), } ) @@ -386,7 +390,9 @@ class TaskChannelList(ListResource): { "FriendlyName": friendly_name, "UniqueName": unique_name, - "ChannelOptimizedRouting": channel_optimized_routing, + "ChannelOptimizedRouting": serialize.boolean_to_string( + channel_optimized_routing + ), } ) @@ -420,7 +426,9 @@ class TaskChannelList(ListResource): { "FriendlyName": friendly_name, "UniqueName": unique_name, - "ChannelOptimizedRouting": channel_optimized_routing, + "ChannelOptimizedRouting": serialize.boolean_to_string( + channel_optimized_routing + ), } ) diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py b/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py index 5c750d94cb57ae77c12c9225d3c29afee0baec62..794fd216d362b03d468a786e801476267e43bd18 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py @@ -20,6 +20,9 @@ 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.taskrouter.v1.workspace.task_queue.task_queue_bulk_real_time_statistics import ( + TaskQueueBulkRealTimeStatisticsList, +) from twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics import ( TaskQueueCumulativeStatisticsList, ) @@ -515,6 +518,9 @@ class TaskQueueList(ListResource): } self._uri = "/Workspaces/{workspace_sid}/TaskQueues".format(**self._solution) + self._bulk_real_time_statistics: Optional[ + TaskQueueBulkRealTimeStatisticsList + ] = None self._statistics: Optional[TaskQueuesStatisticsList] = None def create( @@ -862,6 +868,17 @@ class TaskQueueList(ListResource): response = await self._version.domain.twilio.request_async("GET", target_url) return TaskQueuePage(self._version, response, self._solution) + @property + def bulk_real_time_statistics(self) -> TaskQueueBulkRealTimeStatisticsList: + """ + Access the bulk_real_time_statistics + """ + if self._bulk_real_time_statistics is None: + self._bulk_real_time_statistics = TaskQueueBulkRealTimeStatisticsList( + self._version, workspace_sid=self._solution["workspace_sid"] + ) + return self._bulk_real_time_statistics + @property def statistics(self) -> TaskQueuesStatisticsList: """ 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 new file mode 100644 index 0000000000000000000000000000000000000000..0556e6bb4aa033e963744439801fc6b719dd0ed9 --- /dev/null +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_bulk_real_time_statistics.py @@ -0,0 +1,132 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from typing import Any, Dict, List, Optional, Union +from twilio.base import deserialize, values + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +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. + :ivar task_queue_data: The real-time statistics for each requested TaskQueue SID. `task_queue_data` returns the following attributes: `task_queue_sid`: The SID of the TaskQueue from which these statistics were calculated. `total_available_workers`: The total number of Workers available for Tasks in the TaskQueue. `total_eligible_workers`: The total number of Workers eligible for Tasks in the TaskQueue, regardless of their Activity state. `total_tasks`: The total number of Tasks. `longest_task_waiting_age`: The age of the longest waiting Task. `longest_task_waiting_sid`: The SID of the longest waiting Task. `tasks_by_status`: The number of Tasks grouped by their current status. `tasks_by_priority`: The number of Tasks grouped by priority. `activity_statistics`: The number of current Workers grouped by Activity. + :ivar task_queue_response_count: The number of TaskQueue statistics received in task_queue_data. + :ivar url: The absolute URL of the TaskQueue statistics resource. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], workspace_sid: str): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.task_queue_data: Optional[List[Dict[str, object]]] = payload.get( + "task_queue_data" + ) + self.task_queue_response_count: Optional[int] = deserialize.integer( + payload.get("task_queue_response_count") + ) + self.url: Optional[str] = payload.get("url") + + self._solution = { + "workspace_sid": workspace_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 ( + "<Twilio.Taskrouter.V1.TaskQueueBulkRealTimeStatisticsInstance {}>".format( + context + ) + ) + + +class TaskQueueBulkRealTimeStatisticsList(ListResource): + + def __init__(self, version: Version, workspace_sid: str): + """ + Initialize the TaskQueueBulkRealTimeStatisticsList + + :param version: Version that contains the resource + :param workspace_sid: The unique SID identifier of the Workspace. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "workspace_sid": workspace_sid, + } + self._uri = "/Workspaces/{workspace_sid}/TaskQueues/RealTimeStatistics".format( + **self._solution + ) + + def create( + self, body: Union[object, object] = values.unset + ) -> TaskQueueBulkRealTimeStatisticsInstance: + """ + Create the TaskQueueBulkRealTimeStatisticsInstance + + :param body: + + :returns: The created TaskQueueBulkRealTimeStatisticsInstance + """ + data = body.to_dict() + + headers = {"Content-Type": "application/json"} + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return TaskQueueBulkRealTimeStatisticsInstance( + self._version, payload, workspace_sid=self._solution["workspace_sid"] + ) + + async def create_async( + self, body: Union[object, object] = values.unset + ) -> TaskQueueBulkRealTimeStatisticsInstance: + """ + Asynchronously create the TaskQueueBulkRealTimeStatisticsInstance + + :param body: + + :returns: The created TaskQueueBulkRealTimeStatisticsInstance + """ + + data = body.to_dict() + headers = {"Content-Type": "application/json"} + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return TaskQueueBulkRealTimeStatisticsInstance( + self._version, payload, workspace_sid=self._solution["workspace_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "<Twilio.Taskrouter.V1.TaskQueueBulkRealTimeStatisticsList>" diff --git a/twilio/rest/taskrouter/v1/workspace/worker/__init__.py b/twilio/rest/taskrouter/v1/workspace/worker/__init__.py index a3ce2db7d4f145b3f832c013c47062e8b37e37a9..a236fcae8d679ae178075c1c8608d2f7aa96b807 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/__init__.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -352,7 +352,9 @@ class WorkerContext(InstanceContext): "ActivitySid": activity_sid, "Attributes": attributes, "FriendlyName": friendly_name, - "RejectPendingReservations": reject_pending_reservations, + "RejectPendingReservations": serialize.boolean_to_string( + reject_pending_reservations + ), } ) headers = values.of( @@ -396,7 +398,9 @@ class WorkerContext(InstanceContext): "ActivitySid": activity_sid, "Attributes": attributes, "FriendlyName": friendly_name, - "RejectPendingReservations": reject_pending_reservations, + "RejectPendingReservations": serialize.boolean_to_string( + reject_pending_reservations + ), } ) headers = values.of( diff --git a/twilio/rest/taskrouter/v1/workspace/worker/reservation.py b/twilio/rest/taskrouter/v1/workspace/worker/reservation.py index 2f62c433eff2bf32505589fd01a61c01a1805b31..b7dc4bca9e536c58160be109a25e55df86b6aca0 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/reservation.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/reservation.py @@ -694,9 +694,9 @@ class ReservationContext(InstanceContext): "CallTo": call_to, "CallUrl": call_url, "CallStatusCallbackUrl": call_status_callback_url, - "CallAccept": call_accept, + "CallAccept": serialize.boolean_to_string(call_accept), "RedirectCallSid": redirect_call_sid, - "RedirectAccept": redirect_accept, + "RedirectAccept": serialize.boolean_to_string(redirect_accept), "RedirectUrl": redirect_url, "To": to, "From": from_, @@ -706,14 +706,18 @@ class ReservationContext(InstanceContext): status_callback_event, lambda e: e ), "Timeout": timeout, - "Record": record, - "Muted": muted, + "Record": serialize.boolean_to_string(record), + "Muted": serialize.boolean_to_string(muted), "Beep": beep, - "StartConferenceOnEnter": start_conference_on_enter, - "EndConferenceOnExit": end_conference_on_exit, + "StartConferenceOnEnter": serialize.boolean_to_string( + start_conference_on_enter + ), + "EndConferenceOnExit": serialize.boolean_to_string( + end_conference_on_exit + ), "WaitUrl": wait_url, "WaitMethod": wait_method, - "EarlyMedia": early_media, + "EarlyMedia": serialize.boolean_to_string(early_media), "MaxParticipants": max_participants, "ConferenceStatusCallback": conference_status_callback, "ConferenceStatusCallbackMethod": conference_status_callback_method, @@ -734,8 +738,12 @@ class ReservationContext(InstanceContext): dequeue_status_callback_event, lambda e: e ), "PostWorkActivitySid": post_work_activity_sid, - "EndConferenceOnCustomerExit": end_conference_on_customer_exit, - "BeepOnCustomerEntrance": beep_on_customer_entrance, + "EndConferenceOnCustomerExit": serialize.boolean_to_string( + end_conference_on_customer_exit + ), + "BeepOnCustomerEntrance": serialize.boolean_to_string( + beep_on_customer_entrance + ), "JitterBufferSize": jitter_buffer_size, } ) @@ -893,9 +901,9 @@ class ReservationContext(InstanceContext): "CallTo": call_to, "CallUrl": call_url, "CallStatusCallbackUrl": call_status_callback_url, - "CallAccept": call_accept, + "CallAccept": serialize.boolean_to_string(call_accept), "RedirectCallSid": redirect_call_sid, - "RedirectAccept": redirect_accept, + "RedirectAccept": serialize.boolean_to_string(redirect_accept), "RedirectUrl": redirect_url, "To": to, "From": from_, @@ -905,14 +913,18 @@ class ReservationContext(InstanceContext): status_callback_event, lambda e: e ), "Timeout": timeout, - "Record": record, - "Muted": muted, + "Record": serialize.boolean_to_string(record), + "Muted": serialize.boolean_to_string(muted), "Beep": beep, - "StartConferenceOnEnter": start_conference_on_enter, - "EndConferenceOnExit": end_conference_on_exit, + "StartConferenceOnEnter": serialize.boolean_to_string( + start_conference_on_enter + ), + "EndConferenceOnExit": serialize.boolean_to_string( + end_conference_on_exit + ), "WaitUrl": wait_url, "WaitMethod": wait_method, - "EarlyMedia": early_media, + "EarlyMedia": serialize.boolean_to_string(early_media), "MaxParticipants": max_participants, "ConferenceStatusCallback": conference_status_callback, "ConferenceStatusCallbackMethod": conference_status_callback_method, @@ -933,8 +945,12 @@ class ReservationContext(InstanceContext): dequeue_status_callback_event, lambda e: e ), "PostWorkActivitySid": post_work_activity_sid, - "EndConferenceOnCustomerExit": end_conference_on_customer_exit, - "BeepOnCustomerEntrance": beep_on_customer_entrance, + "EndConferenceOnCustomerExit": serialize.boolean_to_string( + end_conference_on_customer_exit + ), + "BeepOnCustomerEntrance": serialize.boolean_to_string( + beep_on_customer_entrance + ), "JitterBufferSize": jitter_buffer_size, } ) diff --git a/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py b/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py index 64f0c3afe959cd8015b37c8a697b3ec38786ddff..f48ebb3a6226a6cafe517b3a50c5eb38c50036a5 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -246,7 +246,7 @@ class WorkerChannelContext(InstanceContext): data = values.of( { "Capacity": capacity, - "Available": available, + "Available": serialize.boolean_to_string(available), } ) @@ -280,7 +280,7 @@ class WorkerChannelContext(InstanceContext): data = values.of( { "Capacity": capacity, - "Available": available, + "Available": serialize.boolean_to_string(available), } ) diff --git a/twilio/rest/trunking/v1/trunk/__init__.py b/twilio/rest/trunking/v1/trunk/__init__.py index 935ce2718d67ea3d95ab0d7db5da231cc9161dc1..16125ead028621ab62f7fa1515370ad93a2c9406 100644 --- a/twilio/rest/trunking/v1/trunk/__init__.py +++ b/twilio/rest/trunking/v1/trunk/__init__.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -387,8 +387,8 @@ class TrunkContext(InstanceContext): "DisasterRecoveryUrl": disaster_recovery_url, "DisasterRecoveryMethod": disaster_recovery_method, "TransferMode": transfer_mode, - "Secure": secure, - "CnamLookupEnabled": cnam_lookup_enabled, + "Secure": serialize.boolean_to_string(secure), + "CnamLookupEnabled": serialize.boolean_to_string(cnam_lookup_enabled), "TransferCallerId": transfer_caller_id, } ) @@ -435,8 +435,8 @@ class TrunkContext(InstanceContext): "DisasterRecoveryUrl": disaster_recovery_url, "DisasterRecoveryMethod": disaster_recovery_method, "TransferMode": transfer_mode, - "Secure": secure, - "CnamLookupEnabled": cnam_lookup_enabled, + "Secure": serialize.boolean_to_string(secure), + "CnamLookupEnabled": serialize.boolean_to_string(cnam_lookup_enabled), "TransferCallerId": transfer_caller_id, } ) @@ -586,8 +586,8 @@ class TrunkList(ListResource): "DisasterRecoveryUrl": disaster_recovery_url, "DisasterRecoveryMethod": disaster_recovery_method, "TransferMode": transfer_mode, - "Secure": secure, - "CnamLookupEnabled": cnam_lookup_enabled, + "Secure": serialize.boolean_to_string(secure), + "CnamLookupEnabled": serialize.boolean_to_string(cnam_lookup_enabled), "TransferCallerId": transfer_caller_id, } ) @@ -635,8 +635,8 @@ class TrunkList(ListResource): "DisasterRecoveryUrl": disaster_recovery_url, "DisasterRecoveryMethod": disaster_recovery_method, "TransferMode": transfer_mode, - "Secure": secure, - "CnamLookupEnabled": cnam_lookup_enabled, + "Secure": serialize.boolean_to_string(secure), + "CnamLookupEnabled": serialize.boolean_to_string(cnam_lookup_enabled), "TransferCallerId": transfer_caller_id, } ) diff --git a/twilio/rest/trunking/v1/trunk/origination_url.py b/twilio/rest/trunking/v1/trunk/origination_url.py index 426938995e7088fec3e2cb3dbb2577f33e0b689b..bcf0c5205faf39d196fb712731fd09b1f19b061b 100644 --- a/twilio/rest/trunking/v1/trunk/origination_url.py +++ b/twilio/rest/trunking/v1/trunk/origination_url.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -290,7 +290,7 @@ class OriginationUrlContext(InstanceContext): { "Weight": weight, "Priority": priority, - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), "FriendlyName": friendly_name, "SipUrl": sip_url, } @@ -332,7 +332,7 @@ class OriginationUrlContext(InstanceContext): { "Weight": weight, "Priority": priority, - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), "FriendlyName": friendly_name, "SipUrl": sip_url, } @@ -424,7 +424,7 @@ class OriginationUrlList(ListResource): { "Weight": weight, "Priority": priority, - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), "FriendlyName": friendly_name, "SipUrl": sip_url, } @@ -464,7 +464,7 @@ class OriginationUrlList(ListResource): { "Weight": weight, "Priority": priority, - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), "FriendlyName": friendly_name, "SipUrl": sip_url, } diff --git a/twilio/rest/trusthub/v1/compliance_registration_inquiries.py b/twilio/rest/trusthub/v1/compliance_registration_inquiries.py index 264dd4ae316e50435389a9fbfc2c445c946c6a62..d86b72db011d04c07a17d484604b6dd535692603 100644 --- a/twilio/rest/trusthub/v1/compliance_registration_inquiries.py +++ b/twilio/rest/trusthub/v1/compliance_registration_inquiries.py @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, Optional, Union -from twilio.base import values +from twilio.base import serialize, values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -27,6 +27,13 @@ class ComplianceRegistrationInquiriesInstance(InstanceResource): ISV_RESELLER_OR_PARTNER = "isv_reseller_or_partner" UNKNOWN = "unknown" + class BusinessRegistrationAuthority(object): + UK_CRN = "UK:CRN" + US_EIN = "US:EIN" + CA_CBN = "CA:CBN" + AU_ACN = "AU:ACN" + OTHER = "Other" + class EndUserType(object): INDIVIDUAL = "Individual" BUSINESS = "Business" @@ -84,7 +91,10 @@ class ComplianceRegistrationInquiriesList(ListResource): business_identity_type: Union[ "ComplianceRegistrationInquiriesInstance.BusinessIdentityType", object ] = values.unset, - business_registration_authority: Union[str, object] = values.unset, + business_registration_authority: Union[ + "ComplianceRegistrationInquiriesInstance.BusinessRegistrationAuthority", + object, + ] = values.unset, business_legal_name: Union[str, object] = values.unset, notification_email: Union[str, object] = values.unset, accepted_notification_receipt: Union[bool, object] = values.unset, @@ -111,6 +121,14 @@ class ComplianceRegistrationInquiriesList(ListResource): use_address_as_emergency_address: Union[bool, object] = values.unset, file_name: Union[str, object] = values.unset, file: Union[str, object] = values.unset, + first_name: Union[str, object] = values.unset, + last_name: Union[str, object] = values.unset, + date_of_birth: Union[str, object] = values.unset, + individual_email: Union[str, object] = values.unset, + individual_phone: Union[str, object] = values.unset, + is_isv_embed: Union[bool, object] = values.unset, + isv_registering_for_self_or_tenant: Union[str, object] = values.unset, + status_callback_url: Union[str, object] = values.unset, ) -> ComplianceRegistrationInquiriesInstance: """ Create the ComplianceRegistrationInquiriesInstance @@ -118,7 +136,7 @@ class ComplianceRegistrationInquiriesList(ListResource): :param end_user_type: :param phone_number_type: :param business_identity_type: - :param business_registration_authority: The authority that registered the business + :param business_registration_authority: :param business_legal_name: he name of the business or organization using the Tollfree number. :param notification_email: he email address to receive the notification about the verification result. :param accepted_notification_receipt: The email address to receive the notification about the verification result. @@ -145,6 +163,14 @@ class ComplianceRegistrationInquiriesList(ListResource): :param use_address_as_emergency_address: Use the business address as the emergency address :param file_name: The name of the verification document to upload :param file: The verification document to upload + :param first_name: The first name of the Individual User. + :param last_name: The last name of the Individual User. + :param date_of_birth: The date of birth of the Individual User. + :param individual_email: The email address of the Individual User. + :param individual_phone: The phone number of the Individual User. + :param is_isv_embed: Indicates if the inquiry is being started from an ISV embedded component. + :param isv_registering_for_self_or_tenant: Indicates if the isv registering for self or tenant. + :param status_callback_url: The url we call to inform you of bundle changes. :returns: The created ComplianceRegistrationInquiriesInstance """ @@ -157,7 +183,9 @@ class ComplianceRegistrationInquiriesList(ListResource): "BusinessRegistrationAuthority": business_registration_authority, "BusinessLegalName": business_legal_name, "NotificationEmail": notification_email, - "AcceptedNotificationReceipt": accepted_notification_receipt, + "AcceptedNotificationReceipt": serialize.boolean_to_string( + accepted_notification_receipt + ), "BusinessRegistrationNumber": business_registration_number, "BusinessWebsiteUrl": business_website_url, "FriendlyName": friendly_name, @@ -178,9 +206,19 @@ class ComplianceRegistrationInquiriesList(ListResource): "EmergencyAddressSubdivision": emergency_address_subdivision, "EmergencyAddressPostalCode": emergency_address_postal_code, "EmergencyAddressCountryCode": emergency_address_country_code, - "UseAddressAsEmergencyAddress": use_address_as_emergency_address, + "UseAddressAsEmergencyAddress": serialize.boolean_to_string( + use_address_as_emergency_address + ), "FileName": file_name, "File": file, + "FirstName": first_name, + "LastName": last_name, + "DateOfBirth": date_of_birth, + "IndividualEmail": individual_email, + "IndividualPhone": individual_phone, + "IsIsvEmbed": serialize.boolean_to_string(is_isv_embed), + "IsvRegisteringForSelfOrTenant": isv_registering_for_self_or_tenant, + "StatusCallbackUrl": status_callback_url, } ) @@ -199,7 +237,10 @@ class ComplianceRegistrationInquiriesList(ListResource): business_identity_type: Union[ "ComplianceRegistrationInquiriesInstance.BusinessIdentityType", object ] = values.unset, - business_registration_authority: Union[str, object] = values.unset, + business_registration_authority: Union[ + "ComplianceRegistrationInquiriesInstance.BusinessRegistrationAuthority", + object, + ] = values.unset, business_legal_name: Union[str, object] = values.unset, notification_email: Union[str, object] = values.unset, accepted_notification_receipt: Union[bool, object] = values.unset, @@ -226,6 +267,14 @@ class ComplianceRegistrationInquiriesList(ListResource): use_address_as_emergency_address: Union[bool, object] = values.unset, file_name: Union[str, object] = values.unset, file: Union[str, object] = values.unset, + first_name: Union[str, object] = values.unset, + last_name: Union[str, object] = values.unset, + date_of_birth: Union[str, object] = values.unset, + individual_email: Union[str, object] = values.unset, + individual_phone: Union[str, object] = values.unset, + is_isv_embed: Union[bool, object] = values.unset, + isv_registering_for_self_or_tenant: Union[str, object] = values.unset, + status_callback_url: Union[str, object] = values.unset, ) -> ComplianceRegistrationInquiriesInstance: """ Asynchronously create the ComplianceRegistrationInquiriesInstance @@ -233,7 +282,7 @@ class ComplianceRegistrationInquiriesList(ListResource): :param end_user_type: :param phone_number_type: :param business_identity_type: - :param business_registration_authority: The authority that registered the business + :param business_registration_authority: :param business_legal_name: he name of the business or organization using the Tollfree number. :param notification_email: he email address to receive the notification about the verification result. :param accepted_notification_receipt: The email address to receive the notification about the verification result. @@ -260,6 +309,14 @@ class ComplianceRegistrationInquiriesList(ListResource): :param use_address_as_emergency_address: Use the business address as the emergency address :param file_name: The name of the verification document to upload :param file: The verification document to upload + :param first_name: The first name of the Individual User. + :param last_name: The last name of the Individual User. + :param date_of_birth: The date of birth of the Individual User. + :param individual_email: The email address of the Individual User. + :param individual_phone: The phone number of the Individual User. + :param is_isv_embed: Indicates if the inquiry is being started from an ISV embedded component. + :param isv_registering_for_self_or_tenant: Indicates if the isv registering for self or tenant. + :param status_callback_url: The url we call to inform you of bundle changes. :returns: The created ComplianceRegistrationInquiriesInstance """ @@ -272,7 +329,9 @@ class ComplianceRegistrationInquiriesList(ListResource): "BusinessRegistrationAuthority": business_registration_authority, "BusinessLegalName": business_legal_name, "NotificationEmail": notification_email, - "AcceptedNotificationReceipt": accepted_notification_receipt, + "AcceptedNotificationReceipt": serialize.boolean_to_string( + accepted_notification_receipt + ), "BusinessRegistrationNumber": business_registration_number, "BusinessWebsiteUrl": business_website_url, "FriendlyName": friendly_name, @@ -293,9 +352,19 @@ class ComplianceRegistrationInquiriesList(ListResource): "EmergencyAddressSubdivision": emergency_address_subdivision, "EmergencyAddressPostalCode": emergency_address_postal_code, "EmergencyAddressCountryCode": emergency_address_country_code, - "UseAddressAsEmergencyAddress": use_address_as_emergency_address, + "UseAddressAsEmergencyAddress": serialize.boolean_to_string( + use_address_as_emergency_address + ), "FileName": file_name, "File": file, + "FirstName": first_name, + "LastName": last_name, + "DateOfBirth": date_of_birth, + "IndividualEmail": individual_email, + "IndividualPhone": individual_phone, + "IsIsvEmbed": serialize.boolean_to_string(is_isv_embed), + "IsvRegisteringForSelfOrTenant": isv_registering_for_self_or_tenant, + "StatusCallbackUrl": status_callback_url, } ) 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 40f0d6a07dfb5ed32a720057c3a5c6c4e7cccf23..5a19ccaabe60691c0ed553c3192c13ee461e1866 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 @@ -326,6 +326,7 @@ class CustomerProfilesEntityAssignmentsList(ListResource): def stream( self, + object_type: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> Iterator[CustomerProfilesEntityAssignmentsInstance]: @@ -335,6 +336,7 @@ class CustomerProfilesEntityAssignmentsList(ListResource): is reached. The results are returned as a generator, so this operation is memory efficient. + :param str object_type: A string to filter the results by (EndUserType or SupportingDocumentType) machine-name. This is useful when you want to retrieve the entity-assignment of a specific end-user or supporting document. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -345,12 +347,13 @@ class CustomerProfilesEntityAssignmentsList(ListResource): :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(object_type=object_type, page_size=limits["page_size"]) return self._version.stream(page, limits["limit"]) async def stream_async( self, + object_type: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> AsyncIterator[CustomerProfilesEntityAssignmentsInstance]: @@ -360,6 +363,7 @@ class CustomerProfilesEntityAssignmentsList(ListResource): is reached. The results are returned as a generator, so this operation is memory efficient. + :param str object_type: A string to filter the results by (EndUserType or SupportingDocumentType) machine-name. This is useful when you want to retrieve the entity-assignment of a specific end-user or supporting document. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -370,12 +374,15 @@ class CustomerProfilesEntityAssignmentsList(ListResource): :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( + object_type=object_type, page_size=limits["page_size"] + ) return self._version.stream_async(page, limits["limit"]) def list( self, + object_type: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[CustomerProfilesEntityAssignmentsInstance]: @@ -384,6 +391,7 @@ class CustomerProfilesEntityAssignmentsList(ListResource): Unlike stream(), this operation is eager and will load `limit` records into memory before returning. + :param str object_type: A string to filter the results by (EndUserType or SupportingDocumentType) machine-name. This is useful when you want to retrieve the entity-assignment of a specific end-user or supporting document. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -395,6 +403,7 @@ class CustomerProfilesEntityAssignmentsList(ListResource): """ return list( self.stream( + object_type=object_type, limit=limit, page_size=page_size, ) @@ -402,6 +411,7 @@ class CustomerProfilesEntityAssignmentsList(ListResource): async def list_async( self, + object_type: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[CustomerProfilesEntityAssignmentsInstance]: @@ -410,6 +420,7 @@ class CustomerProfilesEntityAssignmentsList(ListResource): Unlike stream(), this operation is eager and will load `limit` records into memory before returning. + :param str object_type: A string to filter the results by (EndUserType or SupportingDocumentType) machine-name. This is useful when you want to retrieve the entity-assignment of a specific end-user or supporting document. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -422,6 +433,7 @@ class CustomerProfilesEntityAssignmentsList(ListResource): return [ record async for record in await self.stream_async( + object_type=object_type, limit=limit, page_size=page_size, ) @@ -429,6 +441,7 @@ class CustomerProfilesEntityAssignmentsList(ListResource): def page( self, + object_type: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -437,6 +450,7 @@ class CustomerProfilesEntityAssignmentsList(ListResource): Retrieve a single page of CustomerProfilesEntityAssignmentsInstance records from the API. Request is executed immediately + :param object_type: A string to filter the results by (EndUserType or SupportingDocumentType) machine-name. This is useful when you want to retrieve the entity-assignment of a specific end-user or supporting document. :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state :param page_size: Number of records to return, defaults to 50 @@ -445,6 +459,7 @@ class CustomerProfilesEntityAssignmentsList(ListResource): """ data = values.of( { + "ObjectType": object_type, "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -458,6 +473,7 @@ class CustomerProfilesEntityAssignmentsList(ListResource): async def page_async( self, + object_type: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -466,6 +482,7 @@ class CustomerProfilesEntityAssignmentsList(ListResource): Asynchronously retrieve a single page of CustomerProfilesEntityAssignmentsInstance records from the API. Request is executed immediately + :param object_type: A string to filter the results by (EndUserType or SupportingDocumentType) machine-name. This is useful when you want to retrieve the entity-assignment of a specific end-user or supporting document. :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state :param page_size: Number of records to return, defaults to 50 @@ -474,6 +491,7 @@ class CustomerProfilesEntityAssignmentsList(ListResource): """ data = values.of( { + "ObjectType": object_type, "PageToken": page_token, "Page": page_number, "PageSize": page_size, 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 68854b9c5e66e5a9095a1a72461d6abb56222c3a..16f07a8927010246f862faf51483ec0576e28556 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 @@ -320,6 +320,7 @@ class TrustProductsEntityAssignmentsList(ListResource): def stream( self, + object_type: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> Iterator[TrustProductsEntityAssignmentsInstance]: @@ -329,6 +330,7 @@ class TrustProductsEntityAssignmentsList(ListResource): is reached. The results are returned as a generator, so this operation is memory efficient. + :param str object_type: A string to filter the results by (EndUserType or SupportingDocumentType) machine-name. This is useful when you want to retrieve the entity-assignment of a specific end-user or supporting document. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -339,12 +341,13 @@ class TrustProductsEntityAssignmentsList(ListResource): :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(object_type=object_type, page_size=limits["page_size"]) return self._version.stream(page, limits["limit"]) async def stream_async( self, + object_type: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> AsyncIterator[TrustProductsEntityAssignmentsInstance]: @@ -354,6 +357,7 @@ class TrustProductsEntityAssignmentsList(ListResource): is reached. The results are returned as a generator, so this operation is memory efficient. + :param str object_type: A string to filter the results by (EndUserType or SupportingDocumentType) machine-name. This is useful when you want to retrieve the entity-assignment of a specific end-user or supporting document. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -364,12 +368,15 @@ class TrustProductsEntityAssignmentsList(ListResource): :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( + object_type=object_type, page_size=limits["page_size"] + ) return self._version.stream_async(page, limits["limit"]) def list( self, + object_type: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[TrustProductsEntityAssignmentsInstance]: @@ -378,6 +385,7 @@ class TrustProductsEntityAssignmentsList(ListResource): Unlike stream(), this operation is eager and will load `limit` records into memory before returning. + :param str object_type: A string to filter the results by (EndUserType or SupportingDocumentType) machine-name. This is useful when you want to retrieve the entity-assignment of a specific end-user or supporting document. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -389,6 +397,7 @@ class TrustProductsEntityAssignmentsList(ListResource): """ return list( self.stream( + object_type=object_type, limit=limit, page_size=page_size, ) @@ -396,6 +405,7 @@ class TrustProductsEntityAssignmentsList(ListResource): async def list_async( self, + object_type: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[TrustProductsEntityAssignmentsInstance]: @@ -404,6 +414,7 @@ class TrustProductsEntityAssignmentsList(ListResource): Unlike stream(), this operation is eager and will load `limit` records into memory before returning. + :param str object_type: A string to filter the results by (EndUserType or SupportingDocumentType) machine-name. This is useful when you want to retrieve the entity-assignment of a specific end-user or supporting document. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -416,6 +427,7 @@ class TrustProductsEntityAssignmentsList(ListResource): return [ record async for record in await self.stream_async( + object_type=object_type, limit=limit, page_size=page_size, ) @@ -423,6 +435,7 @@ class TrustProductsEntityAssignmentsList(ListResource): def page( self, + object_type: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -431,6 +444,7 @@ class TrustProductsEntityAssignmentsList(ListResource): Retrieve a single page of TrustProductsEntityAssignmentsInstance records from the API. Request is executed immediately + :param object_type: A string to filter the results by (EndUserType or SupportingDocumentType) machine-name. This is useful when you want to retrieve the entity-assignment of a specific end-user or supporting document. :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state :param page_size: Number of records to return, defaults to 50 @@ -439,6 +453,7 @@ class TrustProductsEntityAssignmentsList(ListResource): """ data = values.of( { + "ObjectType": object_type, "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -452,6 +467,7 @@ class TrustProductsEntityAssignmentsList(ListResource): async def page_async( self, + object_type: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -460,6 +476,7 @@ class TrustProductsEntityAssignmentsList(ListResource): Asynchronously retrieve a single page of TrustProductsEntityAssignmentsInstance records from the API. Request is executed immediately + :param object_type: A string to filter the results by (EndUserType or SupportingDocumentType) machine-name. This is useful when you want to retrieve the entity-assignment of a specific end-user or supporting document. :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state :param page_size: Number of records to return, defaults to 50 @@ -468,6 +485,7 @@ class TrustProductsEntityAssignmentsList(ListResource): """ data = values.of( { + "ObjectType": object_type, "PageToken": page_token, "Page": page_number, "PageSize": page_size, diff --git a/twilio/rest/verify/v2/service/__init__.py b/twilio/rest/verify/v2/service/__init__.py index 374ecb3ef1376f219549e5e9969c7e51f9c0d15c..9e4d69d52b8f84af997aded4beb49d4186187e36 100644 --- a/twilio/rest/verify/v2/service/__init__.py +++ b/twilio/rest/verify/v2/service/__init__.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -474,14 +474,18 @@ class ServiceContext(InstanceContext): { "FriendlyName": friendly_name, "CodeLength": code_length, - "LookupEnabled": lookup_enabled, - "SkipSmsToLandlines": skip_sms_to_landlines, - "DtmfInputRequired": dtmf_input_required, + "LookupEnabled": serialize.boolean_to_string(lookup_enabled), + "SkipSmsToLandlines": serialize.boolean_to_string( + skip_sms_to_landlines + ), + "DtmfInputRequired": serialize.boolean_to_string(dtmf_input_required), "TtsName": tts_name, - "Psd2Enabled": psd2_enabled, - "DoNotShareWarningEnabled": do_not_share_warning_enabled, - "CustomCodeEnabled": custom_code_enabled, - "Push.IncludeDate": push_include_date, + "Psd2Enabled": serialize.boolean_to_string(psd2_enabled), + "DoNotShareWarningEnabled": serialize.boolean_to_string( + do_not_share_warning_enabled + ), + "CustomCodeEnabled": serialize.boolean_to_string(custom_code_enabled), + "Push.IncludeDate": serialize.boolean_to_string(push_include_date), "Push.ApnCredentialSid": push_apn_credential_sid, "Push.FcmCredentialSid": push_fcm_credential_sid, "Totp.Issuer": totp_issuer, @@ -489,7 +493,9 @@ class ServiceContext(InstanceContext): "Totp.CodeLength": totp_code_length, "Totp.Skew": totp_skew, "DefaultTemplateSid": default_template_sid, - "VerifyEventSubscriptionEnabled": verify_event_subscription_enabled, + "VerifyEventSubscriptionEnabled": serialize.boolean_to_string( + verify_event_subscription_enabled + ), } ) @@ -550,14 +556,18 @@ class ServiceContext(InstanceContext): { "FriendlyName": friendly_name, "CodeLength": code_length, - "LookupEnabled": lookup_enabled, - "SkipSmsToLandlines": skip_sms_to_landlines, - "DtmfInputRequired": dtmf_input_required, + "LookupEnabled": serialize.boolean_to_string(lookup_enabled), + "SkipSmsToLandlines": serialize.boolean_to_string( + skip_sms_to_landlines + ), + "DtmfInputRequired": serialize.boolean_to_string(dtmf_input_required), "TtsName": tts_name, - "Psd2Enabled": psd2_enabled, - "DoNotShareWarningEnabled": do_not_share_warning_enabled, - "CustomCodeEnabled": custom_code_enabled, - "Push.IncludeDate": push_include_date, + "Psd2Enabled": serialize.boolean_to_string(psd2_enabled), + "DoNotShareWarningEnabled": serialize.boolean_to_string( + do_not_share_warning_enabled + ), + "CustomCodeEnabled": serialize.boolean_to_string(custom_code_enabled), + "Push.IncludeDate": serialize.boolean_to_string(push_include_date), "Push.ApnCredentialSid": push_apn_credential_sid, "Push.FcmCredentialSid": push_fcm_credential_sid, "Totp.Issuer": totp_issuer, @@ -565,7 +575,9 @@ class ServiceContext(InstanceContext): "Totp.CodeLength": totp_code_length, "Totp.Skew": totp_skew, "DefaultTemplateSid": default_template_sid, - "VerifyEventSubscriptionEnabled": verify_event_subscription_enabled, + "VerifyEventSubscriptionEnabled": serialize.boolean_to_string( + verify_event_subscription_enabled + ), } ) @@ -753,14 +765,18 @@ class ServiceList(ListResource): { "FriendlyName": friendly_name, "CodeLength": code_length, - "LookupEnabled": lookup_enabled, - "SkipSmsToLandlines": skip_sms_to_landlines, - "DtmfInputRequired": dtmf_input_required, + "LookupEnabled": serialize.boolean_to_string(lookup_enabled), + "SkipSmsToLandlines": serialize.boolean_to_string( + skip_sms_to_landlines + ), + "DtmfInputRequired": serialize.boolean_to_string(dtmf_input_required), "TtsName": tts_name, - "Psd2Enabled": psd2_enabled, - "DoNotShareWarningEnabled": do_not_share_warning_enabled, - "CustomCodeEnabled": custom_code_enabled, - "Push.IncludeDate": push_include_date, + "Psd2Enabled": serialize.boolean_to_string(psd2_enabled), + "DoNotShareWarningEnabled": serialize.boolean_to_string( + do_not_share_warning_enabled + ), + "CustomCodeEnabled": serialize.boolean_to_string(custom_code_enabled), + "Push.IncludeDate": serialize.boolean_to_string(push_include_date), "Push.ApnCredentialSid": push_apn_credential_sid, "Push.FcmCredentialSid": push_fcm_credential_sid, "Totp.Issuer": totp_issuer, @@ -768,7 +784,9 @@ class ServiceList(ListResource): "Totp.CodeLength": totp_code_length, "Totp.Skew": totp_skew, "DefaultTemplateSid": default_template_sid, - "VerifyEventSubscriptionEnabled": verify_event_subscription_enabled, + "VerifyEventSubscriptionEnabled": serialize.boolean_to_string( + verify_event_subscription_enabled + ), } ) @@ -830,14 +848,18 @@ class ServiceList(ListResource): { "FriendlyName": friendly_name, "CodeLength": code_length, - "LookupEnabled": lookup_enabled, - "SkipSmsToLandlines": skip_sms_to_landlines, - "DtmfInputRequired": dtmf_input_required, + "LookupEnabled": serialize.boolean_to_string(lookup_enabled), + "SkipSmsToLandlines": serialize.boolean_to_string( + skip_sms_to_landlines + ), + "DtmfInputRequired": serialize.boolean_to_string(dtmf_input_required), "TtsName": tts_name, - "Psd2Enabled": psd2_enabled, - "DoNotShareWarningEnabled": do_not_share_warning_enabled, - "CustomCodeEnabled": custom_code_enabled, - "Push.IncludeDate": push_include_date, + "Psd2Enabled": serialize.boolean_to_string(psd2_enabled), + "DoNotShareWarningEnabled": serialize.boolean_to_string( + do_not_share_warning_enabled + ), + "CustomCodeEnabled": serialize.boolean_to_string(custom_code_enabled), + "Push.IncludeDate": serialize.boolean_to_string(push_include_date), "Push.ApnCredentialSid": push_apn_credential_sid, "Push.FcmCredentialSid": push_fcm_credential_sid, "Totp.Issuer": totp_issuer, @@ -845,7 +867,9 @@ class ServiceList(ListResource): "Totp.CodeLength": totp_code_length, "Totp.Skew": totp_skew, "DefaultTemplateSid": default_template_sid, - "VerifyEventSubscriptionEnabled": verify_event_subscription_enabled, + "VerifyEventSubscriptionEnabled": serialize.boolean_to_string( + verify_event_subscription_enabled + ), } ) diff --git a/twilio/rest/video/v1/composition.py b/twilio/rest/video/v1/composition.py index 64ee0b2ce8216c4dd0d08711e54e553d84f63e37..30aa33fff804883592daa50f923a58ba888623f4 100644 --- a/twilio/rest/video/v1/composition.py +++ b/twilio/rest/video/v1/composition.py @@ -325,7 +325,7 @@ class CompositionList(ListResource): "Format": format, "StatusCallback": status_callback, "StatusCallbackMethod": status_callback_method, - "Trim": trim, + "Trim": serialize.boolean_to_string(trim), } ) @@ -377,7 +377,7 @@ class CompositionList(ListResource): "Format": format, "StatusCallback": status_callback, "StatusCallbackMethod": status_callback_method, - "Trim": trim, + "Trim": serialize.boolean_to_string(trim), } ) diff --git a/twilio/rest/video/v1/composition_hook.py b/twilio/rest/video/v1/composition_hook.py index f6156e82ff17004004d4e7bd3eed07b1b00f57c5..027a27f740d3ae72a01fbd1a8c20406193498675 100644 --- a/twilio/rest/video/v1/composition_hook.py +++ b/twilio/rest/video/v1/composition_hook.py @@ -336,13 +336,13 @@ class CompositionHookContext(InstanceContext): data = values.of( { "FriendlyName": friendly_name, - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), "VideoLayout": serialize.object(video_layout), "AudioSources": serialize.map(audio_sources, lambda e: e), "AudioSourcesExcluded": serialize.map( audio_sources_excluded, lambda e: e ), - "Trim": trim, + "Trim": serialize.boolean_to_string(trim), "Format": format, "Resolution": resolution, "StatusCallback": status_callback, @@ -392,13 +392,13 @@ class CompositionHookContext(InstanceContext): data = values.of( { "FriendlyName": friendly_name, - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), "VideoLayout": serialize.object(video_layout), "AudioSources": serialize.map(audio_sources, lambda e: e), "AudioSourcesExcluded": serialize.map( audio_sources_excluded, lambda e: e ), - "Trim": trim, + "Trim": serialize.boolean_to_string(trim), "Format": format, "Resolution": resolution, "StatusCallback": status_callback, @@ -491,7 +491,7 @@ class CompositionHookList(ListResource): data = values.of( { "FriendlyName": friendly_name, - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), "VideoLayout": serialize.object(video_layout), "AudioSources": serialize.map(audio_sources, lambda e: e), "AudioSourcesExcluded": serialize.map( @@ -501,7 +501,7 @@ class CompositionHookList(ListResource): "Format": format, "StatusCallback": status_callback, "StatusCallbackMethod": status_callback_method, - "Trim": trim, + "Trim": serialize.boolean_to_string(trim), } ) @@ -546,7 +546,7 @@ class CompositionHookList(ListResource): data = values.of( { "FriendlyName": friendly_name, - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), "VideoLayout": serialize.object(video_layout), "AudioSources": serialize.map(audio_sources, lambda e: e), "AudioSourcesExcluded": serialize.map( @@ -556,7 +556,7 @@ class CompositionHookList(ListResource): "Format": format, "StatusCallback": status_callback, "StatusCallbackMethod": status_callback_method, - "Trim": trim, + "Trim": serialize.boolean_to_string(trim), } ) @@ -749,7 +749,7 @@ class CompositionHookList(ListResource): """ data = values.of( { - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), "DateCreatedAfter": serialize.iso8601_datetime(date_created_after), "DateCreatedBefore": serialize.iso8601_datetime(date_created_before), "FriendlyName": friendly_name, @@ -788,7 +788,7 @@ class CompositionHookList(ListResource): """ data = values.of( { - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), "DateCreatedAfter": serialize.iso8601_datetime(date_created_after), "DateCreatedBefore": serialize.iso8601_datetime(date_created_before), "FriendlyName": friendly_name, diff --git a/twilio/rest/video/v1/composition_settings.py b/twilio/rest/video/v1/composition_settings.py index 7082866b3246d9482a3f713c0eb4915e37d31765..366ec727cf3cb8d08f66c38ab96f97f6a16e85bf 100644 --- a/twilio/rest/video/v1/composition_settings.py +++ b/twilio/rest/video/v1/composition_settings.py @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, Optional, Union -from twilio.base import values +from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -187,8 +187,8 @@ class CompositionSettingsContext(InstanceContext): "AwsCredentialsSid": aws_credentials_sid, "EncryptionKeySid": encryption_key_sid, "AwsS3Url": aws_s3_url, - "AwsStorageEnabled": aws_storage_enabled, - "EncryptionEnabled": encryption_enabled, + "AwsStorageEnabled": serialize.boolean_to_string(aws_storage_enabled), + "EncryptionEnabled": serialize.boolean_to_string(encryption_enabled), } ) @@ -223,8 +223,8 @@ class CompositionSettingsContext(InstanceContext): "AwsCredentialsSid": aws_credentials_sid, "EncryptionKeySid": encryption_key_sid, "AwsS3Url": aws_s3_url, - "AwsStorageEnabled": aws_storage_enabled, - "EncryptionEnabled": encryption_enabled, + "AwsStorageEnabled": serialize.boolean_to_string(aws_storage_enabled), + "EncryptionEnabled": serialize.boolean_to_string(encryption_enabled), } ) diff --git a/twilio/rest/video/v1/recording_settings.py b/twilio/rest/video/v1/recording_settings.py index d0d6e5ebb82818264b7a89fd2a799429b621166e..3895b9d4bad8826667969b8e1409ab919914e93d 100644 --- a/twilio/rest/video/v1/recording_settings.py +++ b/twilio/rest/video/v1/recording_settings.py @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, Optional, Union -from twilio.base import values +from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -187,8 +187,8 @@ class RecordingSettingsContext(InstanceContext): "AwsCredentialsSid": aws_credentials_sid, "EncryptionKeySid": encryption_key_sid, "AwsS3Url": aws_s3_url, - "AwsStorageEnabled": aws_storage_enabled, - "EncryptionEnabled": encryption_enabled, + "AwsStorageEnabled": serialize.boolean_to_string(aws_storage_enabled), + "EncryptionEnabled": serialize.boolean_to_string(encryption_enabled), } ) @@ -223,8 +223,8 @@ class RecordingSettingsContext(InstanceContext): "AwsCredentialsSid": aws_credentials_sid, "EncryptionKeySid": encryption_key_sid, "AwsS3Url": aws_s3_url, - "AwsStorageEnabled": aws_storage_enabled, - "EncryptionEnabled": encryption_enabled, + "AwsStorageEnabled": serialize.boolean_to_string(aws_storage_enabled), + "EncryptionEnabled": serialize.boolean_to_string(encryption_enabled), } ) diff --git a/twilio/rest/video/v1/room/__init__.py b/twilio/rest/video/v1/room/__init__.py index d787c9896e6ea623bb8a007df58714a4b51f3a76..a8ffdb895c9439ea2c04b2cb08c04db2afaee691 100644 --- a/twilio/rest/video/v1/room/__init__.py +++ b/twilio/rest/video/v1/room/__init__.py @@ -437,21 +437,23 @@ class RoomList(ListResource): data = values.of( { - "EnableTurn": enable_turn, + "EnableTurn": serialize.boolean_to_string(enable_turn), "Type": type, "UniqueName": unique_name, "StatusCallback": status_callback, "StatusCallbackMethod": status_callback_method, "MaxParticipants": max_participants, - "RecordParticipantsOnConnect": record_participants_on_connect, + "RecordParticipantsOnConnect": serialize.boolean_to_string( + record_participants_on_connect + ), "VideoCodecs": serialize.map(video_codecs, lambda e: e), "MediaRegion": media_region, "RecordingRules": serialize.object(recording_rules), - "AudioOnly": audio_only, + "AudioOnly": serialize.boolean_to_string(audio_only), "MaxParticipantDuration": max_participant_duration, "EmptyRoomTimeout": empty_room_timeout, "UnusedRoomTimeout": unused_room_timeout, - "LargeRoom": large_room, + "LargeRoom": serialize.boolean_to_string(large_room), } ) @@ -505,21 +507,23 @@ class RoomList(ListResource): data = values.of( { - "EnableTurn": enable_turn, + "EnableTurn": serialize.boolean_to_string(enable_turn), "Type": type, "UniqueName": unique_name, "StatusCallback": status_callback, "StatusCallbackMethod": status_callback_method, "MaxParticipants": max_participants, - "RecordParticipantsOnConnect": record_participants_on_connect, + "RecordParticipantsOnConnect": serialize.boolean_to_string( + record_participants_on_connect + ), "VideoCodecs": serialize.map(video_codecs, lambda e: e), "MediaRegion": media_region, "RecordingRules": serialize.object(recording_rules), - "AudioOnly": audio_only, + "AudioOnly": serialize.boolean_to_string(audio_only), "MaxParticipantDuration": max_participant_duration, "EmptyRoomTimeout": empty_room_timeout, "UnusedRoomTimeout": unused_room_timeout, - "LargeRoom": large_room, + "LargeRoom": serialize.boolean_to_string(large_room), } ) diff --git a/twilio/rest/voice/v1/byoc_trunk.py b/twilio/rest/voice/v1/byoc_trunk.py index 1a8f60984d30debffa223094f1c9c24fda72176a..a85cae660a7ab985e9d4c2ffb40bda0569684815 100644 --- a/twilio/rest/voice/v1/byoc_trunk.py +++ b/twilio/rest/voice/v1/byoc_trunk.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -335,7 +335,7 @@ class ByocTrunkContext(InstanceContext): "VoiceFallbackMethod": voice_fallback_method, "StatusCallbackUrl": status_callback_url, "StatusCallbackMethod": status_callback_method, - "CnamLookupEnabled": cnam_lookup_enabled, + "CnamLookupEnabled": serialize.boolean_to_string(cnam_lookup_enabled), "ConnectionPolicySid": connection_policy_sid, "FromDomainSid": from_domain_sid, } @@ -387,7 +387,7 @@ class ByocTrunkContext(InstanceContext): "VoiceFallbackMethod": voice_fallback_method, "StatusCallbackUrl": status_callback_url, "StatusCallbackMethod": status_callback_method, - "CnamLookupEnabled": cnam_lookup_enabled, + "CnamLookupEnabled": serialize.boolean_to_string(cnam_lookup_enabled), "ConnectionPolicySid": connection_policy_sid, "FromDomainSid": from_domain_sid, } @@ -482,7 +482,7 @@ class ByocTrunkList(ListResource): "VoiceFallbackMethod": voice_fallback_method, "StatusCallbackUrl": status_callback_url, "StatusCallbackMethod": status_callback_method, - "CnamLookupEnabled": cnam_lookup_enabled, + "CnamLookupEnabled": serialize.boolean_to_string(cnam_lookup_enabled), "ConnectionPolicySid": connection_policy_sid, "FromDomainSid": from_domain_sid, } @@ -535,7 +535,7 @@ class ByocTrunkList(ListResource): "VoiceFallbackMethod": voice_fallback_method, "StatusCallbackUrl": status_callback_url, "StatusCallbackMethod": status_callback_method, - "CnamLookupEnabled": cnam_lookup_enabled, + "CnamLookupEnabled": serialize.boolean_to_string(cnam_lookup_enabled), "ConnectionPolicySid": connection_policy_sid, "FromDomainSid": from_domain_sid, } 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 d1f8a41524504d4f7d31be159ebd9321f30e1742..2fa490880a1131f4de91ba128e32d107c2fc844f 100644 --- a/twilio/rest/voice/v1/connection_policy/connection_policy_target.py +++ b/twilio/rest/voice/v1/connection_policy/connection_policy_target.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -294,7 +294,7 @@ class ConnectionPolicyTargetContext(InstanceContext): "Target": target, "Priority": priority, "Weight": weight, - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), } ) @@ -336,7 +336,7 @@ class ConnectionPolicyTargetContext(InstanceContext): "Target": target, "Priority": priority, "Weight": weight, - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), } ) @@ -432,7 +432,7 @@ class ConnectionPolicyTargetList(ListResource): "FriendlyName": friendly_name, "Priority": priority, "Weight": weight, - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), } ) @@ -474,7 +474,7 @@ class ConnectionPolicyTargetList(ListResource): "FriendlyName": friendly_name, "Priority": priority, "Weight": weight, - "Enabled": enabled, + "Enabled": serialize.boolean_to_string(enabled), } ) diff --git a/twilio/rest/voice/v1/dialing_permissions/country/__init__.py b/twilio/rest/voice/v1/dialing_permissions/country/__init__.py index 4f694f41b0fdaf015285679732e619e8d6eb2499..2b9285c112f5cfbc8cf9a118693d5d529927f648 100644 --- a/twilio/rest/voice/v1/dialing_permissions/country/__init__.py +++ b/twilio/rest/voice/v1/dialing_permissions/country/__init__.py @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import values +from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -436,9 +436,15 @@ class CountryList(ListResource): "IsoCode": iso_code, "Continent": continent, "CountryCode": country_code, - "LowRiskNumbersEnabled": low_risk_numbers_enabled, - "HighRiskSpecialNumbersEnabled": high_risk_special_numbers_enabled, - "HighRiskTollfraudNumbersEnabled": high_risk_tollfraud_numbers_enabled, + "LowRiskNumbersEnabled": serialize.boolean_to_string( + low_risk_numbers_enabled + ), + "HighRiskSpecialNumbersEnabled": serialize.boolean_to_string( + high_risk_special_numbers_enabled + ), + "HighRiskTollfraudNumbersEnabled": serialize.boolean_to_string( + high_risk_tollfraud_numbers_enabled + ), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -481,9 +487,15 @@ class CountryList(ListResource): "IsoCode": iso_code, "Continent": continent, "CountryCode": country_code, - "LowRiskNumbersEnabled": low_risk_numbers_enabled, - "HighRiskSpecialNumbersEnabled": high_risk_special_numbers_enabled, - "HighRiskTollfraudNumbersEnabled": high_risk_tollfraud_numbers_enabled, + "LowRiskNumbersEnabled": serialize.boolean_to_string( + low_risk_numbers_enabled + ), + "HighRiskSpecialNumbersEnabled": serialize.boolean_to_string( + high_risk_special_numbers_enabled + ), + "HighRiskTollfraudNumbersEnabled": serialize.boolean_to_string( + high_risk_tollfraud_numbers_enabled + ), "PageToken": page_token, "Page": page_number, "PageSize": page_size, diff --git a/twilio/rest/voice/v1/dialing_permissions/settings.py b/twilio/rest/voice/v1/dialing_permissions/settings.py index 6ede5e3a6f1f1066896630366e6cbfe043a19961..20d845673a84cffa0365a20f159c086e520e3aaf 100644 --- a/twilio/rest/voice/v1/dialing_permissions/settings.py +++ b/twilio/rest/voice/v1/dialing_permissions/settings.py @@ -13,7 +13,7 @@ r""" """ from typing import Any, Dict, Optional, Union -from twilio.base import values +from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -166,7 +166,9 @@ class SettingsContext(InstanceContext): """ data = values.of( { - "DialingPermissionsInheritance": dialing_permissions_inheritance, + "DialingPermissionsInheritance": serialize.boolean_to_string( + dialing_permissions_inheritance + ), } ) @@ -190,7 +192,9 @@ class SettingsContext(InstanceContext): """ data = values.of( { - "DialingPermissionsInheritance": dialing_permissions_inheritance, + "DialingPermissionsInheritance": serialize.boolean_to_string( + dialing_permissions_inheritance + ), } ) diff --git a/twilio/rest/wireless/v1/command.py b/twilio/rest/wireless/v1/command.py index cb33e1d397f81d4dc9e8abad27437d6c6efacf00..f310db89183aafee2868b469b0b900805c3c0966 100644 --- a/twilio/rest/wireless/v1/command.py +++ b/twilio/rest/wireless/v1/command.py @@ -14,7 +14,7 @@ r""" from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -303,7 +303,9 @@ class CommandList(ListResource): "CallbackUrl": callback_url, "CommandMode": command_mode, "IncludeSid": include_sid, - "DeliveryReceiptRequested": delivery_receipt_requested, + "DeliveryReceiptRequested": serialize.boolean_to_string( + delivery_receipt_requested + ), } ) @@ -347,7 +349,9 @@ class CommandList(ListResource): "CallbackUrl": callback_url, "CommandMode": command_mode, "IncludeSid": include_sid, - "DeliveryReceiptRequested": delivery_receipt_requested, + "DeliveryReceiptRequested": serialize.boolean_to_string( + delivery_receipt_requested + ), } ) diff --git a/twilio/rest/wireless/v1/rate_plan.py b/twilio/rest/wireless/v1/rate_plan.py index 2bc893925758902f55035c2f8e0bf95a9dafcef9..0ee1e205a28d0e5175e072fc7d6f510136007f7c 100644 --- a/twilio/rest/wireless/v1/rate_plan.py +++ b/twilio/rest/wireless/v1/rate_plan.py @@ -391,12 +391,14 @@ class RatePlanList(ListResource): { "UniqueName": unique_name, "FriendlyName": friendly_name, - "DataEnabled": data_enabled, + "DataEnabled": serialize.boolean_to_string(data_enabled), "DataLimit": data_limit, "DataMetering": data_metering, - "MessagingEnabled": messaging_enabled, - "VoiceEnabled": voice_enabled, - "NationalRoamingEnabled": national_roaming_enabled, + "MessagingEnabled": serialize.boolean_to_string(messaging_enabled), + "VoiceEnabled": serialize.boolean_to_string(voice_enabled), + "NationalRoamingEnabled": serialize.boolean_to_string( + national_roaming_enabled + ), "InternationalRoaming": serialize.map( international_roaming, lambda e: e ), @@ -449,12 +451,14 @@ class RatePlanList(ListResource): { "UniqueName": unique_name, "FriendlyName": friendly_name, - "DataEnabled": data_enabled, + "DataEnabled": serialize.boolean_to_string(data_enabled), "DataLimit": data_limit, "DataMetering": data_metering, - "MessagingEnabled": messaging_enabled, - "VoiceEnabled": voice_enabled, - "NationalRoamingEnabled": national_roaming_enabled, + "MessagingEnabled": serialize.boolean_to_string(messaging_enabled), + "VoiceEnabled": serialize.boolean_to_string(voice_enabled), + "NationalRoamingEnabled": serialize.boolean_to_string( + national_roaming_enabled + ), "InternationalRoaming": serialize.map( international_roaming, lambda e: e ), diff --git a/twilio/twiml/messaging_response.py b/twilio/twiml/messaging_response.py index b938e1644806495f7b5f922cf2e81469d2573a31..ec36c74c0622ff362f70693a8689ce7a23f59789 100644 --- a/twilio/twiml/messaging_response.py +++ b/twilio/twiml/messaging_response.py @@ -34,7 +34,7 @@ class MessagingResponse(TwiML): :param body: Message Body :param to: Phone Number to send Message to :param from: Phone Number to send Message from - :param action: Action URL + :param action: A URL specifying where Twilio should send status callbacks for the created outbound message. :param method: Action URL Method :param status_callback: Status callback URL. Deprecated in favor of action. :param kwargs: additional attributes