From 9b57e31673d77f5f4632d1694ecdf90fdb54e320 Mon Sep 17 00:00:00 2001 From: Twilio Date: Wed, 14 Dec 2022 13:59:05 -0800 Subject: [PATCH] [Librarian] Regenerated @ 964f1611ab7481d828261f49551385a276499e30 --- CHANGES.md | 42 ++++ .../test_user_defined_message_subscription.py | 6 +- .../api/v2010/account/test_address.py | 4 + .../integration/flex_api/v1/test_good_data.py | 6 +- .../flex_api/v1/test_user_roles.py | 4 +- tests/integration/flex_api/v2/__init__.py | 8 + .../flex_api/v2/test_web_channels.py | 44 +++++ .../v1/service/test_us_app_to_person.py | 7 +- .../integration/microvisor/v1/test_device.py | 3 + .../integration/oauth/v1/test_device_code.py | 49 +++++ .../oauth/v1/test_openid_discovery.py | 4 +- .../supersim/v1/test_settings_update.py | 86 +++++++- .../v1/workspace/test_task_queue.py | 12 +- .../taskrouter/v1/workspace/test_worker.py | 4 + .../api/v2010/account/address/__init__.py | 21 +- .../call/user_defined_message_subscription.py | 6 +- twilio/rest/flex_api/__init__.py | 19 ++ twilio/rest/flex_api/v1/good_data.py | 12 +- twilio/rest/flex_api/v1/user_roles.py | 2 +- twilio/rest/flex_api/v2/__init__.py | 42 ++++ twilio/rest/flex_api/v2/web_channels.py | 149 ++++++++++++++ .../messaging/v1/service/us_app_to_person.py | 10 +- twilio/rest/oauth/__init__.py | 7 + twilio/rest/oauth/v1/__init__.py | 11 ++ twilio/rest/oauth/v1/device_code.py | 183 ++++++++++++++++++ twilio/rest/oauth/v1/openid_discovery.py | 2 +- twilio/rest/supersim/v1/settings_update.py | 23 ++- twilio/twiml/voice_response.py | 84 ++++---- 28 files changed, 763 insertions(+), 87 deletions(-) create mode 100644 tests/integration/flex_api/v2/__init__.py create mode 100644 tests/integration/flex_api/v2/test_web_channels.py create mode 100644 tests/integration/oauth/v1/test_device_code.py create mode 100644 twilio/rest/flex_api/v2/__init__.py create mode 100644 twilio/rest/flex_api/v2/web_channels.py create mode 100644 twilio/rest/oauth/v1/device_code.py diff --git a/CHANGES.md b/CHANGES.md index 26f7ba4b0e..463ce65ad6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,48 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2022-12-14] Version 7.16.0 +--------------------------- +**Library - Docs** +- [PR #631](https://github.com/twilio/twilio-python/pull/631): Updated docstrings for timeout to be float instead of int. Thanks to [@byarmis](https://github.com/byarmis)! + +**Library - Chore** +- [PR #627](https://github.com/twilio/twilio-python/pull/627): add support for python 3.11. Thanks to [@JenniferMah](https://github.com/JenniferMah)! + +**Library - Test** +- [PR #628](https://github.com/twilio/twilio-python/pull/628): Pinning ubuntu version for python 3.6 test runs. Thanks to [@rakatyal](https://github.com/rakatyal)! + +**Api** +- Add `street_secondary` param to address create and update +- Make `method` optional for user defined message subscription **(breaking change)** + +**Flex** +- Flex Conversations is now Generally Available +- Adding the ie1 mapping for authorization api, updating service base uri and base url response attribute **(breaking change)** +- Change web channels to GA and library visibility to public +- Changing the uri for authorization api from using Accounts to Insights **(breaking change)** + +**Media** +- Gate Twilio Live endpoints behind beta_feature for EOS + +**Messaging** +- Mark `MessageFlow` as a required field for Campaign Creation **(breaking change)** + +**Oauth** +- updated openid discovery endpoint uri **(breaking change)** +- Added device code authorization endpoint + +**Supersim** +- Allow filtering the SettingsUpdates resource by `status` + +**Twiml** +- Add new Polly Neural voices +- Add tr-TR, ar-AE, yue-CN, fi-FI languages to SSML `` element. +- Add x-amazon-jyutping, x-amazon-pinyin, x-amazon-pron-kana, x-amazon-yomigana alphabets to SSML `` element. +- Rename `character` value for SSML `` `interpret-as` attribute to `characters`. **(breaking change)** +- Rename `role` attribute to `format` in SSML `` element. **(breaking change)** + + [2022-11-30] Version 7.15.4 --------------------------- **Flex** diff --git a/tests/integration/api/v2010/account/call/test_user_defined_message_subscription.py b/tests/integration/api/v2010/account/call/test_user_defined_message_subscription.py index 4c07bc0c6d..cb601dd4ba 100644 --- a/tests/integration/api/v2010/account/call/test_user_defined_message_subscription.py +++ b/tests/integration/api/v2010/account/call/test_user_defined_message_subscription.py @@ -20,9 +20,9 @@ def test_create_request(self): with self.assertRaises(TwilioException): self.client.api.v2010.accounts("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ .calls("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ - .user_defined_message_subscriptions.create(callback="https://example.com", method="GET") + .user_defined_message_subscriptions.create(callback="https://example.com") - values = {'Callback': "https://example.com", 'Method': "GET", } + values = {'Callback': "https://example.com", } self.holodeck.assert_has_request(Request( 'post', @@ -46,7 +46,7 @@ def test_create_response(self): actual = self.client.api.v2010.accounts("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ .calls("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ - .user_defined_message_subscriptions.create(callback="https://example.com", method="GET") + .user_defined_message_subscriptions.create(callback="https://example.com") self.assertIsNotNone(actual) diff --git a/tests/integration/api/v2010/account/test_address.py b/tests/integration/api/v2010/account/test_address.py index 2c6501cdb2..8a4add650e 100644 --- a/tests/integration/api/v2010/account/test_address.py +++ b/tests/integration/api/v2010/account/test_address.py @@ -53,6 +53,7 @@ def test_create_response(self): "region": "CA", "sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "street": "4th", + "street_secondary": null, "validated": false, "verified": false, "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Addresses/ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json" @@ -117,6 +118,7 @@ def test_fetch_response(self): "region": "CA", "sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "street": "4th", + "street_secondary": null, "validated": false, "verified": false, "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Addresses/ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json" @@ -158,6 +160,7 @@ def test_update_response(self): "region": "CA", "sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "street": "4th", + "street_secondary": null, "validated": false, "verified": false, "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Addresses/ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json" @@ -201,6 +204,7 @@ def test_read_full_response(self): "region": "CA", "sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "street": "4th", + "street_secondary": null, "validated": false, "verified": false, "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Addresses/ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json" diff --git a/tests/integration/flex_api/v1/test_good_data.py b/tests/integration/flex_api/v1/test_good_data.py index c1946b69e5..d6dbfcdb82 100644 --- a/tests/integration/flex_api/v1/test_good_data.py +++ b/tests/integration/flex_api/v1/test_good_data.py @@ -23,7 +23,7 @@ def test_create_request(self): headers = {'Token': "token", } self.holodeck.assert_has_request(Request( 'post', - 'https://flex-api.twilio.com/v1/Accounts/GoodData', + 'https://flex-api.twilio.com/v1/Insights/Session', headers=headers, )) @@ -35,8 +35,8 @@ def test_create_response(self): "session_expiry": "2022-09-27T09:28:01Z", "workspace_id": "clbi1eelh1x8z4.......ijpnyu", "session_id": "-----BEGIN PGP MESSAGE-----\\n\\nwcBMA11tX1FL13rp\\u2026\\u2026kHXd\\n=vOBk\\n-----END PGP MESSAGE-----\\n", - "gd_base_url": "https://analytics.ytica.com/", - "url": "https://flex-api.twilio.com/v1/Accounts/GoodData" + "base_url": "https://analytics.ytica.com/", + "url": "https://flex-api.twilio.com/v1/Insights/Session" } ''' )) diff --git a/tests/integration/flex_api/v1/test_user_roles.py b/tests/integration/flex_api/v1/test_user_roles.py index 406eaf8a84..94570834bd 100644 --- a/tests/integration/flex_api/v1/test_user_roles.py +++ b/tests/integration/flex_api/v1/test_user_roles.py @@ -23,7 +23,7 @@ def test_fetch_request(self): headers = {'Token': "token", } self.holodeck.assert_has_request(Request( 'get', - 'https://flex-api.twilio.com/v1/Accounts/UserRoles', + 'https://flex-api.twilio.com/v1/Insights/UserRoles', headers=headers, )) @@ -35,7 +35,7 @@ def test_fetch_response(self): "roles": [ "wfo.full_access" ], - "url": "https://flex-api.twilio.com/v1/Accounts/UserRoles" + "url": "https://flex-api.twilio.com/v1/Insights/UserRoles" } ''' )) diff --git a/tests/integration/flex_api/v2/__init__.py b/tests/integration/flex_api/v2/__init__.py new file mode 100644 index 0000000000..c9fc143806 --- /dev/null +++ b/tests/integration/flex_api/v2/__init__.py @@ -0,0 +1,8 @@ +# coding=utf-8 +r""" +This code was generated by +\ / _ _ _| _ _ + | (_)\/(_)(_|\/| |(/_ v1.0.0 + / / +""" + diff --git a/tests/integration/flex_api/v2/test_web_channels.py b/tests/integration/flex_api/v2/test_web_channels.py new file mode 100644 index 0000000000..7b4616f617 --- /dev/null +++ b/tests/integration/flex_api/v2/test_web_channels.py @@ -0,0 +1,44 @@ +# coding=utf-8 +r""" +This code was generated by +\ / _ _ _| _ _ + | (_)\/(_)(_|\/| |(/_ v1.0.0 + / / +""" + +from tests import IntegrationTestCase +from tests.holodeck import Request +from twilio.base.exceptions import TwilioException +from twilio.http.response import Response + + +class WebChannelsTestCase(IntegrationTestCase): + + def test_create_request(self): + self.holodeck.mock(Response(500, '')) + + with self.assertRaises(TwilioException): + self.client.flex_api.v2.web_channels.create(address_sid="address_sid") + + values = {'AddressSid': "address_sid", } + + self.holodeck.assert_has_request(Request( + 'post', + 'https://flex-api.twilio.com/v2/WebChats', + data=values, + )) + + def test_create_response(self): + self.holodeck.mock(Response( + 201, + ''' + { + "conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "identity": "seinfeld" + } + ''' + )) + + actual = self.client.flex_api.v2.web_channels.create(address_sid="address_sid") + + self.assertIsNotNone(actual) diff --git a/tests/integration/messaging/v1/service/test_us_app_to_person.py b/tests/integration/messaging/v1/service/test_us_app_to_person.py index 29566ab85c..9321dd1232 100644 --- a/tests/integration/messaging/v1/service/test_us_app_to_person.py +++ b/tests/integration/messaging/v1/service/test_us_app_to_person.py @@ -20,11 +20,12 @@ def test_create_request(self): with self.assertRaises(TwilioException): self.client.messaging.v1.services("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ - .us_app_to_person.create(brand_registration_sid="BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", description="description", message_samples=['message_samples'], us_app_to_person_usecase="us_app_to_person_usecase", has_embedded_links=True, has_embedded_phone=True) + .us_app_to_person.create(brand_registration_sid="BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", description="description", message_flow="message_flow", message_samples=['message_samples'], us_app_to_person_usecase="us_app_to_person_usecase", has_embedded_links=True, has_embedded_phone=True) values = { 'BrandRegistrationSid': "BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 'Description': "description", + 'MessageFlow': "message_flow", 'MessageSamples': serialize.map(['message_samples'], lambda e: e), 'UsAppToPersonUsecase': "us_app_to_person_usecase", 'HasEmbeddedLinks': True, @@ -88,7 +89,7 @@ def test_create_response(self): )) actual = self.client.messaging.v1.services("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ - .us_app_to_person.create(brand_registration_sid="BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", description="description", message_samples=['message_samples'], us_app_to_person_usecase="us_app_to_person_usecase", has_embedded_links=True, has_embedded_phone=True) + .us_app_to_person.create(brand_registration_sid="BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", description="description", message_flow="message_flow", message_samples=['message_samples'], us_app_to_person_usecase="us_app_to_person_usecase", has_embedded_links=True, has_embedded_phone=True) self.assertIsNotNone(actual) @@ -149,7 +150,7 @@ def test_create_with_defaults_response(self): )) actual = self.client.messaging.v1.services("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ - .us_app_to_person.create(brand_registration_sid="BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", description="description", message_samples=['message_samples'], us_app_to_person_usecase="us_app_to_person_usecase", has_embedded_links=True, has_embedded_phone=True) + .us_app_to_person.create(brand_registration_sid="BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", description="description", message_flow="message_flow", message_samples=['message_samples'], us_app_to_person_usecase="us_app_to_person_usecase", has_embedded_links=True, has_embedded_phone=True) self.assertIsNotNone(actual) diff --git a/tests/integration/microvisor/v1/test_device.py b/tests/integration/microvisor/v1/test_device.py index 1dff6c224e..5178726e88 100644 --- a/tests/integration/microvisor/v1/test_device.py +++ b/tests/integration/microvisor/v1/test_device.py @@ -75,6 +75,7 @@ def test_read_full_response(self): "date_updated": "2021-01-01T12:34:56Z", "url": "https://microvisor.twilio.com/v1/Devices/UVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { + "device_configs": "https://microvisor.twilio.com/v1/Devices/UVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Configs", "device_secrets": "https://microvisor.twilio.com/v1/Devices/UVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Secrets" } } @@ -132,6 +133,7 @@ def test_fetch_response(self): "date_updated": "2021-01-01T12:34:56Z", "url": "https://microvisor.twilio.com/v1/Devices/UVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { + "device_configs": "https://microvisor.twilio.com/v1/Devices/UVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Configs", "device_secrets": "https://microvisor.twilio.com/v1/Devices/UVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Secrets" } } @@ -178,6 +180,7 @@ def test_update_response(self): "date_updated": "2015-07-30T20:00:00Z", "url": "https://microvisor.twilio.com/v1/Devices/UVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { + "device_configs": "https://microvisor.twilio.com/v1/Devices/UVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Configs", "device_secrets": "https://microvisor.twilio.com/v1/Devices/UVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Secrets" } } diff --git a/tests/integration/oauth/v1/test_device_code.py b/tests/integration/oauth/v1/test_device_code.py new file mode 100644 index 0000000000..d90025b1b4 --- /dev/null +++ b/tests/integration/oauth/v1/test_device_code.py @@ -0,0 +1,49 @@ +# coding=utf-8 +r""" +This code was generated by +\ / _ _ _| _ _ + | (_)\/(_)(_|\/| |(/_ v1.0.0 + / / +""" + +from tests import IntegrationTestCase +from tests.holodeck import Request +from twilio.base import serialize +from twilio.base.exceptions import TwilioException +from twilio.http.response import Response + + +class DeviceCodeTestCase(IntegrationTestCase): + + def test_create_request(self): + self.holodeck.mock(Response(500, '')) + + with self.assertRaises(TwilioException): + self.client.oauth.v1.device_code.create(client_sid="client_sid", scopes=['scopes']) + + values = {'ClientSid': "client_sid", 'Scopes': serialize.map(['scopes'], lambda e: e), } + + self.holodeck.assert_has_request(Request( + 'post', + 'https://oauth.twilio.com/v1/device/code', + data=values, + )) + + def test_create_response(self): + self.holodeck.mock(Response( + 201, + ''' + { + "device_code": "LiwuhE0bIhqemK6sd34tXfobVCR9yrk0", + "user_code": "Hkf1WaID3", + "verification_uri": "v1/oauth2/device/activate", + "verification_uri_complete": "v1/oauth2/device/activate?user_code=Hkf1WaID3", + "expires_in": 299, + "interval": 5 + } + ''' + )) + + actual = self.client.oauth.v1.device_code.create(client_sid="client_sid", scopes=['scopes']) + + self.assertIsNotNone(actual) diff --git a/tests/integration/oauth/v1/test_openid_discovery.py b/tests/integration/oauth/v1/test_openid_discovery.py index b60af50118..ecc42db22f 100644 --- a/tests/integration/oauth/v1/test_openid_discovery.py +++ b/tests/integration/oauth/v1/test_openid_discovery.py @@ -22,7 +22,7 @@ def test_fetch_request(self): self.holodeck.assert_has_request(Request( 'get', - 'https://oauth.twilio.com/v1/well-known/openid-configuration', + 'https://oauth.twilio.com/v1/.well-known/openid-configuration', )) def test_fetch_response(self): @@ -67,7 +67,7 @@ def test_fetch_response(self): "scp", "sub" ], - "url": "https://oauth.twilio.com/v1/well-known/openid-configuration" + "url": "https://oauth.twilio.com/v1/.well-known/openid-configuration" } ''' )) diff --git a/tests/integration/supersim/v1/test_settings_update.py b/tests/integration/supersim/v1/test_settings_update.py index 41fdc4737b..0233f39165 100644 --- a/tests/integration/supersim/v1/test_settings_update.py +++ b/tests/integration/supersim/v1/test_settings_update.py @@ -31,6 +31,46 @@ def test_read_empty_response(self): ''' { "settings_updates": [], + "meta": { + "page": 0, + "page_size": 50, + "first_page_url": "https://supersim.twilio.com/v1/SettingsUpdates?PageSize=50&Page=0", + "previous_page_url": null, + "url": "https://supersim.twilio.com/v1/SettingsUpdates?PageSize=50&Page=0", + "next_page_url": null, + "key": "settings_updates" + } + } + ''' + )) + + actual = self.client.supersim.v1.settings_updates.list() + + self.assertIsNotNone(actual) + + def test_read_sim_only_response(self): + self.holodeck.mock(Response( + 200, + ''' + { + "settings_updates": [ + { + "sid": "OBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "iccid": "89883070000123456789", + "sim_sid": "HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "status": "successful", + "packages": [ + { + "name": "base-settings", + "version": "1.0.0", + "more_info": "https://twilio.com/docs/iot/supersim/settings-packages/base-settings" + } + ], + "date_completed": "2015-07-30T20:00:00Z", + "date_created": "2015-07-30T20:00:00Z", + "date_updated": "2015-07-30T20:00:00Z" + } + ], "meta": { "page": 0, "page_size": 50, @@ -48,6 +88,46 @@ def test_read_empty_response(self): self.assertIsNotNone(actual) + def test_read_status_only_response(self): + self.holodeck.mock(Response( + 200, + ''' + { + "settings_updates": [ + { + "sid": "OBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "iccid": "89883070000123456789", + "sim_sid": "HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "status": "scheduled", + "packages": [ + { + "name": "base-settings", + "version": "1.0.0", + "more_info": "https://twilio.com/docs/iot/supersim/settings-packages/base-settings" + } + ], + "date_completed": null, + "date_created": "2015-07-30T20:00:00Z", + "date_updated": "2015-07-30T20:00:00Z" + } + ], + "meta": { + "page": 0, + "page_size": 50, + "first_page_url": "https://supersim.twilio.com/v1/SettingsUpdates?Status=scheduled&PageSize=50&Page=0", + "previous_page_url": null, + "url": "https://supersim.twilio.com/v1/SettingsUpdates?Status=scheduled&PageSize=50&Page=0", + "next_page_url": null, + "key": "settings_updates" + } + } + ''' + )) + + actual = self.client.supersim.v1.settings_updates.list() + + self.assertIsNotNone(actual) + def test_read_full_response(self): self.holodeck.mock(Response( 200, @@ -66,7 +146,7 @@ def test_read_full_response(self): "more_info": "https://twilio.com/docs/iot/supersim/settings-packages/base-settings" } ], - "date_completed": "2015-07-30T20:00:00Z", + "date_completed": null, "date_created": "2015-07-30T20:00:00Z", "date_updated": "2015-07-30T20:00:00Z" } @@ -74,9 +154,9 @@ def test_read_full_response(self): "meta": { "page": 0, "page_size": 50, - "first_page_url": "https://supersim.twilio.com/v1/SettingsUpdates?Sim=1234567890123456789&PageSize=50&Page=0", + "first_page_url": "https://supersim.twilio.com/v1/SettingsUpdates?Status=scheduled&Sim=HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&PageSize=50&Page=0", "previous_page_url": null, - "url": "https://supersim.twilio.com/v1/SettingsUpdates?Sim=1234567890123456789&PageSize=50&Page=0", + "url": "https://supersim.twilio.com/v1/SettingsUpdates?Status=scheduled&Sim=HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&PageSize=50&Page=0", "next_page_url": null, "key": "settings_updates" } diff --git a/tests/integration/taskrouter/v1/workspace/test_task_queue.py b/tests/integration/taskrouter/v1/workspace/test_task_queue.py index 53db496499..98a5941f06 100644 --- a/tests/integration/taskrouter/v1/workspace/test_task_queue.py +++ b/tests/integration/taskrouter/v1/workspace/test_task_queue.py @@ -53,7 +53,8 @@ def test_fetch_response(self): "target_workers": null, "task_order": "FIFO", "url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - "workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "operating_unit_sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ''' )) @@ -102,7 +103,8 @@ def test_update_response(self): "target_workers": null, "task_order": "FIFO", "url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - "workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "operating_unit_sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ''' )) @@ -162,7 +164,8 @@ def test_read_full_response(self): "target_workers": null, "task_order": "FIFO", "url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - "workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "operating_unit_sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ] } @@ -240,7 +243,8 @@ def test_create_response(self): "target_workers": null, "task_order": "FIFO", "url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues/WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - "workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "operating_unit_sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ''' )) diff --git a/tests/integration/taskrouter/v1/workspace/test_worker.py b/tests/integration/taskrouter/v1/workspace/test_worker.py index 8966f39a4c..f340c9f925 100644 --- a/tests/integration/taskrouter/v1/workspace/test_worker.py +++ b/tests/integration/taskrouter/v1/workspace/test_worker.py @@ -53,6 +53,7 @@ def test_read_full_response(self): "date_created": "2017-05-30T23:05:29Z", "date_updated": "2017-05-30T23:05:29Z", "date_status_changed": "2017-05-30T23:05:29Z", + "operating_unit_sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { "channels": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels", @@ -131,6 +132,7 @@ def test_create_response(self): "date_created": "2017-05-30T23:19:38Z", "date_updated": "2017-05-30T23:19:38Z", "date_status_changed": "2017-05-30T23:19:38Z", + "operating_unit_sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { "channels": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels", @@ -179,6 +181,7 @@ def test_fetch_response(self): "date_updated": "2017-05-30T23:32:39Z", "friendly_name": "NewWorker3", "sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "operating_unit_sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { @@ -231,6 +234,7 @@ def test_update_response(self): "date_created": "2017-05-30T23:32:22Z", "date_updated": "2017-05-31T00:05:57Z", "date_status_changed": "2017-05-30T23:32:22Z", + "operating_unit_sid": "OUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "links": { "channels": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels", diff --git a/twilio/rest/api/v2010/account/address/__init__.py b/twilio/rest/api/v2010/account/address/__init__.py index 65380beb94..6f662e2372 100644 --- a/twilio/rest/api/v2010/account/address/__init__.py +++ b/twilio/rest/api/v2010/account/address/__init__.py @@ -35,7 +35,7 @@ def __init__(self, version, account_sid): def create(self, customer_name, street, city, region, postal_code, iso_country, friendly_name=values.unset, emergency_enabled=values.unset, - auto_correct_address=values.unset): + auto_correct_address=values.unset, street_secondary=values.unset): """ Create the AddressInstance @@ -48,6 +48,7 @@ def create(self, customer_name, street, city, region, postal_code, iso_country, :param unicode friendly_name: A string to describe the new resource :param bool emergency_enabled: Whether to enable emergency calling on the new address :param bool auto_correct_address: Whether we should automatically correct the address + :param unicode street_secondary: The additional number and street address of the address :returns: The created AddressInstance :rtype: twilio.rest.api.v2010.account.address.AddressInstance @@ -62,6 +63,7 @@ def create(self, customer_name, street, city, region, postal_code, iso_country, 'FriendlyName': friendly_name, 'EmergencyEnabled': emergency_enabled, 'AutoCorrectAddress': auto_correct_address, + 'StreetSecondary': street_secondary, }) payload = self._version.create(method='POST', uri=self._uri, data=data, ) @@ -296,7 +298,7 @@ def fetch(self): def update(self, friendly_name=values.unset, customer_name=values.unset, street=values.unset, city=values.unset, region=values.unset, postal_code=values.unset, emergency_enabled=values.unset, - auto_correct_address=values.unset): + auto_correct_address=values.unset, street_secondary=values.unset): """ Update the AddressInstance @@ -308,6 +310,7 @@ def update(self, friendly_name=values.unset, customer_name=values.unset, :param unicode postal_code: The postal code of the address :param bool emergency_enabled: Whether to enable emergency calling on the address :param bool auto_correct_address: Whether we should automatically correct the address + :param unicode street_secondary: The additional number and street address of the address :returns: The updated AddressInstance :rtype: twilio.rest.api.v2010.account.address.AddressInstance @@ -321,6 +324,7 @@ def update(self, friendly_name=values.unset, customer_name=values.unset, 'PostalCode': postal_code, 'EmergencyEnabled': emergency_enabled, 'AutoCorrectAddress': auto_correct_address, + 'StreetSecondary': street_secondary, }) payload = self._version.update(method='POST', uri=self._uri, data=data, ) @@ -387,6 +391,7 @@ def __init__(self, version, payload, account_sid, sid=None): 'emergency_enabled': payload.get('emergency_enabled'), 'validated': payload.get('validated'), 'verified': payload.get('verified'), + 'street_secondary': payload.get('street_secondary'), } # Context @@ -530,6 +535,14 @@ def verified(self): """ return self._properties['verified'] + @property + def street_secondary(self): + """ + :returns: The additional number and street address of the address + :rtype: unicode + """ + return self._properties['street_secondary'] + def delete(self): """ Deletes the AddressInstance @@ -551,7 +564,7 @@ def fetch(self): def update(self, friendly_name=values.unset, customer_name=values.unset, street=values.unset, city=values.unset, region=values.unset, postal_code=values.unset, emergency_enabled=values.unset, - auto_correct_address=values.unset): + auto_correct_address=values.unset, street_secondary=values.unset): """ Update the AddressInstance @@ -563,6 +576,7 @@ def update(self, friendly_name=values.unset, customer_name=values.unset, :param unicode postal_code: The postal code of the address :param bool emergency_enabled: Whether to enable emergency calling on the address :param bool auto_correct_address: Whether we should automatically correct the address + :param unicode street_secondary: The additional number and street address of the address :returns: The updated AddressInstance :rtype: twilio.rest.api.v2010.account.address.AddressInstance @@ -576,6 +590,7 @@ def update(self, friendly_name=values.unset, customer_name=values.unset, postal_code=postal_code, emergency_enabled=emergency_enabled, auto_correct_address=auto_correct_address, + street_secondary=street_secondary, ) @property diff --git a/twilio/rest/api/v2010/account/call/user_defined_message_subscription.py b/twilio/rest/api/v2010/account/call/user_defined_message_subscription.py index a8e769aac2..5eef182bd0 100644 --- a/twilio/rest/api/v2010/account/call/user_defined_message_subscription.py +++ b/twilio/rest/api/v2010/account/call/user_defined_message_subscription.py @@ -33,18 +33,18 @@ def __init__(self, version, account_sid, call_sid): self._solution = {'account_sid': account_sid, 'call_sid': call_sid, } self._uri = '/Accounts/{account_sid}/Calls/{call_sid}/UserDefinedMessageSubscriptions.json'.format(**self._solution) - def create(self, callback, method, idempotency_key=values.unset): + def create(self, callback, idempotency_key=values.unset, method=values.unset): """ Create the UserDefinedMessageSubscriptionInstance :param unicode callback: The URL we should call to send user defined messages. - :param unicode method: HTTP method used with the callback. :param unicode idempotency_key: A unique string value to identify API call. This should be a unique string value per API call and can be a randomly generated. + :param unicode method: HTTP method used with the callback. :returns: The created UserDefinedMessageSubscriptionInstance :rtype: twilio.rest.api.v2010.account.call.user_defined_message_subscription.UserDefinedMessageSubscriptionInstance """ - data = values.of({'Callback': callback, 'Method': method, 'IdempotencyKey': idempotency_key, }) + data = values.of({'Callback': callback, 'IdempotencyKey': idempotency_key, 'Method': method, }) payload = self._version.create(method='POST', uri=self._uri, data=data, ) diff --git a/twilio/rest/flex_api/__init__.py b/twilio/rest/flex_api/__init__.py index ea8c4a7adf..1bb7aaa317 100644 --- a/twilio/rest/flex_api/__init__.py +++ b/twilio/rest/flex_api/__init__.py @@ -8,6 +8,7 @@ from twilio.base.domain import Domain from twilio.rest.flex_api.v1 import V1 +from twilio.rest.flex_api.v2 import V2 class FlexApi(Domain): @@ -25,6 +26,7 @@ def __init__(self, twilio): # Versions self._v1 = None + self._v2 = None @property def v1(self): @@ -36,6 +38,16 @@ def v1(self): self._v1 = V1(self) return self._v1 + @property + def v2(self): + """ + :returns: Version v2 of flex_api + :rtype: twilio.rest.flex_api.v2.V2 + """ + if self._v2 is None: + self._v2 = V2(self) + return self._v2 + @property def assessments(self): """ @@ -92,6 +104,13 @@ def web_channel(self): """ return self.v1.web_channel + @property + def web_channels(self): + """ + :rtype: twilio.rest.flex_api.v2.web_channels.WebChannelsList + """ + return self.v2.web_channels + def __repr__(self): """ Provide a friendly representation diff --git a/twilio/rest/flex_api/v1/good_data.py b/twilio/rest/flex_api/v1/good_data.py index e0bf34cf92..df490e2af0 100644 --- a/twilio/rest/flex_api/v1/good_data.py +++ b/twilio/rest/flex_api/v1/good_data.py @@ -110,7 +110,7 @@ def __init__(self, version): # Path Solution self._solution = {} - self._uri = '/Accounts/GoodData'.format(**self._solution) + self._uri = '/Insights/Session'.format(**self._solution) def create(self, token=values.unset): """ @@ -154,7 +154,7 @@ def __init__(self, version, payload): 'workspace_id': payload.get('workspace_id'), 'session_expiry': payload.get('session_expiry'), 'session_id': payload.get('session_id'), - 'gd_base_url': payload.get('gd_base_url'), + 'base_url': payload.get('base_url'), 'url': payload.get('url'), } @@ -178,7 +178,7 @@ def _proxy(self): @property def workspace_id(self): """ - :returns: Unique workspace ID in gooddata + :returns: Unique ID to identify the user's workspace :rtype: unicode """ return self._properties['workspace_id'] @@ -200,12 +200,12 @@ def session_id(self): return self._properties['session_id'] @property - def gd_base_url(self): + def base_url(self): """ - :returns: GoodData login base URL + :returns: Base URL to fetch reports and dashboards :rtype: unicode """ - return self._properties['gd_base_url'] + return self._properties['base_url'] @property def url(self): diff --git a/twilio/rest/flex_api/v1/user_roles.py b/twilio/rest/flex_api/v1/user_roles.py index 94507e762d..b8596c58d7 100644 --- a/twilio/rest/flex_api/v1/user_roles.py +++ b/twilio/rest/flex_api/v1/user_roles.py @@ -110,7 +110,7 @@ def __init__(self, version): # Path Solution self._solution = {} - self._uri = '/Accounts/UserRoles'.format(**self._solution) + self._uri = '/Insights/UserRoles'.format(**self._solution) def fetch(self, token=values.unset): """ diff --git a/twilio/rest/flex_api/v2/__init__.py b/twilio/rest/flex_api/v2/__init__.py new file mode 100644 index 0000000000..e202a42b07 --- /dev/null +++ b/twilio/rest/flex_api/v2/__init__.py @@ -0,0 +1,42 @@ +# coding=utf-8 +r""" +This code was generated by +\ / _ _ _| _ _ + | (_)\/(_)(_|\/| |(/_ v1.0.0 + / / +""" + +from twilio.base.version import Version +from twilio.rest.flex_api.v2.web_channels import WebChannelsList + + +class V2(Version): + + def __init__(self, domain): + """ + Initialize the V2 version of FlexApi + + :returns: V2 version of FlexApi + :rtype: twilio.rest.flex_api.v2.V2.V2 + """ + super(V2, self).__init__(domain) + self.version = 'v2' + self._web_channels = None + + @property + def web_channels(self): + """ + :rtype: twilio.rest.flex_api.v2.web_channels.WebChannelsList + """ + if self._web_channels is None: + self._web_channels = WebChannelsList(self) + return self._web_channels + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + return '' diff --git a/twilio/rest/flex_api/v2/web_channels.py b/twilio/rest/flex_api/v2/web_channels.py new file mode 100644 index 0000000000..af5f0cef5a --- /dev/null +++ b/twilio/rest/flex_api/v2/web_channels.py @@ -0,0 +1,149 @@ +# coding=utf-8 +r""" +This code was generated by +\ / _ _ _| _ _ + | (_)\/(_)(_|\/| |(/_ v1.0.0 + / / +""" + +from twilio.base import values +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.page import Page + + +class WebChannelsList(ListResource): + + def __init__(self, version): + """ + Initialize the WebChannelsList + + :param Version version: Version that contains the resource + + :returns: twilio.rest.flex_api.v2.web_channels.WebChannelsList + :rtype: twilio.rest.flex_api.v2.web_channels.WebChannelsList + """ + super(WebChannelsList, self).__init__(version) + + # Path Solution + self._solution = {} + self._uri = '/WebChats'.format(**self._solution) + + def create(self, address_sid, chat_friendly_name=values.unset, + customer_friendly_name=values.unset, + pre_engagement_data=values.unset): + """ + Create the WebChannelsInstance + + :param unicode address_sid: The SID of the Conversations Address + :param unicode chat_friendly_name: The Conversation's friendly name + :param unicode customer_friendly_name: The Conversation participant's friendly name + :param unicode pre_engagement_data: The pre-engagement data + + :returns: The created WebChannelsInstance + :rtype: twilio.rest.flex_api.v2.web_channels.WebChannelsInstance + """ + data = values.of({ + 'AddressSid': address_sid, + 'ChatFriendlyName': chat_friendly_name, + 'CustomerFriendlyName': customer_friendly_name, + 'PreEngagementData': pre_engagement_data, + }) + + payload = self._version.create(method='POST', uri=self._uri, data=data, ) + + return WebChannelsInstance(self._version, payload, ) + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + return '' + + +class WebChannelsPage(Page): + + def __init__(self, version, response, solution): + """ + Initialize the WebChannelsPage + + :param Version version: Version that contains the resource + :param Response response: Response from the API + + :returns: twilio.rest.flex_api.v2.web_channels.WebChannelsPage + :rtype: twilio.rest.flex_api.v2.web_channels.WebChannelsPage + """ + super(WebChannelsPage, self).__init__(version, response) + + # Path Solution + self._solution = solution + + def get_instance(self, payload): + """ + Build an instance of WebChannelsInstance + + :param dict payload: Payload response from the API + + :returns: twilio.rest.flex_api.v2.web_channels.WebChannelsInstance + :rtype: twilio.rest.flex_api.v2.web_channels.WebChannelsInstance + """ + return WebChannelsInstance(self._version, payload, ) + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + return '' + + +class WebChannelsInstance(InstanceResource): + + def __init__(self, version, payload): + """ + Initialize the WebChannelsInstance + + :returns: twilio.rest.flex_api.v2.web_channels.WebChannelsInstance + :rtype: twilio.rest.flex_api.v2.web_channels.WebChannelsInstance + """ + super(WebChannelsInstance, self).__init__(version) + + # Marshaled Properties + self._properties = { + 'conversation_sid': payload.get('conversation_sid'), + 'identity': payload.get('identity'), + } + + # Context + self._context = None + self._solution = {} + + @property + def conversation_sid(self): + """ + :returns: The unique string representing the Conversation resource created + :rtype: unicode + """ + return self._properties['conversation_sid'] + + @property + def identity(self): + """ + :returns: The unique string representing the User created + :rtype: unicode + """ + return self._properties['identity'] + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + return '' 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 014f6be880..3a1f9018fd 100644 --- a/twilio/rest/messaging/v1/service/us_app_to_person.py +++ b/twilio/rest/messaging/v1/service/us_app_to_person.py @@ -35,9 +35,9 @@ def __init__(self, version, messaging_service_sid): self._solution = {'messaging_service_sid': messaging_service_sid, } self._uri = '/Services/{messaging_service_sid}/Compliance/Usa2p'.format(**self._solution) - def create(self, brand_registration_sid, description, message_samples, - us_app_to_person_usecase, has_embedded_links, has_embedded_phone, - message_flow=values.unset, opt_in_message=values.unset, + def create(self, brand_registration_sid, description, message_flow, + message_samples, us_app_to_person_usecase, has_embedded_links, + has_embedded_phone, opt_in_message=values.unset, opt_out_message=values.unset, help_message=values.unset, opt_in_keywords=values.unset, opt_out_keywords=values.unset, help_keywords=values.unset): @@ -46,11 +46,11 @@ def create(self, brand_registration_sid, description, message_samples, :param unicode brand_registration_sid: A2P Brand Registration SID :param unicode description: A short description of what this SMS campaign does + :param unicode message_flow: The message flow of the campaign :param list[unicode] message_samples: Message samples :param unicode us_app_to_person_usecase: A2P Campaign Use Case. :param bool has_embedded_links: Indicates that this SMS campaign will send messages that contain links :param bool has_embedded_phone: Indicates that this SMS campaign will send messages that contain phone numbers - :param unicode message_flow: The message flow of the campaign :param unicode opt_in_message: Opt In Message :param unicode opt_out_message: Opt Out Message :param unicode help_message: Help Message @@ -64,11 +64,11 @@ def create(self, brand_registration_sid, description, message_samples, data = values.of({ 'BrandRegistrationSid': brand_registration_sid, 'Description': description, + '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, - 'MessageFlow': message_flow, 'OptInMessage': opt_in_message, 'OptOutMessage': opt_out_message, 'HelpMessage': help_message, diff --git a/twilio/rest/oauth/__init__.py b/twilio/rest/oauth/__init__.py index eae15904d9..815d617a3b 100644 --- a/twilio/rest/oauth/__init__.py +++ b/twilio/rest/oauth/__init__.py @@ -43,6 +43,13 @@ def oauth(self): """ return self.v1.oauth + @property + def device_code(self): + """ + :rtype: twilio.rest.oauth.v1.device_code.DeviceCodeList + """ + return self.v1.device_code + @property def openid_discovery(self): """ diff --git a/twilio/rest/oauth/v1/__init__.py b/twilio/rest/oauth/v1/__init__.py index 359cfd0464..659676cf2b 100644 --- a/twilio/rest/oauth/v1/__init__.py +++ b/twilio/rest/oauth/v1/__init__.py @@ -7,6 +7,7 @@ """ from twilio.base.version import Version +from twilio.rest.oauth.v1.device_code import DeviceCodeList from twilio.rest.oauth.v1.oauth import OauthList from twilio.rest.oauth.v1.openid_discovery import OpenidDiscoveryList from twilio.rest.oauth.v1.token import TokenList @@ -25,6 +26,7 @@ def __init__(self, domain): super(V1, self).__init__(domain) self.version = 'v1' self._oauth = None + self._device_code = None self._openid_discovery = None self._token = None self._user_info = None @@ -38,6 +40,15 @@ def oauth(self): self._oauth = OauthList(self) return self._oauth + @property + def device_code(self): + """ + :rtype: twilio.rest.oauth.v1.device_code.DeviceCodeList + """ + if self._device_code is None: + self._device_code = DeviceCodeList(self) + return self._device_code + @property def openid_discovery(self): """ diff --git a/twilio/rest/oauth/v1/device_code.py b/twilio/rest/oauth/v1/device_code.py new file mode 100644 index 0000000000..ddcaa47ff2 --- /dev/null +++ b/twilio/rest/oauth/v1/device_code.py @@ -0,0 +1,183 @@ +# coding=utf-8 +r""" +This code was generated by +\ / _ _ _| _ _ + | (_)\/(_)(_|\/| |(/_ v1.0.0 + / / +""" + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.page import Page + + +class DeviceCodeList(ListResource): + + def __init__(self, version): + """ + Initialize the DeviceCodeList + + :param Version version: Version that contains the resource + + :returns: twilio.rest.oauth.v1.device_code.DeviceCodeList + :rtype: twilio.rest.oauth.v1.device_code.DeviceCodeList + """ + super(DeviceCodeList, self).__init__(version) + + # Path Solution + self._solution = {} + self._uri = '/device/code'.format(**self._solution) + + def create(self, client_sid, scopes, audiences=values.unset): + """ + Create the DeviceCodeInstance + + :param unicode client_sid: A string that uniquely identifies this oauth app + :param list[unicode] scopes: An Array of scopes + :param list[unicode] audiences: An array of intended audiences + + :returns: The created DeviceCodeInstance + :rtype: twilio.rest.oauth.v1.device_code.DeviceCodeInstance + """ + data = values.of({ + 'ClientSid': client_sid, + 'Scopes': serialize.map(scopes, lambda e: e), + 'Audiences': serialize.map(audiences, lambda e: e), + }) + + payload = self._version.create(method='POST', uri=self._uri, data=data, ) + + return DeviceCodeInstance(self._version, payload, ) + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + return '' + + +class DeviceCodePage(Page): + + def __init__(self, version, response, solution): + """ + Initialize the DeviceCodePage + + :param Version version: Version that contains the resource + :param Response response: Response from the API + + :returns: twilio.rest.oauth.v1.device_code.DeviceCodePage + :rtype: twilio.rest.oauth.v1.device_code.DeviceCodePage + """ + super(DeviceCodePage, self).__init__(version, response) + + # Path Solution + self._solution = solution + + def get_instance(self, payload): + """ + Build an instance of DeviceCodeInstance + + :param dict payload: Payload response from the API + + :returns: twilio.rest.oauth.v1.device_code.DeviceCodeInstance + :rtype: twilio.rest.oauth.v1.device_code.DeviceCodeInstance + """ + return DeviceCodeInstance(self._version, payload, ) + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + return '' + + +class DeviceCodeInstance(InstanceResource): + + def __init__(self, version, payload): + """ + Initialize the DeviceCodeInstance + + :returns: twilio.rest.oauth.v1.device_code.DeviceCodeInstance + :rtype: twilio.rest.oauth.v1.device_code.DeviceCodeInstance + """ + super(DeviceCodeInstance, self).__init__(version) + + # Marshaled Properties + self._properties = { + 'device_code': payload.get('device_code'), + 'user_code': payload.get('user_code'), + 'verification_uri': payload.get('verification_uri'), + 'verification_uri_complete': payload.get('verification_uri_complete'), + 'expires_in': deserialize.integer(payload.get('expires_in')), + 'interval': deserialize.integer(payload.get('interval')), + } + + # Context + self._context = None + self._solution = {} + + @property + def device_code(self): + """ + :returns: The device verification code + :rtype: unicode + """ + return self._properties['device_code'] + + @property + def user_code(self): + """ + :returns: The verification code for the end user + :rtype: unicode + """ + return self._properties['user_code'] + + @property + def verification_uri(self): + """ + :returns: The URI that the end user visits to verify request + :rtype: unicode + """ + return self._properties['verification_uri'] + + @property + def verification_uri_complete(self): + """ + :returns: he URI with user_code that the end-user alternatively visits to verify request + :rtype: unicode + """ + return self._properties['verification_uri_complete'] + + @property + def expires_in(self): + """ + :returns: The expiration time of the device_code and user_code in seconds + :rtype: unicode + """ + return self._properties['expires_in'] + + @property + def interval(self): + """ + :returns: The minimum amount of time in seconds that the client should wait between polling requests to the token endpoint + :rtype: unicode + """ + return self._properties['interval'] + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + return '' diff --git a/twilio/rest/oauth/v1/openid_discovery.py b/twilio/rest/oauth/v1/openid_discovery.py index d894d15949..41d9eade95 100644 --- a/twilio/rest/oauth/v1/openid_discovery.py +++ b/twilio/rest/oauth/v1/openid_discovery.py @@ -110,7 +110,7 @@ def __init__(self, version): # Path Solution self._solution = {} - self._uri = '/well-known/openid-configuration'.format(**self._solution) + self._uri = '/.well-known/openid-configuration'.format(**self._solution) def fetch(self): """ diff --git a/twilio/rest/supersim/v1/settings_update.py b/twilio/rest/supersim/v1/settings_update.py index c1dc887644..4f125c4cc2 100644 --- a/twilio/rest/supersim/v1/settings_update.py +++ b/twilio/rest/supersim/v1/settings_update.py @@ -32,7 +32,8 @@ def __init__(self, version): self._solution = {} self._uri = '/SettingsUpdates'.format(**self._solution) - def stream(self, sim=values.unset, limit=None, page_size=None): + def stream(self, sim=values.unset, status=values.unset, limit=None, + page_size=None): """ Streams SettingsUpdateInstance records from the API as a generator stream. This operation lazily loads records as efficiently as possible until the limit @@ -40,6 +41,7 @@ def stream(self, sim=values.unset, limit=None, page_size=None): The results are returned as a generator, so this operation is memory efficient. :param unicode sim: Filter the Settings Updates by Super SIM + :param SettingsUpdateInstance.Status status: Filter the Settings Updates by status :param int limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param int page_size: Number of records to fetch per request, when not set will use @@ -52,17 +54,19 @@ def stream(self, sim=values.unset, limit=None, page_size=None): """ limits = self._version.read_limits(limit, page_size) - page = self.page(sim=sim, page_size=limits['page_size'], ) + page = self.page(sim=sim, status=status, page_size=limits['page_size'], ) return self._version.stream(page, limits['limit']) - def list(self, sim=values.unset, limit=None, page_size=None): + def list(self, sim=values.unset, status=values.unset, limit=None, + page_size=None): """ Lists SettingsUpdateInstance records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. :param unicode sim: Filter the Settings Updates by Super SIM + :param SettingsUpdateInstance.Status status: Filter the Settings Updates by status :param int limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit :param int page_size: Number of records to fetch per request, when not set will use @@ -73,15 +77,16 @@ def list(self, sim=values.unset, limit=None, page_size=None): :returns: Generator that will yield up to limit results :rtype: list[twilio.rest.supersim.v1.settings_update.SettingsUpdateInstance] """ - return list(self.stream(sim=sim, limit=limit, page_size=page_size, )) + return list(self.stream(sim=sim, status=status, limit=limit, page_size=page_size, )) - def page(self, sim=values.unset, page_token=values.unset, + def page(self, sim=values.unset, status=values.unset, page_token=values.unset, page_number=values.unset, page_size=values.unset): """ Retrieve a single page of SettingsUpdateInstance records from the API. Request is executed immediately :param unicode sim: Filter the Settings Updates by Super SIM + :param SettingsUpdateInstance.Status status: Filter the Settings Updates by status :param str page_token: PageToken provided by the API :param int page_number: Page Number, this value is simply for client state :param int page_size: Number of records to return, defaults to 50 @@ -89,7 +94,13 @@ def page(self, sim=values.unset, page_token=values.unset, :returns: Page of SettingsUpdateInstance :rtype: twilio.rest.supersim.v1.settings_update.SettingsUpdatePage """ - data = values.of({'Sim': sim, 'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) + data = values.of({ + 'Sim': sim, + 'Status': status, + 'PageToken': page_token, + 'Page': page_number, + 'PageSize': page_size, + }) response = self._version.page(method='GET', uri=self._uri, params=data, ) diff --git a/twilio/twiml/voice_response.py b/twilio/twiml/voice_response.py index 995e9b2bb0..f6b0e365c2 100644 --- a/twilio/twiml/voice_response.py +++ b/twilio/twiml/voice_response.py @@ -889,32 +889,32 @@ def ssml_s(self, words=None, **kwargs): """ return self.s(words=words, **kwargs) - def say_as(self, words, interpret_as=None, role=None, **kwargs): + def say_as(self, words, interpret_as=None, format=None, **kwargs): """ Create a element :param words: Words to be interpreted :param interpret-as: Specify the type of words are spoken - :param role: Specify the format of the date when interpret-as is set to date + :param format: Specify the format of the date when interpret-as is set to date :param kwargs: additional attributes :returns: element """ - return self.nest(SsmlSayAs(words, interpret_as=interpret_as, role=role, **kwargs)) + return self.nest(SsmlSayAs(words, interpret_as=interpret_as, format=format, **kwargs)) @deprecated_method('say_as') - def ssml_say_as(self, words, interpret_as=None, role=None, **kwargs): + def ssml_say_as(self, words, interpret_as=None, format=None, **kwargs): """ Create a element :param words: Words to be interpreted :param interpret-as: Specify the type of words are spoken - :param role: Specify the format of the date when interpret-as is set to date + :param format: Specify the format of the date when interpret-as is set to date :param kwargs: additional attributes :returns: element """ - return self.say_as(words, interpret_as=interpret_as, role=role, **kwargs) + return self.say_as(words, interpret_as=interpret_as, format=format, **kwargs) def sub(self, words, alias=None, **kwargs): """ @@ -1083,32 +1083,32 @@ def ssml_prosody(self, words=None, volume=None, rate=None, pitch=None, """ return self.prosody(words=words, volume=volume, rate=rate, pitch=pitch, **kwargs) - def say_as(self, words, interpret_as=None, role=None, **kwargs): + def say_as(self, words, interpret_as=None, format=None, **kwargs): """ Create a element :param words: Words to be interpreted :param interpret-as: Specify the type of words are spoken - :param role: Specify the format of the date when interpret-as is set to date + :param format: Specify the format of the date when interpret-as is set to date :param kwargs: additional attributes :returns: element """ - return self.nest(SsmlSayAs(words, interpret_as=interpret_as, role=role, **kwargs)) + return self.nest(SsmlSayAs(words, interpret_as=interpret_as, format=format, **kwargs)) @deprecated_method('say_as') - def ssml_say_as(self, words, interpret_as=None, role=None, **kwargs): + def ssml_say_as(self, words, interpret_as=None, format=None, **kwargs): """ Create a element :param words: Words to be interpreted :param interpret-as: Specify the type of words are spoken - :param role: Specify the format of the date when interpret-as is set to date + :param format: Specify the format of the date when interpret-as is set to date :param kwargs: additional attributes :returns: element """ - return self.say_as(words, interpret_as=interpret_as, role=role, **kwargs) + return self.say_as(words, interpret_as=interpret_as, format=format, **kwargs) def sub(self, words, alias=None, **kwargs): """ @@ -1341,32 +1341,32 @@ def ssml_s(self, words=None, **kwargs): """ return self.s(words=words, **kwargs) - def say_as(self, words, interpret_as=None, role=None, **kwargs): + def say_as(self, words, interpret_as=None, format=None, **kwargs): """ Create a element :param words: Words to be interpreted :param interpret-as: Specify the type of words are spoken - :param role: Specify the format of the date when interpret-as is set to date + :param format: Specify the format of the date when interpret-as is set to date :param kwargs: additional attributes :returns: element """ - return self.nest(SsmlSayAs(words, interpret_as=interpret_as, role=role, **kwargs)) + return self.nest(SsmlSayAs(words, interpret_as=interpret_as, format=format, **kwargs)) @deprecated_method('say_as') - def ssml_say_as(self, words, interpret_as=None, role=None, **kwargs): + def ssml_say_as(self, words, interpret_as=None, format=None, **kwargs): """ Create a element :param words: Words to be interpreted :param interpret-as: Specify the type of words are spoken - :param role: Specify the format of the date when interpret-as is set to date + :param format: Specify the format of the date when interpret-as is set to date :param kwargs: additional attributes :returns: element """ - return self.say_as(words, interpret_as=interpret_as, role=role, **kwargs) + return self.say_as(words, interpret_as=interpret_as, format=format, **kwargs) def sub(self, words, alias=None, **kwargs): """ @@ -1560,32 +1560,32 @@ def ssml_prosody(self, words=None, volume=None, rate=None, pitch=None, """ return self.prosody(words=words, volume=volume, rate=rate, pitch=pitch, **kwargs) - def say_as(self, words, interpret_as=None, role=None, **kwargs): + def say_as(self, words, interpret_as=None, format=None, **kwargs): """ Create a element :param words: Words to be interpreted :param interpret-as: Specify the type of words are spoken - :param role: Specify the format of the date when interpret-as is set to date + :param format: Specify the format of the date when interpret-as is set to date :param kwargs: additional attributes :returns: element """ - return self.nest(SsmlSayAs(words, interpret_as=interpret_as, role=role, **kwargs)) + return self.nest(SsmlSayAs(words, interpret_as=interpret_as, format=format, **kwargs)) @deprecated_method('say_as') - def ssml_say_as(self, words, interpret_as=None, role=None, **kwargs): + def ssml_say_as(self, words, interpret_as=None, format=None, **kwargs): """ Create a element :param words: Words to be interpreted :param interpret-as: Specify the type of words are spoken - :param role: Specify the format of the date when interpret-as is set to date + :param format: Specify the format of the date when interpret-as is set to date :param kwargs: additional attributes :returns: element """ - return self.say_as(words, interpret_as=interpret_as, role=role, **kwargs) + return self.say_as(words, interpret_as=interpret_as, format=format, **kwargs) def sub(self, words, alias=None, **kwargs): """ @@ -1834,32 +1834,32 @@ def ssml_s(self, words=None, **kwargs): """ return self.s(words=words, **kwargs) - def say_as(self, words, interpret_as=None, role=None, **kwargs): + def say_as(self, words, interpret_as=None, format=None, **kwargs): """ Create a element :param words: Words to be interpreted :param interpret-as: Specify the type of words are spoken - :param role: Specify the format of the date when interpret-as is set to date + :param format: Specify the format of the date when interpret-as is set to date :param kwargs: additional attributes :returns: element """ - return self.nest(SsmlSayAs(words, interpret_as=interpret_as, role=role, **kwargs)) + return self.nest(SsmlSayAs(words, interpret_as=interpret_as, format=format, **kwargs)) @deprecated_method('say_as') - def ssml_say_as(self, words, interpret_as=None, role=None, **kwargs): + def ssml_say_as(self, words, interpret_as=None, format=None, **kwargs): """ Create a element :param words: Words to be interpreted :param interpret-as: Specify the type of words are spoken - :param role: Specify the format of the date when interpret-as is set to date + :param format: Specify the format of the date when interpret-as is set to date :param kwargs: additional attributes :returns: element """ - return self.say_as(words, interpret_as=interpret_as, role=role, **kwargs) + return self.say_as(words, interpret_as=interpret_as, format=format, **kwargs) def sub(self, words, alias=None, **kwargs): """ @@ -2076,32 +2076,32 @@ def ssml_s(self, words=None, **kwargs): """ return self.s(words=words, **kwargs) - def say_as(self, words, interpret_as=None, role=None, **kwargs): + def say_as(self, words, interpret_as=None, format=None, **kwargs): """ Create a element :param words: Words to be interpreted :param interpret-as: Specify the type of words are spoken - :param role: Specify the format of the date when interpret-as is set to date + :param format: Specify the format of the date when interpret-as is set to date :param kwargs: additional attributes :returns: element """ - return self.nest(SsmlSayAs(words, interpret_as=interpret_as, role=role, **kwargs)) + return self.nest(SsmlSayAs(words, interpret_as=interpret_as, format=format, **kwargs)) @deprecated_method('say_as') - def ssml_say_as(self, words, interpret_as=None, role=None, **kwargs): + def ssml_say_as(self, words, interpret_as=None, format=None, **kwargs): """ Create a element :param words: Words to be interpreted :param interpret-as: Specify the type of words are spoken - :param role: Specify the format of the date when interpret-as is set to date + :param format: Specify the format of the date when interpret-as is set to date :param kwargs: additional attributes :returns: element """ - return self.say_as(words, interpret_as=interpret_as, role=role, **kwargs) + return self.say_as(words, interpret_as=interpret_as, format=format, **kwargs) def sub(self, words, alias=None, **kwargs): """ @@ -2295,32 +2295,32 @@ def ssml_prosody(self, words=None, volume=None, rate=None, pitch=None, """ return self.prosody(words=words, volume=volume, rate=rate, pitch=pitch, **kwargs) - def say_as(self, words, interpret_as=None, role=None, **kwargs): + def say_as(self, words, interpret_as=None, format=None, **kwargs): """ Create a element :param words: Words to be interpreted :param interpret-as: Specify the type of words are spoken - :param role: Specify the format of the date when interpret-as is set to date + :param format: Specify the format of the date when interpret-as is set to date :param kwargs: additional attributes :returns: element """ - return self.nest(SsmlSayAs(words, interpret_as=interpret_as, role=role, **kwargs)) + return self.nest(SsmlSayAs(words, interpret_as=interpret_as, format=format, **kwargs)) @deprecated_method('say_as') - def ssml_say_as(self, words, interpret_as=None, role=None, **kwargs): + def ssml_say_as(self, words, interpret_as=None, format=None, **kwargs): """ Create a element :param words: Words to be interpreted :param interpret-as: Specify the type of words are spoken - :param role: Specify the format of the date when interpret-as is set to date + :param format: Specify the format of the date when interpret-as is set to date :param kwargs: additional attributes :returns: element """ - return self.say_as(words, interpret_as=interpret_as, role=role, **kwargs) + return self.say_as(words, interpret_as=interpret_as, format=format, **kwargs) def sub(self, words, alias=None, **kwargs): """