diff --git a/tests/unit/http/test_http_client.py b/tests/unit/http/test_http_client.py index aa41045ea2..9a74139d40 100644 --- a/tests/unit/http/test_http_client.py +++ b/tests/unit/http/test_http_client.py @@ -320,7 +320,7 @@ def test_str_excludes_authorization_header(self): data={"FriendlyName": "My New Account"}, headers={ "Authorization": "Bearer secret-token", - "X-Custom-Header": "Value" + "X-Custom-Header": "Value", }, ) expected = ( diff --git a/twilio/http/request.py b/twilio/http/request.py index 2bb592fdb6..4aef7017bd 100644 --- a/twilio/http/request.py +++ b/twilio/http/request.py @@ -71,7 +71,11 @@ def __str__(self) -> str: headers = "" if self.headers and self.headers != Match.ANY: headers = "\n{}".format( - "\n".join(' -H "{}: {}"'.format(k, v) for k, v in self.headers.items() if k.lower() != "authorization") + "\n".join( + ' -H "{}: {}"'.format(k, v) + for k, v in self.headers.items() + if k.lower() != "authorization" + ) ) return "{method} {url}{params}{data}{headers}".format( diff --git a/twilio/rest/accounts/v1/secondary_auth_token.py b/twilio/rest/accounts/v1/secondary_auth_token.py index f5e2b5c1a3..8932635199 100644 --- a/twilio/rest/accounts/v1/secondary_auth_token.py +++ b/twilio/rest/accounts/v1/secondary_auth_token.py @@ -124,9 +124,15 @@ def create(self) -> SecondaryAuthTokenInstance: :returns: The created SecondaryAuthTokenInstance """ + data = values.of({}) + headers = values.of({}) - payload = self._version.create(method="POST", uri=self._uri, data=data) + headers["Accept"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) return SecondaryAuthTokenInstance(self._version, payload) @@ -137,10 +143,14 @@ async def create_async(self) -> SecondaryAuthTokenInstance: :returns: The created SecondaryAuthTokenInstance """ + data = values.of({}) + headers = values.of({}) + + headers["Accept"] = "application/json" payload = await self._version.create_async( - method="POST", uri=self._uri, data=data + method="POST", uri=self._uri, data=data, headers=headers ) return SecondaryAuthTokenInstance(self._version, payload) diff --git a/twilio/rest/api/v2010/account/recording/__init__.py b/twilio/rest/api/v2010/account/recording/__init__.py index d9fcbd4398..7c480b4730 100644 --- a/twilio/rest/api/v2010/account/recording/__init__.py +++ b/twilio/rest/api/v2010/account/recording/__init__.py @@ -258,7 +258,7 @@ def fetch( :returns: The fetched RecordingInstance """ - data = values.of( + params = values.of( { "IncludeSoftDeleted": serialize.boolean_to_string(include_soft_deleted), } @@ -269,7 +269,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return RecordingInstance( @@ -290,7 +290,7 @@ async def fetch_async( :returns: The fetched RecordingInstance """ - data = values.of( + params = values.of( { "IncludeSoftDeleted": serialize.boolean_to_string(include_soft_deleted), } @@ -301,7 +301,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return RecordingInstance( diff --git a/twilio/rest/assistants/v1/assistant/assistants_knowledge.py b/twilio/rest/assistants/v1/assistant/assistants_knowledge.py index 681d71789b..83f8e380ec 100644 --- a/twilio/rest/assistants/v1/assistant/assistants_knowledge.py +++ b/twilio/rest/assistants/v1/assistant/assistants_knowledge.py @@ -158,9 +158,13 @@ def create(self) -> AssistantsKnowledgeInstance: :returns: The created AssistantsKnowledgeInstance """ + data = values.of({}) + headers = values.of({}) - payload = self._version.create(method="POST", uri=self._uri, data=data) + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) return AssistantsKnowledgeInstance( self._version, @@ -176,10 +180,12 @@ async def create_async(self) -> AssistantsKnowledgeInstance: :returns: The created AssistantsKnowledgeInstance """ + data = values.of({}) + headers = values.of({}) payload = await self._version.create_async( - method="POST", uri=self._uri, data=data + method="POST", uri=self._uri, data=data, headers=headers ) return AssistantsKnowledgeInstance( diff --git a/twilio/rest/assistants/v1/assistant/assistants_tool.py b/twilio/rest/assistants/v1/assistant/assistants_tool.py index ed02410d3c..e28fda1bf6 100644 --- a/twilio/rest/assistants/v1/assistant/assistants_tool.py +++ b/twilio/rest/assistants/v1/assistant/assistants_tool.py @@ -156,9 +156,13 @@ def create(self) -> AssistantsToolInstance: :returns: The created AssistantsToolInstance """ + data = values.of({}) + headers = values.of({}) - payload = self._version.create(method="POST", uri=self._uri, data=data) + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) return AssistantsToolInstance( self._version, @@ -174,10 +178,12 @@ async def create_async(self) -> AssistantsToolInstance: :returns: The created AssistantsToolInstance """ + data = values.of({}) + headers = values.of({}) payload = await self._version.create_async( - method="POST", uri=self._uri, data=data + method="POST", uri=self._uri, data=data, headers=headers ) return AssistantsToolInstance( diff --git a/twilio/rest/flex_api/v1/configuration.py b/twilio/rest/flex_api/v1/configuration.py index 28a66be036..c1e4d09a4f 100644 --- a/twilio/rest/flex_api/v1/configuration.py +++ b/twilio/rest/flex_api/v1/configuration.py @@ -298,7 +298,7 @@ def fetch( :returns: The fetched ConfigurationInstance """ - data = values.of( + params = values.of( { "UiVersion": ui_version, } @@ -309,7 +309,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return ConfigurationInstance( @@ -328,7 +328,7 @@ async def fetch_async( :returns: The fetched ConfigurationInstance """ - data = values.of( + params = values.of( { "UiVersion": ui_version, } @@ -339,7 +339,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return ConfigurationInstance( diff --git a/twilio/rest/flex_api/v1/insights_questionnaires.py b/twilio/rest/flex_api/v1/insights_questionnaires.py index d21aff8242..b836ce16e1 100644 --- a/twilio/rest/flex_api/v1/insights_questionnaires.py +++ b/twilio/rest/flex_api/v1/insights_questionnaires.py @@ -258,19 +258,17 @@ def fetch( :returns: The fetched InsightsQuestionnairesInstance """ - data = values.of( - { - "Authorization": authorization, - } - ) - headers = values.of({}) + if not ( + authorization is values.unset + or (isinstance(authorization, str) and not authorization) + ): + headers["Authorization"] = authorization + headers["Accept"] = "application/json" - payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers - ) + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return InsightsQuestionnairesInstance( self._version, @@ -289,18 +287,18 @@ async def fetch_async( :returns: The fetched InsightsQuestionnairesInstance """ - data = values.of( - { - "Authorization": authorization, - } - ) - headers = values.of({}) + if not ( + authorization is values.unset + or (isinstance(authorization, str) and not authorization) + ): + headers["Authorization"] = authorization + headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, headers=headers ) return InsightsQuestionnairesInstance( diff --git a/twilio/rest/flex_api/v1/insights_session.py b/twilio/rest/flex_api/v1/insights_session.py index b4174aa949..fb8a257403 100644 --- a/twilio/rest/flex_api/v1/insights_session.py +++ b/twilio/rest/flex_api/v1/insights_session.py @@ -114,13 +114,21 @@ def create( :returns: The created InsightsSessionInstance """ - data = values.of( - { - "Authorization": authorization, - } - ) - payload = self._version.create(method="POST", uri=self._uri, data=data) + data = values.of({}) + headers = values.of({}) + + if not ( + authorization is values.unset + or (isinstance(authorization, str) and not authorization) + ): + headers["Authorization"] = authorization + + headers["Accept"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) return InsightsSessionInstance(self._version, payload) @@ -134,14 +142,20 @@ async def create_async( :returns: The created InsightsSessionInstance """ - data = values.of( - { - "Authorization": authorization, - } - ) + + data = values.of({}) + headers = values.of({}) + + if not ( + authorization is values.unset + or (isinstance(authorization, str) and not authorization) + ): + headers["Authorization"] = authorization + + headers["Accept"] = "application/json" payload = await self._version.create_async( - method="POST", uri=self._uri, data=data + method="POST", uri=self._uri, data=data, headers=headers ) return InsightsSessionInstance(self._version, payload) diff --git a/twilio/rest/flex_api/v1/insights_user_roles.py b/twilio/rest/flex_api/v1/insights_user_roles.py index 19cb10b8e4..aea4fc55fc 100644 --- a/twilio/rest/flex_api/v1/insights_user_roles.py +++ b/twilio/rest/flex_api/v1/insights_user_roles.py @@ -109,19 +109,17 @@ def fetch( :returns: The fetched InsightsUserRolesInstance """ - data = values.of( - { - "Authorization": authorization, - } - ) - headers = values.of({}) + if not ( + authorization is values.unset + or (isinstance(authorization, str) and not authorization) + ): + headers["Authorization"] = authorization + headers["Accept"] = "application/json" - payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers - ) + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return InsightsUserRolesInstance( self._version, @@ -139,18 +137,18 @@ async def fetch_async( :returns: The fetched InsightsUserRolesInstance """ - data = values.of( - { - "Authorization": authorization, - } - ) - headers = values.of({}) + if not ( + authorization is values.unset + or (isinstance(authorization, str) and not authorization) + ): + headers["Authorization"] = authorization + headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, headers=headers ) return InsightsUserRolesInstance( diff --git a/twilio/rest/flex_api/v1/plugin/__init__.py b/twilio/rest/flex_api/v1/plugin/__init__.py index 2415c42710..301b1e01ce 100644 --- a/twilio/rest/flex_api/v1/plugin/__init__.py +++ b/twilio/rest/flex_api/v1/plugin/__init__.py @@ -192,19 +192,17 @@ def fetch(self, flex_metadata: Union[str, object] = values.unset) -> PluginInsta :returns: The fetched PluginInstance """ - data = values.of( - { - "Flex-Metadata": flex_metadata, - } - ) - headers = values.of({}) + if not ( + flex_metadata is values.unset + or (isinstance(flex_metadata, str) and not flex_metadata) + ): + headers["Flex-Metadata"] = flex_metadata + headers["Accept"] = "application/json" - payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers - ) + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return PluginInstance( self._version, @@ -223,18 +221,18 @@ async def fetch_async( :returns: The fetched PluginInstance """ - data = values.of( - { - "Flex-Metadata": flex_metadata, - } - ) - headers = values.of({}) + if not ( + flex_metadata is values.unset + or (isinstance(flex_metadata, str) and not flex_metadata) + ): + headers["Flex-Metadata"] = flex_metadata + headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, headers=headers ) return PluginInstance( diff --git a/twilio/rest/flex_api/v1/plugin/plugin_versions.py b/twilio/rest/flex_api/v1/plugin/plugin_versions.py index 4d66ef572b..d3ae6cf618 100644 --- a/twilio/rest/flex_api/v1/plugin/plugin_versions.py +++ b/twilio/rest/flex_api/v1/plugin/plugin_versions.py @@ -152,19 +152,17 @@ def fetch( :returns: The fetched PluginVersionsInstance """ - data = values.of( - { - "Flex-Metadata": flex_metadata, - } - ) - headers = values.of({}) + if not ( + flex_metadata is values.unset + or (isinstance(flex_metadata, str) and not flex_metadata) + ): + headers["Flex-Metadata"] = flex_metadata + headers["Accept"] = "application/json" - payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers - ) + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return PluginVersionsInstance( self._version, @@ -184,18 +182,18 @@ async def fetch_async( :returns: The fetched PluginVersionsInstance """ - data = values.of( - { - "Flex-Metadata": flex_metadata, - } - ) - headers = values.of({}) + if not ( + flex_metadata is values.unset + or (isinstance(flex_metadata, str) and not flex_metadata) + ): + headers["Flex-Metadata"] = flex_metadata + headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, headers=headers ) return PluginVersionsInstance( diff --git a/twilio/rest/flex_api/v1/plugin_configuration/__init__.py b/twilio/rest/flex_api/v1/plugin_configuration/__init__.py index b17d697e3b..03210f40aa 100644 --- a/twilio/rest/flex_api/v1/plugin_configuration/__init__.py +++ b/twilio/rest/flex_api/v1/plugin_configuration/__init__.py @@ -148,19 +148,17 @@ def fetch( :returns: The fetched PluginConfigurationInstance """ - data = values.of( - { - "Flex-Metadata": flex_metadata, - } - ) - headers = values.of({}) + if not ( + flex_metadata is values.unset + or (isinstance(flex_metadata, str) and not flex_metadata) + ): + headers["Flex-Metadata"] = flex_metadata + headers["Accept"] = "application/json" - payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers - ) + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return PluginConfigurationInstance( self._version, @@ -179,18 +177,18 @@ async def fetch_async( :returns: The fetched PluginConfigurationInstance """ - data = values.of( - { - "Flex-Metadata": flex_metadata, - } - ) - headers = values.of({}) + if not ( + flex_metadata is values.unset + or (isinstance(flex_metadata, str) and not flex_metadata) + ): + headers["Flex-Metadata"] = flex_metadata + headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, headers=headers ) return PluginConfigurationInstance( diff --git a/twilio/rest/flex_api/v1/plugin_configuration/configured_plugin.py b/twilio/rest/flex_api/v1/plugin_configuration/configured_plugin.py index 062a7db7b4..a3ffb26da4 100644 --- a/twilio/rest/flex_api/v1/plugin_configuration/configured_plugin.py +++ b/twilio/rest/flex_api/v1/plugin_configuration/configured_plugin.py @@ -164,19 +164,17 @@ def fetch( :returns: The fetched ConfiguredPluginInstance """ - data = values.of( - { - "Flex-Metadata": flex_metadata, - } - ) - headers = values.of({}) + if not ( + flex_metadata is values.unset + or (isinstance(flex_metadata, str) and not flex_metadata) + ): + headers["Flex-Metadata"] = flex_metadata + headers["Accept"] = "application/json" - payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers - ) + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ConfiguredPluginInstance( self._version, @@ -196,18 +194,18 @@ async def fetch_async( :returns: The fetched ConfiguredPluginInstance """ - data = values.of( - { - "Flex-Metadata": flex_metadata, - } - ) - headers = values.of({}) + if not ( + flex_metadata is values.unset + or (isinstance(flex_metadata, str) and not flex_metadata) + ): + headers["Flex-Metadata"] = flex_metadata + headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, headers=headers ) return ConfiguredPluginInstance( diff --git a/twilio/rest/flex_api/v1/plugin_release.py b/twilio/rest/flex_api/v1/plugin_release.py index 0694b05f8b..0432bb9904 100644 --- a/twilio/rest/flex_api/v1/plugin_release.py +++ b/twilio/rest/flex_api/v1/plugin_release.py @@ -130,19 +130,17 @@ def fetch( :returns: The fetched PluginReleaseInstance """ - data = values.of( - { - "Flex-Metadata": flex_metadata, - } - ) - headers = values.of({}) + if not ( + flex_metadata is values.unset + or (isinstance(flex_metadata, str) and not flex_metadata) + ): + headers["Flex-Metadata"] = flex_metadata + headers["Accept"] = "application/json" - payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers - ) + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return PluginReleaseInstance( self._version, @@ -161,18 +159,18 @@ async def fetch_async( :returns: The fetched PluginReleaseInstance """ - data = values.of( - { - "Flex-Metadata": flex_metadata, - } - ) - headers = values.of({}) + if not ( + flex_metadata is values.unset + or (isinstance(flex_metadata, str) and not flex_metadata) + ): + headers["Flex-Metadata"] = flex_metadata + headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, headers=headers ) return PluginReleaseInstance( diff --git a/twilio/rest/insights/v1/call/call_summary.py b/twilio/rest/insights/v1/call/call_summary.py index e21af100a1..eb908abad3 100644 --- a/twilio/rest/insights/v1/call/call_summary.py +++ b/twilio/rest/insights/v1/call/call_summary.py @@ -217,7 +217,7 @@ def fetch( :returns: The fetched CallSummaryInstance """ - data = values.of( + params = values.of( { "ProcessingState": processing_state, } @@ -228,7 +228,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return CallSummaryInstance( @@ -251,7 +251,7 @@ async def fetch_async( :returns: The fetched CallSummaryInstance """ - data = values.of( + params = values.of( { "ProcessingState": processing_state, } @@ -262,7 +262,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return CallSummaryInstance( diff --git a/twilio/rest/insights/v1/conference/conference_participant.py b/twilio/rest/insights/v1/conference/conference_participant.py index 171f4f1f87..54c30a0d3e 100644 --- a/twilio/rest/insights/v1/conference/conference_participant.py +++ b/twilio/rest/insights/v1/conference/conference_participant.py @@ -262,7 +262,7 @@ def fetch( :returns: The fetched ConferenceParticipantInstance """ - data = values.of( + params = values.of( { "Events": events, "Metrics": metrics, @@ -274,7 +274,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return ConferenceParticipantInstance( @@ -298,7 +298,7 @@ async def fetch_async( :returns: The fetched ConferenceParticipantInstance """ - data = values.of( + params = values.of( { "Events": events, "Metrics": metrics, @@ -310,7 +310,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return ConferenceParticipantInstance( diff --git a/twilio/rest/insights/v1/setting.py b/twilio/rest/insights/v1/setting.py index 3c6b746f07..bdd5e5f9a1 100644 --- a/twilio/rest/insights/v1/setting.py +++ b/twilio/rest/insights/v1/setting.py @@ -155,7 +155,7 @@ def fetch( :returns: The fetched SettingInstance """ - data = values.of( + params = values.of( { "SubaccountSid": subaccount_sid, } @@ -166,7 +166,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return SettingInstance( @@ -185,7 +185,7 @@ async def fetch_async( :returns: The fetched SettingInstance """ - data = values.of( + params = values.of( { "SubaccountSid": subaccount_sid, } @@ -196,7 +196,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return SettingInstance( diff --git a/twilio/rest/intelligence/v2/operator_attachment.py b/twilio/rest/intelligence/v2/operator_attachment.py index 6080bc5ebf..00d5d74661 100644 --- a/twilio/rest/intelligence/v2/operator_attachment.py +++ b/twilio/rest/intelligence/v2/operator_attachment.py @@ -136,9 +136,15 @@ def create(self) -> OperatorAttachmentInstance: :returns: The created OperatorAttachmentInstance """ + data = values.of({}) + headers = values.of({}) - payload = self._version.create(method="POST", uri=self._uri, data=data) + headers["Accept"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) return OperatorAttachmentInstance( self._version, @@ -154,10 +160,14 @@ async def create_async(self) -> OperatorAttachmentInstance: :returns: The created OperatorAttachmentInstance """ + data = values.of({}) + headers = values.of({}) + + headers["Accept"] = "application/json" payload = await self._version.create_async( - method="POST", uri=self._uri, data=data + method="POST", uri=self._uri, data=data, headers=headers ) return OperatorAttachmentInstance( diff --git a/twilio/rest/intelligence/v2/transcript/encrypted_operator_results.py b/twilio/rest/intelligence/v2/transcript/encrypted_operator_results.py index b934895dba..2fe8736fcc 100644 --- a/twilio/rest/intelligence/v2/transcript/encrypted_operator_results.py +++ b/twilio/rest/intelligence/v2/transcript/encrypted_operator_results.py @@ -124,7 +124,7 @@ def fetch( :returns: The fetched EncryptedOperatorResultsInstance """ - data = values.of( + params = values.of( { "Redacted": serialize.boolean_to_string(redacted), } @@ -135,7 +135,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return EncryptedOperatorResultsInstance( @@ -155,7 +155,7 @@ async def fetch_async( :returns: The fetched EncryptedOperatorResultsInstance """ - data = values.of( + params = values.of( { "Redacted": serialize.boolean_to_string(redacted), } @@ -166,7 +166,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return EncryptedOperatorResultsInstance( diff --git a/twilio/rest/intelligence/v2/transcript/encrypted_sentences.py b/twilio/rest/intelligence/v2/transcript/encrypted_sentences.py index 2e1dc04dfc..d6b3b1d99d 100644 --- a/twilio/rest/intelligence/v2/transcript/encrypted_sentences.py +++ b/twilio/rest/intelligence/v2/transcript/encrypted_sentences.py @@ -122,7 +122,7 @@ def fetch( :returns: The fetched EncryptedSentencesInstance """ - data = values.of( + params = values.of( { "Redacted": serialize.boolean_to_string(redacted), } @@ -133,7 +133,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return EncryptedSentencesInstance( @@ -153,7 +153,7 @@ async def fetch_async( :returns: The fetched EncryptedSentencesInstance """ - data = values.of( + params = values.of( { "Redacted": serialize.boolean_to_string(redacted), } @@ -164,7 +164,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return EncryptedSentencesInstance( diff --git a/twilio/rest/intelligence/v2/transcript/media.py b/twilio/rest/intelligence/v2/transcript/media.py index 76bc448e9b..26e4258e3a 100644 --- a/twilio/rest/intelligence/v2/transcript/media.py +++ b/twilio/rest/intelligence/v2/transcript/media.py @@ -120,7 +120,7 @@ def fetch(self, redacted: Union[bool, object] = values.unset) -> MediaInstance: :returns: The fetched MediaInstance """ - data = values.of( + params = values.of( { "Redacted": serialize.boolean_to_string(redacted), } @@ -131,7 +131,7 @@ def fetch(self, redacted: Union[bool, object] = values.unset) -> MediaInstance: headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return MediaInstance( @@ -151,7 +151,7 @@ async def fetch_async( :returns: The fetched MediaInstance """ - data = values.of( + params = values.of( { "Redacted": serialize.boolean_to_string(redacted), } @@ -162,7 +162,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return MediaInstance( diff --git a/twilio/rest/intelligence/v2/transcript/operator_result.py b/twilio/rest/intelligence/v2/transcript/operator_result.py index 9ba2c57f62..570262410e 100644 --- a/twilio/rest/intelligence/v2/transcript/operator_result.py +++ b/twilio/rest/intelligence/v2/transcript/operator_result.py @@ -185,7 +185,7 @@ def fetch( :returns: The fetched OperatorResultInstance """ - data = values.of( + params = values.of( { "Redacted": serialize.boolean_to_string(redacted), } @@ -196,7 +196,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return OperatorResultInstance( @@ -217,7 +217,7 @@ async def fetch_async( :returns: The fetched OperatorResultInstance """ - data = values.of( + params = values.of( { "Redacted": serialize.boolean_to_string(redacted), } @@ -228,7 +228,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return OperatorResultInstance( diff --git a/twilio/rest/lookups/v1/phone_number.py b/twilio/rest/lookups/v1/phone_number.py index 304b89ab15..b34081a84f 100644 --- a/twilio/rest/lookups/v1/phone_number.py +++ b/twilio/rest/lookups/v1/phone_number.py @@ -160,7 +160,7 @@ def fetch( :returns: The fetched PhoneNumberInstance """ - data = values.of( + params = values.of( { "CountryCode": country_code, "Type": serialize.map(type, lambda e: e), @@ -168,14 +168,14 @@ def fetch( } ) - data.update(serialize.prefixed_collapsible_map(add_ons_data, "AddOns")) + params.update(serialize.prefixed_collapsible_map(add_ons_data, "AddOns")) headers = values.of({}) headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return PhoneNumberInstance( @@ -202,7 +202,7 @@ async def fetch_async( :returns: The fetched PhoneNumberInstance """ - data = values.of( + params = values.of( { "CountryCode": country_code, "Type": serialize.map(type, lambda e: e), @@ -210,14 +210,14 @@ async def fetch_async( } ) - data.update(serialize.prefixed_collapsible_map(add_ons_data, "AddOns")) + params.update(serialize.prefixed_collapsible_map(add_ons_data, "AddOns")) headers = values.of({}) headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return PhoneNumberInstance( diff --git a/twilio/rest/lookups/v2/lookup_override.py b/twilio/rest/lookups/v2/lookup_override.py index ebd566b125..cd9d243fe7 100644 --- a/twilio/rest/lookups/v2/lookup_override.py +++ b/twilio/rest/lookups/v2/lookup_override.py @@ -263,13 +263,17 @@ def create( :returns: The created LookupOverrideInstance """ - data = values.of( - { - "OverridesRequest": overrides_request, - } - ) + data = overrides_request.to_dict() + + headers = values.of({}) - payload = self._version.create(method="POST", uri=self._uri, data=data) + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) return LookupOverrideInstance( self._version, @@ -288,14 +292,16 @@ async def create_async( :returns: The created LookupOverrideInstance """ - data = values.of( - { - "OverridesRequest": overrides_request, - } - ) + data = overrides_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" payload = await self._version.create_async( - method="POST", uri=self._uri, data=data + method="POST", uri=self._uri, data=data, headers=headers ) return LookupOverrideInstance( diff --git a/twilio/rest/lookups/v2/phone_number.py b/twilio/rest/lookups/v2/phone_number.py index b3c1c3c33b..88d0a14645 100644 --- a/twilio/rest/lookups/v2/phone_number.py +++ b/twilio/rest/lookups/v2/phone_number.py @@ -281,7 +281,7 @@ def fetch( :returns: The fetched PhoneNumberInstance """ - data = values.of( + params = values.of( { "Fields": fields, "CountryCode": country_code, @@ -306,7 +306,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return PhoneNumberInstance( @@ -355,7 +355,7 @@ async def fetch_async( :returns: The fetched PhoneNumberInstance """ - data = values.of( + params = values.of( { "Fields": fields, "CountryCode": country_code, @@ -380,7 +380,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return PhoneNumberInstance( diff --git a/twilio/rest/messaging/v1/deactivations.py b/twilio/rest/messaging/v1/deactivations.py index e2cbf17a94..1d248e1117 100644 --- a/twilio/rest/messaging/v1/deactivations.py +++ b/twilio/rest/messaging/v1/deactivations.py @@ -106,7 +106,7 @@ def fetch(self, date: Union[date, object] = values.unset) -> DeactivationsInstan :returns: The fetched DeactivationsInstance """ - data = values.of( + params = values.of( { "Date": serialize.iso8601_date(date), } @@ -117,7 +117,7 @@ def fetch(self, date: Union[date, object] = values.unset) -> DeactivationsInstan headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return DeactivationsInstance( @@ -136,7 +136,7 @@ async def fetch_async( :returns: The fetched DeactivationsInstance """ - data = values.of( + params = values.of( { "Date": serialize.iso8601_date(date), } @@ -147,7 +147,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return DeactivationsInstance( diff --git a/twilio/rest/messaging/v1/linkshortening_messaging_service.py b/twilio/rest/messaging/v1/linkshortening_messaging_service.py index ac69842a0c..1d6083b131 100644 --- a/twilio/rest/messaging/v1/linkshortening_messaging_service.py +++ b/twilio/rest/messaging/v1/linkshortening_messaging_service.py @@ -139,9 +139,15 @@ def create(self) -> LinkshorteningMessagingServiceInstance: :returns: The created LinkshorteningMessagingServiceInstance """ + data = values.of({}) + headers = values.of({}) - payload = self._version.create(method="POST", uri=self._uri, data=data) + headers["Accept"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) return LinkshorteningMessagingServiceInstance( self._version, @@ -157,10 +163,14 @@ async def create_async(self) -> LinkshorteningMessagingServiceInstance: :returns: The created LinkshorteningMessagingServiceInstance """ + data = values.of({}) + headers = values.of({}) + + headers["Accept"] = "application/json" payload = await self._version.create_async( - method="POST", uri=self._uri, data=data + method="POST", uri=self._uri, data=data, headers=headers ) return LinkshorteningMessagingServiceInstance( diff --git a/twilio/rest/numbers/v1/porting_portability.py b/twilio/rest/numbers/v1/porting_portability.py index 351cd541af..9ea6889de7 100644 --- a/twilio/rest/numbers/v1/porting_portability.py +++ b/twilio/rest/numbers/v1/porting_portability.py @@ -163,7 +163,7 @@ def fetch( :returns: The fetched PortingPortabilityInstance """ - data = values.of( + params = values.of( { "TargetAccountSid": target_account_sid, "AddressSid": address_sid, @@ -175,7 +175,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return PortingPortabilityInstance( @@ -198,7 +198,7 @@ async def fetch_async( :returns: The fetched PortingPortabilityInstance """ - data = values.of( + params = values.of( { "TargetAccountSid": target_account_sid, "AddressSid": address_sid, @@ -210,7 +210,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return PortingPortabilityInstance( diff --git a/twilio/rest/numbers/v2/bulk_hosted_number_order.py b/twilio/rest/numbers/v2/bulk_hosted_number_order.py index 7259c801d2..99cb080bad 100644 --- a/twilio/rest/numbers/v2/bulk_hosted_number_order.py +++ b/twilio/rest/numbers/v2/bulk_hosted_number_order.py @@ -154,7 +154,7 @@ def fetch( :returns: The fetched BulkHostedNumberOrderInstance """ - data = values.of( + params = values.of( { "OrderStatus": order_status, } @@ -165,7 +165,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return BulkHostedNumberOrderInstance( @@ -185,7 +185,7 @@ async def fetch_async( :returns: The fetched BulkHostedNumberOrderInstance """ - data = values.of( + params = values.of( { "OrderStatus": order_status, } @@ -196,7 +196,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return BulkHostedNumberOrderInstance( diff --git a/twilio/rest/numbers/v2/bundle_clone.py b/twilio/rest/numbers/v2/bundle_clone.py index 820fbc9db5..cb7921d57e 100644 --- a/twilio/rest/numbers/v2/bundle_clone.py +++ b/twilio/rest/numbers/v2/bundle_clone.py @@ -177,6 +177,7 @@ def create( :returns: The created BundleCloneInstance """ + data = values.of( { "TargetAccountSid": target_account_sid, @@ -184,8 +185,15 @@ def create( "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" - payload = self._version.create(method="POST", uri=self._uri, data=data) + headers["Accept"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) return BundleCloneInstance( self._version, payload, bundle_sid=self._solution["bundle_sid"] @@ -206,6 +214,7 @@ async def create_async( :returns: The created BundleCloneInstance """ + data = values.of( { "TargetAccountSid": target_account_sid, @@ -213,9 +222,14 @@ async def create_async( "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.create_async( - method="POST", uri=self._uri, data=data + method="POST", uri=self._uri, data=data, headers=headers ) return BundleCloneInstance( diff --git a/twilio/rest/numbers/v2/regulatory_compliance/regulation.py b/twilio/rest/numbers/v2/regulatory_compliance/regulation.py index 9c1227905e..8ba4866157 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/regulation.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/regulation.py @@ -138,7 +138,7 @@ def fetch( :returns: The fetched RegulationInstance """ - data = values.of( + params = values.of( { "IncludeConstraints": serialize.boolean_to_string(include_constraints), } @@ -149,7 +149,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return RegulationInstance( @@ -169,7 +169,7 @@ async def fetch_async( :returns: The fetched RegulationInstance """ - data = values.of( + params = values.of( { "IncludeConstraints": serialize.boolean_to_string(include_constraints), } @@ -180,7 +180,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return RegulationInstance( diff --git a/twilio/rest/preview/wireless/sim/usage.py b/twilio/rest/preview/wireless/sim/usage.py index aff3731b51..46d03c4c73 100644 --- a/twilio/rest/preview/wireless/sim/usage.py +++ b/twilio/rest/preview/wireless/sim/usage.py @@ -143,7 +143,7 @@ def fetch( :returns: The fetched UsageInstance """ - data = values.of( + params = values.of( { "End": end, "Start": start, @@ -155,7 +155,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return UsageInstance( @@ -178,7 +178,7 @@ async def fetch_async( :returns: The fetched UsageInstance """ - data = values.of( + params = values.of( { "End": end, "Start": start, @@ -190,7 +190,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return UsageInstance( diff --git a/twilio/rest/pricing/v2/number.py b/twilio/rest/pricing/v2/number.py index 1dead39347..d7e022a64b 100644 --- a/twilio/rest/pricing/v2/number.py +++ b/twilio/rest/pricing/v2/number.py @@ -139,7 +139,7 @@ def fetch( :returns: The fetched NumberInstance """ - data = values.of( + params = values.of( { "OriginationNumber": origination_number, } @@ -150,7 +150,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return NumberInstance( @@ -170,7 +170,7 @@ async def fetch_async( :returns: The fetched NumberInstance """ - data = values.of( + params = values.of( { "OriginationNumber": origination_number, } @@ -181,7 +181,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return NumberInstance( diff --git a/twilio/rest/pricing/v2/voice/number.py b/twilio/rest/pricing/v2/voice/number.py index 97a3a526ff..f00e9a89f7 100644 --- a/twilio/rest/pricing/v2/voice/number.py +++ b/twilio/rest/pricing/v2/voice/number.py @@ -137,7 +137,7 @@ def fetch( :returns: The fetched NumberInstance """ - data = values.of( + params = values.of( { "OriginationNumber": origination_number, } @@ -148,7 +148,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return NumberInstance( @@ -168,7 +168,7 @@ async def fetch_async( :returns: The fetched NumberInstance """ - data = values.of( + params = values.of( { "OriginationNumber": origination_number, } @@ -179,7 +179,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return NumberInstance( diff --git a/twilio/rest/serverless/v1/service/build/__init__.py b/twilio/rest/serverless/v1/service/build/__init__.py index 5a7b6b7023..2b9e22c3dd 100644 --- a/twilio/rest/serverless/v1/service/build/__init__.py +++ b/twilio/rest/serverless/v1/service/build/__init__.py @@ -211,6 +211,7 @@ def fetch(self) -> BuildInstance: headers = values.of({}) + headers["Accept"] = "application/json" payload = self._version.fetch(method='GET', uri=self._uri , headers=headers) @@ -235,6 +236,7 @@ async def fetch_async(self) -> BuildInstance: headers = values.of({}) + headers["Accept"] = "application/json" payload = await self._version.fetch_async(method='GET', uri=self._uri , headers=headers) diff --git a/twilio/rest/serverless/v1/service/build/build_status.py b/twilio/rest/serverless/v1/service/build/build_status.py index e67c00e00e..43a7c18a77 100644 --- a/twilio/rest/serverless/v1/service/build/build_status.py +++ b/twilio/rest/serverless/v1/service/build/build_status.py @@ -129,6 +129,7 @@ def fetch(self) -> BuildStatusInstance: headers = values.of({}) + headers["Accept"] = "application/json" payload = self._version.fetch(method='GET', uri=self._uri , headers=headers) @@ -153,6 +154,7 @@ async def fetch_async(self) -> BuildStatusInstance: headers = values.of({}) + headers["Accept"] = "application/json" payload = await self._version.fetch_async(method='GET', uri=self._uri , headers=headers) diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py index ef851c755a..7042138c47 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py @@ -244,7 +244,7 @@ def fetch( :returns: The fetched TaskQueueCumulativeStatisticsInstance """ - data = values.of( + params = values.of( { "EndDate": serialize.iso8601_datetime(end_date), "Minutes": minutes, @@ -259,7 +259,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return TaskQueueCumulativeStatisticsInstance( @@ -289,7 +289,7 @@ async def fetch_async( :returns: The fetched TaskQueueCumulativeStatisticsInstance """ - data = values.of( + params = values.of( { "EndDate": serialize.iso8601_datetime(end_date), "Minutes": minutes, @@ -304,7 +304,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return TaskQueueCumulativeStatisticsInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py index c4eb30ddc0..89570e337e 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py @@ -176,7 +176,7 @@ def fetch( :returns: The fetched TaskQueueRealTimeStatisticsInstance """ - data = values.of( + params = values.of( { "TaskChannel": task_channel, } @@ -187,7 +187,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return TaskQueueRealTimeStatisticsInstance( @@ -208,7 +208,7 @@ async def fetch_async( :returns: The fetched TaskQueueRealTimeStatisticsInstance """ - data = values.of( + params = values.of( { "TaskChannel": task_channel, } @@ -219,7 +219,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return TaskQueueRealTimeStatisticsInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py index 2d5d631069..063b32cb16 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py @@ -176,7 +176,7 @@ def fetch( :returns: The fetched TaskQueueStatisticsInstance """ - data = values.of( + params = values.of( { "EndDate": serialize.iso8601_datetime(end_date), "Minutes": minutes, @@ -191,7 +191,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return TaskQueueStatisticsInstance( @@ -221,7 +221,7 @@ async def fetch_async( :returns: The fetched TaskQueueStatisticsInstance """ - data = values.of( + params = values.of( { "EndDate": serialize.iso8601_datetime(end_date), "Minutes": minutes, @@ -236,7 +236,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return TaskQueueStatisticsInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py index eea670aa7d..36a24b249b 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py @@ -166,7 +166,7 @@ def fetch( :returns: The fetched WorkerStatisticsInstance """ - data = values.of( + params = values.of( { "Minutes": minutes, "StartDate": serialize.iso8601_datetime(start_date), @@ -180,7 +180,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return WorkerStatisticsInstance( @@ -208,7 +208,7 @@ async def fetch_async( :returns: The fetched WorkerStatisticsInstance """ - data = values.of( + params = values.of( { "Minutes": minutes, "StartDate": serialize.iso8601_datetime(start_date), @@ -222,7 +222,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return WorkerStatisticsInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py index 48a78710e2..382c16797d 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py @@ -188,7 +188,7 @@ def fetch( :returns: The fetched WorkersCumulativeStatisticsInstance """ - data = values.of( + params = values.of( { "EndDate": serialize.iso8601_datetime(end_date), "Minutes": minutes, @@ -202,7 +202,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return WorkersCumulativeStatisticsInstance( @@ -229,7 +229,7 @@ async def fetch_async( :returns: The fetched WorkersCumulativeStatisticsInstance """ - data = values.of( + params = values.of( { "EndDate": serialize.iso8601_datetime(end_date), "Minutes": minutes, @@ -243,7 +243,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return WorkersCumulativeStatisticsInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py index 2e9970478e..73c2175a52 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py @@ -132,7 +132,7 @@ def fetch( :returns: The fetched WorkersRealTimeStatisticsInstance """ - data = values.of( + params = values.of( { "TaskChannel": task_channel, } @@ -143,7 +143,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return WorkersRealTimeStatisticsInstance( @@ -163,7 +163,7 @@ async def fetch_async( :returns: The fetched WorkersRealTimeStatisticsInstance """ - data = values.of( + params = values.of( { "TaskChannel": task_channel, } @@ -174,7 +174,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return WorkersRealTimeStatisticsInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py index 31c79ee6ba..c63fbe9056 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py @@ -178,7 +178,7 @@ def fetch( :returns: The fetched WorkersStatisticsInstance """ - data = values.of( + params = values.of( { "Minutes": minutes, "StartDate": serialize.iso8601_datetime(start_date), @@ -195,7 +195,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return WorkersStatisticsInstance( @@ -228,7 +228,7 @@ async def fetch_async( :returns: The fetched WorkersStatisticsInstance """ - data = values.of( + params = values.of( { "Minutes": minutes, "StartDate": serialize.iso8601_datetime(start_date), @@ -245,7 +245,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return WorkersStatisticsInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py index d6d7c094cc..879665a023 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py @@ -244,7 +244,7 @@ def fetch( :returns: The fetched WorkflowCumulativeStatisticsInstance """ - data = values.of( + params = values.of( { "EndDate": serialize.iso8601_datetime(end_date), "Minutes": minutes, @@ -259,7 +259,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return WorkflowCumulativeStatisticsInstance( @@ -289,7 +289,7 @@ async def fetch_async( :returns: The fetched WorkflowCumulativeStatisticsInstance """ - data = values.of( + params = values.of( { "EndDate": serialize.iso8601_datetime(end_date), "Minutes": minutes, @@ -304,7 +304,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return WorkflowCumulativeStatisticsInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py index 9387622518..f9feda29ed 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py @@ -156,7 +156,7 @@ def fetch( :returns: The fetched WorkflowRealTimeStatisticsInstance """ - data = values.of( + params = values.of( { "TaskChannel": task_channel, } @@ -167,7 +167,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return WorkflowRealTimeStatisticsInstance( @@ -188,7 +188,7 @@ async def fetch_async( :returns: The fetched WorkflowRealTimeStatisticsInstance """ - data = values.of( + params = values.of( { "TaskChannel": task_channel, } @@ -199,7 +199,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return WorkflowRealTimeStatisticsInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py index e49bd32d6e..2c32049107 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py @@ -176,7 +176,7 @@ def fetch( :returns: The fetched WorkflowStatisticsInstance """ - data = values.of( + params = values.of( { "Minutes": minutes, "StartDate": serialize.iso8601_datetime(start_date), @@ -191,7 +191,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return WorkflowStatisticsInstance( @@ -221,7 +221,7 @@ async def fetch_async( :returns: The fetched WorkflowStatisticsInstance """ - data = values.of( + params = values.of( { "Minutes": minutes, "StartDate": serialize.iso8601_datetime(start_date), @@ -236,7 +236,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return WorkflowStatisticsInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py index 3747b395d2..94ab42fb98 100644 --- a/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py @@ -232,7 +232,7 @@ def fetch( :returns: The fetched WorkspaceCumulativeStatisticsInstance """ - data = values.of( + params = values.of( { "EndDate": serialize.iso8601_datetime(end_date), "Minutes": minutes, @@ -247,7 +247,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return WorkspaceCumulativeStatisticsInstance( @@ -276,7 +276,7 @@ async def fetch_async( :returns: The fetched WorkspaceCumulativeStatisticsInstance """ - data = values.of( + params = values.of( { "EndDate": serialize.iso8601_datetime(end_date), "Minutes": minutes, @@ -291,7 +291,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return WorkspaceCumulativeStatisticsInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py index 923a94bf3a..3ef6ec9997 100644 --- a/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py @@ -152,7 +152,7 @@ def fetch( :returns: The fetched WorkspaceRealTimeStatisticsInstance """ - data = values.of( + params = values.of( { "TaskChannel": task_channel, } @@ -163,7 +163,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return WorkspaceRealTimeStatisticsInstance( @@ -183,7 +183,7 @@ async def fetch_async( :returns: The fetched WorkspaceRealTimeStatisticsInstance """ - data = values.of( + params = values.of( { "TaskChannel": task_channel, } @@ -194,7 +194,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return WorkspaceRealTimeStatisticsInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py b/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py index b8414a5c6c..66f41e239c 100644 --- a/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py @@ -160,7 +160,7 @@ def fetch( :returns: The fetched WorkspaceStatisticsInstance """ - data = values.of( + params = values.of( { "Minutes": minutes, "StartDate": serialize.iso8601_datetime(start_date), @@ -175,7 +175,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return WorkspaceStatisticsInstance( @@ -204,7 +204,7 @@ async def fetch_async( :returns: The fetched WorkspaceStatisticsInstance """ - data = values.of( + params = values.of( { "Minutes": minutes, "StartDate": serialize.iso8601_datetime(start_date), @@ -219,7 +219,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return WorkspaceStatisticsInstance( diff --git a/twilio/rest/verify/v2/service/new_challenge.py b/twilio/rest/verify/v2/service/new_challenge.py index db48d49ec7..48857d8ea2 100644 --- a/twilio/rest/verify/v2/service/new_challenge.py +++ b/twilio/rest/verify/v2/service/new_challenge.py @@ -197,13 +197,17 @@ def create( :returns: The created NewChallengeInstance """ - data = values.of( - { - "CreatePasskeysChallengeRequest": create_passkeys_challenge_request, - } - ) + data = create_passkeys_challenge_request.to_dict() + + headers = values.of({}) - payload = self._version.create(method="POST", uri=self._uri, data=data) + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) return NewChallengeInstance( self._version, payload, service_sid=self._solution["service_sid"] @@ -219,14 +223,16 @@ async def create_async( :returns: The created NewChallengeInstance """ - data = values.of( - { - "CreatePasskeysChallengeRequest": create_passkeys_challenge_request, - } - ) + data = create_passkeys_challenge_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" payload = await self._version.create_async( - method="POST", uri=self._uri, data=data + method="POST", uri=self._uri, data=data, headers=headers ) return NewChallengeInstance( diff --git a/twilio/rest/verify/v2/verification_attempts_summary.py b/twilio/rest/verify/v2/verification_attempts_summary.py index 7c9c22b76b..29f8b8eac8 100644 --- a/twilio/rest/verify/v2/verification_attempts_summary.py +++ b/twilio/rest/verify/v2/verification_attempts_summary.py @@ -181,7 +181,7 @@ def fetch( :returns: The fetched VerificationAttemptsSummaryInstance """ - data = values.of( + params = values.of( { "VerifyServiceSid": verify_service_sid, "DateCreatedAfter": serialize.iso8601_datetime(date_created_after), @@ -197,7 +197,7 @@ def fetch( headers["Accept"] = "application/json" payload = self._version.fetch( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return VerificationAttemptsSummaryInstance( @@ -229,7 +229,7 @@ async def fetch_async( :returns: The fetched VerificationAttemptsSummaryInstance """ - data = values.of( + params = values.of( { "VerifyServiceSid": verify_service_sid, "DateCreatedAfter": serialize.iso8601_datetime(date_created_after), @@ -245,7 +245,7 @@ async def fetch_async( headers["Accept"] = "application/json" payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data, headers=headers + method="GET", uri=self._uri, params=params, headers=headers ) return VerificationAttemptsSummaryInstance( diff --git a/twilio/rest/video/v1/composition_settings.py b/twilio/rest/video/v1/composition_settings.py index 384ae692e8..084a1d8cdd 100644 --- a/twilio/rest/video/v1/composition_settings.py +++ b/twilio/rest/video/v1/composition_settings.py @@ -181,6 +181,7 @@ def create( :returns: The created CompositionSettingsInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -191,8 +192,15 @@ def create( "EncryptionEnabled": serialize.boolean_to_string(encryption_enabled), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" - payload = self._version.create(method="POST", uri=self._uri, data=data) + headers["Accept"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) return CompositionSettingsInstance(self._version, payload) @@ -217,6 +225,7 @@ async def create_async( :returns: The created CompositionSettingsInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -227,9 +236,14 @@ async def create_async( "EncryptionEnabled": serialize.boolean_to_string(encryption_enabled), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.create_async( - method="POST", uri=self._uri, data=data + method="POST", uri=self._uri, data=data, headers=headers ) return CompositionSettingsInstance(self._version, payload) diff --git a/twilio/rest/video/v1/recording_settings.py b/twilio/rest/video/v1/recording_settings.py index 46259b6cf8..f76f5c8f21 100644 --- a/twilio/rest/video/v1/recording_settings.py +++ b/twilio/rest/video/v1/recording_settings.py @@ -181,6 +181,7 @@ def create( :returns: The created RecordingSettingsInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -191,8 +192,15 @@ def create( "EncryptionEnabled": serialize.boolean_to_string(encryption_enabled), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" - payload = self._version.create(method="POST", uri=self._uri, data=data) + headers["Accept"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) return RecordingSettingsInstance(self._version, payload) @@ -217,6 +225,7 @@ async def create_async( :returns: The created RecordingSettingsInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -227,9 +236,14 @@ async def create_async( "EncryptionEnabled": serialize.boolean_to_string(encryption_enabled), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.create_async( - method="POST", uri=self._uri, data=data + method="POST", uri=self._uri, data=data, headers=headers ) return RecordingSettingsInstance(self._version, payload)