diff --git a/CHANGES.md b/CHANGES.md index ca7900f086..48d6a5bf65 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,13 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2017-05-19] Version 6.2.0 +-------------------------- + +- Add video domain. +- Update usage record categories. +- Add `get_page` method for reentrant paging. + [2017-05-12] Version 6.1.2 ---------------------------------- diff --git a/tests/integration/video/__init__.py b/tests/integration/video/__init__.py new file mode 100644 index 0000000000..f58a79e4d6 --- /dev/null +++ b/tests/integration/video/__init__.py @@ -0,0 +1,8 @@ +# coding=utf-8 +""" +This code was generated by +\ / _ _ _| _ _ + | (_)\/(_)(_|\/| |(/_ v1.0.0 + / / +""" + diff --git a/tests/integration/video/v1/__init__.py b/tests/integration/video/v1/__init__.py new file mode 100644 index 0000000000..f58a79e4d6 --- /dev/null +++ b/tests/integration/video/v1/__init__.py @@ -0,0 +1,8 @@ +# coding=utf-8 +""" +This code was generated by +\ / _ _ _| _ _ + | (_)\/(_)(_|\/| |(/_ v1.0.0 + / / +""" + diff --git a/tests/integration/video/v1/room/__init__.py b/tests/integration/video/v1/room/__init__.py new file mode 100644 index 0000000000..f58a79e4d6 --- /dev/null +++ b/tests/integration/video/v1/room/__init__.py @@ -0,0 +1,8 @@ +# coding=utf-8 +""" +This code was generated by +\ / _ _ _| _ _ + | (_)\/(_)(_|\/| |(/_ v1.0.0 + / / +""" + diff --git a/tests/integration/video/v1/room/test_recording.py b/tests/integration/video/v1/room/test_recording.py new file mode 100644 index 0000000000..f073896e11 --- /dev/null +++ b/tests/integration/video/v1/room/test_recording.py @@ -0,0 +1,140 @@ +# coding=utf-8 +""" +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 RecordingTestCase(IntegrationTestCase): + + def test_fetch_request(self): + self.holodeck.mock(Response(500, '')) + + with self.assertRaises(TwilioException): + self.client.video.v1.rooms(sid="RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ + .recordings(sid="RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch() + + self.holodeck.assert_has_request(Request( + 'get', + 'https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', + )) + + def test_fetch_response(self): + self.holodeck.mock(Response( + 200, + ''' + { + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "status": "processing", + "date_created": "2015-07-30T20:00:00Z", + "sid": "RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "source_sid": "MTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "size": 0, + "type": "audio", + "duration": 0, + "container_format": "mka", + "codec": "OPUS", + "grouping_sids": { + "room_sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + }, + "room_sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "links": { + "media": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media" + } + } + ''' + )) + + actual = self.client.video.v1.rooms(sid="RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ + .recordings(sid="RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch() + + self.assertIsNotNone(actual) + + def test_list_request(self): + self.holodeck.mock(Response(500, '')) + + with self.assertRaises(TwilioException): + self.client.video.v1.rooms(sid="RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ + .recordings.list() + + self.holodeck.assert_has_request(Request( + 'get', + 'https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings', + )) + + def test_read_empty_response(self): + self.holodeck.mock(Response( + 200, + ''' + { + "recordings": [], + "meta": { + "page": 0, + "page_size": 50, + "first_page_url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings?PageSize=50&Page=0", + "previous_page_url": null, + "url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings?PageSize=50&Page=0", + "next_page_url": null, + "key": "recordings" + } + } + ''' + )) + + actual = self.client.video.v1.rooms(sid="RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ + .recordings.list() + + self.assertIsNotNone(actual) + + def test_read_results_response(self): + self.holodeck.mock(Response( + 200, + ''' + { + "recordings": [ + { + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "status": "completed", + "date_created": "2015-07-30T20:00:00Z", + "sid": "RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "source_sid": "MTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "size": 0, + "type": "audio", + "duration": 0, + "container_format": "mka", + "codec": "OPUS", + "grouping_sids": { + "room_sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + }, + "room_sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "links": { + "media": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media" + } + } + ], + "meta": { + "page": 0, + "page_size": 50, + "first_page_url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings?PageSize=50&Page=0", + "previous_page_url": null, + "url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings?PageSize=50&Page=0", + "next_page_url": null, + "key": "recordings" + } + } + ''' + )) + + actual = self.client.video.v1.rooms(sid="RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \ + .recordings.list() + + self.assertIsNotNone(actual) diff --git a/tests/integration/video/v1/test_recording.py b/tests/integration/video/v1/test_recording.py new file mode 100644 index 0000000000..a2ab1d008c --- /dev/null +++ b/tests/integration/video/v1/test_recording.py @@ -0,0 +1,111 @@ +# coding=utf-8 +""" +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 RecordingTestCase(IntegrationTestCase): + + def test_fetch_request(self): + self.holodeck.mock(Response(500, '')) + + with self.assertRaises(TwilioException): + self.client.video.v1.recordings(sid="RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch() + + self.holodeck.assert_has_request(Request( + 'get', + 'https://video.twilio.com/v1/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', + )) + + def test_fetch_response(self): + self.holodeck.mock(Response( + 200, + ''' + { + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "status": "processing", + "date_created": "2015-07-30T20:00:00Z", + "sid": "RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "source_sid": "MTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "size": 0, + "url": "https://video.twilio.com/v1/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "type": "audio", + "duration": 0, + "container_format": "mka", + "codec": "OPUS", + "grouping_sids": { + "room_sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + }, + "links": { + "media": "https://video.twilio.com/v1/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media" + } + } + ''' + )) + + actual = self.client.video.v1.recordings(sid="RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch() + + self.assertIsNotNone(actual) + + def test_list_request(self): + self.holodeck.mock(Response(500, '')) + + with self.assertRaises(TwilioException): + self.client.video.v1.recordings.list() + + self.holodeck.assert_has_request(Request( + 'get', + 'https://video.twilio.com/v1/Recordings', + )) + + def test_read_empty_response(self): + self.holodeck.mock(Response( + 200, + ''' + { + "recordings": [], + "meta": { + "page": 0, + "page_size": 50, + "first_page_url": "https://video.twilio.com/v1/Recordings?PageSize=50&Page=0", + "previous_page_url": null, + "url": "https://video.twilio.com/v1/Recordings?PageSize=50&Page=0", + "next_page_url": null, + "key": "recordings" + } + } + ''' + )) + + actual = self.client.video.v1.recordings.list() + + self.assertIsNotNone(actual) + + def test_delete_request(self): + self.holodeck.mock(Response(500, '')) + + with self.assertRaises(TwilioException): + self.client.video.v1.recordings(sid="RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete() + + self.holodeck.assert_has_request(Request( + 'delete', + 'https://video.twilio.com/v1/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', + )) + + def test_delete_response(self): + self.holodeck.mock(Response( + 204, + None, + )) + + actual = self.client.video.v1.recordings(sid="RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete() + + self.assertTrue(actual) diff --git a/tests/integration/video/v1/test_room.py b/tests/integration/video/v1/test_room.py new file mode 100644 index 0000000000..a0c011ec4c --- /dev/null +++ b/tests/integration/video/v1/test_room.py @@ -0,0 +1,224 @@ +# coding=utf-8 +""" +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 RoomTestCase(IntegrationTestCase): + + def test_fetch_request(self): + self.holodeck.mock(Response(500, '')) + + with self.assertRaises(TwilioException): + self.client.video.v1.rooms(sid="RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch() + + self.holodeck.assert_has_request(Request( + 'get', + 'https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', + )) + + def test_fetch_response(self): + self.holodeck.mock(Response( + 200, + ''' + { + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "date_created": "2015-07-30T20:00:00Z", + "date_updated": "2015-07-30T20:00:00Z", + "status": "in-progress", + "type": "peer-to-peer", + "sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "enable_turn": true, + "unique_name": "unique_name", + "max_participants": 10, + "duration": 0, + "status_callback_method": "POST", + "status_callback": "", + "record_participants_on_connect": false, + "end_time": "2015-07-30T20:00:00Z", + "url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "links": { + "recordings": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings" + } + } + ''' + )) + + actual = self.client.video.v1.rooms(sid="RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch() + + self.assertIsNotNone(actual) + + def test_create_request(self): + self.holodeck.mock(Response(500, '')) + + with self.assertRaises(TwilioException): + self.client.video.v1.rooms.create() + + self.holodeck.assert_has_request(Request( + 'post', + 'https://video.twilio.com/v1/Rooms', + )) + + def test_create_response(self): + self.holodeck.mock(Response( + 201, + ''' + { + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "date_created": "2015-07-30T20:00:00Z", + "date_updated": "2015-07-30T20:00:00Z", + "status": "in-progress", + "type": "peer-to-peer", + "sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "enable_turn": true, + "unique_name": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "max_participants": 10, + "duration": 0, + "status_callback_method": "POST", + "status_callback": "", + "record_participants_on_connect": false, + "end_time": "2015-07-30T20:00:00Z", + "url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "links": { + "recordings": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings" + } + } + ''' + )) + + actual = self.client.video.v1.rooms.create() + + self.assertIsNotNone(actual) + + def test_list_request(self): + self.holodeck.mock(Response(500, '')) + + with self.assertRaises(TwilioException): + self.client.video.v1.rooms.list() + + self.holodeck.assert_has_request(Request( + 'get', + 'https://video.twilio.com/v1/Rooms', + )) + + def test_read_empty_response(self): + self.holodeck.mock(Response( + 200, + ''' + { + "rooms": [], + "meta": { + "page": 0, + "page_size": 50, + "first_page_url": "https://video.twilio.com/v1/Rooms?PageSize=50&Page=0", + "previous_page_url": null, + "url": "https://video.twilio.com/v1/Rooms?PageSize=50&Page=0", + "next_page_url": null, + "key": "rooms" + } + } + ''' + )) + + actual = self.client.video.v1.rooms.list() + + self.assertIsNotNone(actual) + + def test_read_with_status_response(self): + self.holodeck.mock(Response( + 200, + ''' + { + "rooms": [ + { + "sid": "RM4070b618362c1682b2385b1f9982833c", + "status": "completed", + "date_created": "2017-04-03T22:21:49Z", + "date_updated": "2017-04-03T22:21:51Z", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "type": "peer-to-peer", + "enable_turn": true, + "unique_name": "RM4070b618362c1682b2385b1f9982833c", + "status_callback": null, + "status_callback_method": "POST", + "end_time": "2017-04-03T22:21:51Z", + "duration": 2, + "max_participants": 10, + "record_participants_on_connect": false, + "url": "https://video.twilio.com/v1/Rooms/RM4070b618362c1682b2385b1f9982833c", + "links": { + "recordings": "https://video.twilio.com/v1/Rooms/RM4070b618362c1682b2385b1f9982833c/Recordings" + } + } + ], + "meta": { + "page": 0, + "page_size": 50, + "first_page_url": "https://video.twilio.com/v1/Rooms?PageSize=50&Page=0", + "previous_page_url": null, + "url": "https://video.twilio.com/v1/Rooms?PageSize=50&Page=0", + "next_page_url": null, + "key": "rooms" + } + } + ''' + )) + + actual = self.client.video.v1.rooms.list() + + self.assertIsNotNone(actual) + + def test_update_request(self): + self.holodeck.mock(Response(500, '')) + + with self.assertRaises(TwilioException): + self.client.video.v1.rooms(sid="RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update(status="in-progress") + + values = { + 'Status': "in-progress", + } + + self.holodeck.assert_has_request(Request( + 'post', + 'https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', + data=values, + )) + + def test_update_response(self): + self.holodeck.mock(Response( + 200, + ''' + { + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "date_created": "2015-07-30T20:00:00Z", + "date_updated": "2015-07-30T20:00:00Z", + "status": "completed", + "type": "peer-to-peer", + "sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "enable_turn": true, + "unique_name": "unique_name", + "max_participants": 10, + "status_callback_method": "POST", + "status_callback": "", + "record_participants_on_connect": false, + "end_time": "2015-07-30T20:00:00Z", + "duration": 10, + "url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "links": { + "recordings": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings" + } + } + ''' + )) + + actual = self.client.video.v1.rooms(sid="RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update(status="in-progress") + + self.assertIsNotNone(actual) diff --git a/twilio/__init__.py b/twilio/__init__.py index 15f2fefeec..755479bb32 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,3 +1,3 @@ -__version_info__ = ('6', '1', '2') +__version_info__ = ('6', '2', '0') __version__ = '.'.join(__version_info__) diff --git a/twilio/rest/__init__.py b/twilio/rest/__init__.py index 0a2599b2cf..94131ac659 100644 --- a/twilio/rest/__init__.py +++ b/twilio/rest/__init__.py @@ -60,6 +60,7 @@ def __init__(self, username=None, password=None, account_sid=None, region=None, self._pricing = None self._taskrouter = None self._trunking = None + self._video = None def request(self, method, uri, params=None, data=None, headers=None, auth=None, timeout=None, allow_redirects=False): @@ -229,6 +230,19 @@ def trunking(self): self._trunking = Trunking(self) return self._trunking + @property + def video(self): + """ + Access the Video Twilio Domain + + :returns: Video Twilio Domain + :rtype: twilio.rest.video.Video + """ + if self._video is None: + from twilio.rest.video import Video + self._video = Video(self) + return self._video + @property def addresses(self): """ diff --git a/twilio/rest/accounts/v1/credential/public_key.py b/twilio/rest/accounts/v1/credential/public_key.py index df8f4eda44..4b271b9c99 100644 --- a/twilio/rest/accounts/v1/credential/public_key.py +++ b/twilio/rest/accounts/v1/credential/public_key.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -104,6 +105,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return PublicKeyPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of PublicKeyInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of PublicKeyInstance + :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for PublicKeyInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return PublicKeyPage(self._version, response, self._solution) + def create(self, public_key, friendly_name=values.unset, account_sid=values.unset): """ diff --git a/twilio/rest/api/v2010/account/__init__.py b/twilio/rest/api/v2010/account/__init__.py index aad48f7168..30b9db85df 100644 --- a/twilio/rest/api/v2010/account/__init__.py +++ b/twilio/rest/api/v2010/account/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -166,6 +167,27 @@ def page(self, friendly_name=values.unset, status=values.unset, return AccountPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of AccountInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of AccountInstance + :rtype: twilio.rest.api.v2010.account.AccountPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for AccountInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return AccountPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a AccountContext diff --git a/twilio/rest/api/v2010/account/address/__init__.py b/twilio/rest/api/v2010/account/address/__init__.py index 2f22614f71..3ebccf19aa 100644 --- a/twilio/rest/api/v2010/account/address/__init__.py +++ b/twilio/rest/api/v2010/account/address/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -169,6 +170,27 @@ def page(self, customer_name=values.unset, friendly_name=values.unset, return AddressPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of AddressInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of AddressInstance + :rtype: twilio.rest.api.v2010.account.address.AddressPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for AddressInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return AddressPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a AddressContext diff --git a/twilio/rest/api/v2010/account/address/dependent_phone_number.py b/twilio/rest/api/v2010/account/address/dependent_phone_number.py index cf7ca4cdf1..f67912aaa2 100644 --- a/twilio/rest/api/v2010/account/address/dependent_phone_number.py +++ b/twilio/rest/api/v2010/account/address/dependent_phone_number.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.page import Page @@ -108,6 +109,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return DependentPhoneNumberPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of DependentPhoneNumberInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of DependentPhoneNumberInstance + :rtype: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for DependentPhoneNumberInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return DependentPhoneNumberPage(self._version, response, self._solution) + def __repr__(self): """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/application.py b/twilio/rest/api/v2010/account/application.py index f0b26de582..7d866b0963 100644 --- a/twilio/rest/api/v2010/account/application.py +++ b/twilio/rest/api/v2010/account/application.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -173,6 +174,27 @@ def page(self, friendly_name=values.unset, page_token=values.unset, return ApplicationPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of ApplicationInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of ApplicationInstance + :rtype: twilio.rest.api.v2010.account.application.ApplicationPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for ApplicationInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return ApplicationPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a ApplicationContext diff --git a/twilio/rest/api/v2010/account/authorized_connect_app.py b/twilio/rest/api/v2010/account/authorized_connect_app.py index e4d19c2566..76a7fef8e1 100644 --- a/twilio/rest/api/v2010/account/authorized_connect_app.py +++ b/twilio/rest/api/v2010/account/authorized_connect_app.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -107,6 +108,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return AuthorizedConnectAppPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of AuthorizedConnectAppInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of AuthorizedConnectAppInstance + :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for AuthorizedConnectAppInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return AuthorizedConnectAppPage(self._version, response, self._solution) + def get(self, connect_app_sid): """ Constructs a AuthorizedConnectAppContext diff --git a/twilio/rest/api/v2010/account/available_phone_number/__init__.py b/twilio/rest/api/v2010/account/available_phone_number/__init__.py index 71d51a4e38..447c7a1a1c 100644 --- a/twilio/rest/api/v2010/account/available_phone_number/__init__.py +++ b/twilio/rest/api/v2010/account/available_phone_number/__init__.py @@ -7,6 +7,7 @@ """ from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -109,6 +110,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return AvailablePhoneNumberCountryPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of AvailablePhoneNumberCountryInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of AvailablePhoneNumberCountryInstance + :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for AvailablePhoneNumberCountryInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return AvailablePhoneNumberCountryPage(self._version, response, self._solution) + def get(self, country_code): """ Constructs a AvailablePhoneNumberCountryContext diff --git a/twilio/rest/api/v2010/account/available_phone_number/local.py b/twilio/rest/api/v2010/account/available_phone_number/local.py index 9f4ca5b4e6..ecdae4e324 100644 --- a/twilio/rest/api/v2010/account/available_phone_number/local.py +++ b/twilio/rest/api/v2010/account/available_phone_number/local.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.page import Page @@ -229,6 +230,27 @@ def page(self, area_code=values.unset, contains=values.unset, return LocalPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of LocalInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of LocalInstance + :rtype: twilio.rest.api.v2010.account.available_phone_number.local.LocalPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for LocalInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return LocalPage(self._version, response, self._solution) + def __repr__(self): """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/available_phone_number/mobile.py b/twilio/rest/api/v2010/account/available_phone_number/mobile.py index dd260f701a..40efe33b76 100644 --- a/twilio/rest/api/v2010/account/available_phone_number/mobile.py +++ b/twilio/rest/api/v2010/account/available_phone_number/mobile.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.page import Page @@ -229,6 +230,27 @@ def page(self, area_code=values.unset, contains=values.unset, return MobilePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of MobileInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of MobileInstance + :rtype: twilio.rest.api.v2010.account.available_phone_number.mobile.MobilePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for MobileInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return MobilePage(self._version, response, self._solution) + def __repr__(self): """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/available_phone_number/toll_free.py b/twilio/rest/api/v2010/account/available_phone_number/toll_free.py index e382a81442..c47947f9c8 100644 --- a/twilio/rest/api/v2010/account/available_phone_number/toll_free.py +++ b/twilio/rest/api/v2010/account/available_phone_number/toll_free.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.page import Page @@ -229,6 +230,27 @@ def page(self, area_code=values.unset, contains=values.unset, return TollFreePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of TollFreeInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of TollFreeInstance + :rtype: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for TollFreeInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return TollFreePage(self._version, response, self._solution) + def __repr__(self): """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/call/__init__.py b/twilio/rest/api/v2010/account/call/__init__.py index adfdc16cea..865c471a76 100644 --- a/twilio/rest/api/v2010/account/call/__init__.py +++ b/twilio/rest/api/v2010/account/call/__init__.py @@ -9,6 +9,7 @@ from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -266,6 +267,27 @@ def page(self, to=values.unset, from_=values.unset, return CallPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of CallInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of CallInstance + :rtype: twilio.rest.api.v2010.account.call.CallPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for CallInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return CallPage(self._version, response, self._solution) + @property def feedback_summaries(self): """ diff --git a/twilio/rest/api/v2010/account/call/notification.py b/twilio/rest/api/v2010/account/call/notification.py index 839d0808e0..40e803e9ae 100644 --- a/twilio/rest/api/v2010/account/call/notification.py +++ b/twilio/rest/api/v2010/account/call/notification.py @@ -9,6 +9,7 @@ from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -140,6 +141,27 @@ def page(self, log=values.unset, message_date_before=values.unset, return NotificationPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of NotificationInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of NotificationInstance + :rtype: twilio.rest.api.v2010.account.call.notification.NotificationPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for NotificationInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return NotificationPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a NotificationContext diff --git a/twilio/rest/api/v2010/account/call/recording.py b/twilio/rest/api/v2010/account/call/recording.py index 0faebd7dbe..7d8c95efe2 100644 --- a/twilio/rest/api/v2010/account/call/recording.py +++ b/twilio/rest/api/v2010/account/call/recording.py @@ -9,6 +9,7 @@ from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -131,6 +132,27 @@ def page(self, date_created_before=values.unset, date_created=values.unset, return RecordingPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of RecordingInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of RecordingInstance + :rtype: twilio.rest.api.v2010.account.call.recording.RecordingPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for RecordingInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return RecordingPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a RecordingContext diff --git a/twilio/rest/api/v2010/account/conference/__init__.py b/twilio/rest/api/v2010/account/conference/__init__.py index 81b1b0fd37..3332f48cb7 100644 --- a/twilio/rest/api/v2010/account/conference/__init__.py +++ b/twilio/rest/api/v2010/account/conference/__init__.py @@ -9,6 +9,7 @@ from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -169,6 +170,27 @@ def page(self, date_created_before=values.unset, date_created=values.unset, return ConferencePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of ConferenceInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of ConferenceInstance + :rtype: twilio.rest.api.v2010.account.conference.ConferencePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for ConferenceInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return ConferencePage(self._version, response, self._solution) + def get(self, sid): """ Constructs a ConferenceContext diff --git a/twilio/rest/api/v2010/account/conference/participant.py b/twilio/rest/api/v2010/account/conference/participant.py index 44e9d879be..1c615cdc45 100644 --- a/twilio/rest/api/v2010/account/conference/participant.py +++ b/twilio/rest/api/v2010/account/conference/participant.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -221,6 +222,27 @@ def page(self, muted=values.unset, hold=values.unset, page_token=values.unset, return ParticipantPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of ParticipantInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of ParticipantInstance + :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for ParticipantInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return ParticipantPage(self._version, response, self._solution) + def get(self, call_sid): """ Constructs a ParticipantContext diff --git a/twilio/rest/api/v2010/account/connect_app.py b/twilio/rest/api/v2010/account/connect_app.py index d377204f61..37ba645862 100644 --- a/twilio/rest/api/v2010/account/connect_app.py +++ b/twilio/rest/api/v2010/account/connect_app.py @@ -7,6 +7,7 @@ """ from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -106,6 +107,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return ConnectAppPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of ConnectAppInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of ConnectAppInstance + :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for ConnectAppInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return ConnectAppPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a ConnectAppContext diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py b/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py index 4fd5f8d93c..ed4aceac45 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -136,6 +137,27 @@ def page(self, beta=values.unset, friendly_name=values.unset, return IncomingPhoneNumberPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of IncomingPhoneNumberInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of IncomingPhoneNumberInstance + :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for IncomingPhoneNumberInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return IncomingPhoneNumberPage(self._version, response, self._solution) + def create(self, api_version=values.unset, friendly_name=values.unset, sms_application_sid=values.unset, sms_fallback_method=values.unset, sms_fallback_url=values.unset, sms_method=values.unset, diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/local.py b/twilio/rest/api/v2010/account/incoming_phone_number/local.py index 9814140688..9e2ab123ba 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/local.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/local.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.page import Page @@ -127,6 +128,27 @@ def page(self, beta=values.unset, friendly_name=values.unset, return LocalPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of LocalInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of LocalInstance + :rtype: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for LocalInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return LocalPage(self._version, response, self._solution) + def create(self, phone_number, api_version=values.unset, friendly_name=values.unset, sms_application_sid=values.unset, sms_fallback_method=values.unset, sms_fallback_url=values.unset, diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py b/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py index 2ff89ea41b..25fa89d66b 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.page import Page @@ -127,6 +128,27 @@ def page(self, beta=values.unset, friendly_name=values.unset, return MobilePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of MobileInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of MobileInstance + :rtype: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobilePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for MobileInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return MobilePage(self._version, response, self._solution) + def create(self, phone_number, api_version=values.unset, friendly_name=values.unset, sms_application_sid=values.unset, sms_fallback_method=values.unset, sms_fallback_url=values.unset, diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py b/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py index 9a18f7d23e..3499723b58 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.page import Page @@ -127,6 +128,27 @@ def page(self, beta=values.unset, friendly_name=values.unset, return TollFreePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of TollFreeInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of TollFreeInstance + :rtype: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for TollFreeInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return TollFreePage(self._version, response, self._solution) + def create(self, phone_number, api_version=values.unset, friendly_name=values.unset, sms_application_sid=values.unset, sms_fallback_method=values.unset, sms_fallback_url=values.unset, diff --git a/twilio/rest/api/v2010/account/key.py b/twilio/rest/api/v2010/account/key.py index 71c30e3534..b2ab973a76 100644 --- a/twilio/rest/api/v2010/account/key.py +++ b/twilio/rest/api/v2010/account/key.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -107,6 +108,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return KeyPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of KeyInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of KeyInstance + :rtype: twilio.rest.api.v2010.account.key.KeyPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for KeyInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return KeyPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a KeyContext diff --git a/twilio/rest/api/v2010/account/message/__init__.py b/twilio/rest/api/v2010/account/message/__init__.py index 215b700399..581e263a2a 100644 --- a/twilio/rest/api/v2010/account/message/__init__.py +++ b/twilio/rest/api/v2010/account/message/__init__.py @@ -9,6 +9,7 @@ from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -193,6 +194,27 @@ def page(self, to=values.unset, from_=values.unset, return MessagePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of MessageInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of MessageInstance + :rtype: twilio.rest.api.v2010.account.message.MessagePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for MessageInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return MessagePage(self._version, response, self._solution) + def get(self, sid): """ Constructs a MessageContext diff --git a/twilio/rest/api/v2010/account/message/media.py b/twilio/rest/api/v2010/account/message/media.py index 34e2703a90..2f958e2418 100644 --- a/twilio/rest/api/v2010/account/message/media.py +++ b/twilio/rest/api/v2010/account/message/media.py @@ -9,6 +9,7 @@ from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -131,6 +132,27 @@ def page(self, date_created_before=values.unset, date_created=values.unset, return MediaPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of MediaInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of MediaInstance + :rtype: twilio.rest.api.v2010.account.message.media.MediaPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for MediaInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return MediaPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a MediaContext diff --git a/twilio/rest/api/v2010/account/notification.py b/twilio/rest/api/v2010/account/notification.py index dfcc99e002..3702d503e2 100644 --- a/twilio/rest/api/v2010/account/notification.py +++ b/twilio/rest/api/v2010/account/notification.py @@ -9,6 +9,7 @@ from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -138,6 +139,27 @@ def page(self, log=values.unset, message_date_before=values.unset, return NotificationPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of NotificationInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of NotificationInstance + :rtype: twilio.rest.api.v2010.account.notification.NotificationPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for NotificationInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return NotificationPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a NotificationContext diff --git a/twilio/rest/api/v2010/account/outgoing_caller_id.py b/twilio/rest/api/v2010/account/outgoing_caller_id.py index 67e643b2e5..aa831bfdcc 100644 --- a/twilio/rest/api/v2010/account/outgoing_caller_id.py +++ b/twilio/rest/api/v2010/account/outgoing_caller_id.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -122,6 +123,27 @@ def page(self, phone_number=values.unset, friendly_name=values.unset, return OutgoingCallerIdPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of OutgoingCallerIdInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of OutgoingCallerIdInstance + :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for OutgoingCallerIdInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return OutgoingCallerIdPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a OutgoingCallerIdContext diff --git a/twilio/rest/api/v2010/account/queue/__init__.py b/twilio/rest/api/v2010/account/queue/__init__.py index e55b82379d..f34f095fbe 100644 --- a/twilio/rest/api/v2010/account/queue/__init__.py +++ b/twilio/rest/api/v2010/account/queue/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -108,6 +109,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return QueuePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of QueueInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of QueueInstance + :rtype: twilio.rest.api.v2010.account.queue.QueuePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for QueueInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return QueuePage(self._version, response, self._solution) + def create(self, friendly_name, max_size=values.unset): """ Create a new QueueInstance diff --git a/twilio/rest/api/v2010/account/queue/member.py b/twilio/rest/api/v2010/account/queue/member.py index a45aa489a6..dbf4d6ad7c 100644 --- a/twilio/rest/api/v2010/account/queue/member.py +++ b/twilio/rest/api/v2010/account/queue/member.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -109,6 +110,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return MemberPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of MemberInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of MemberInstance + :rtype: twilio.rest.api.v2010.account.queue.member.MemberPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for MemberInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return MemberPage(self._version, response, self._solution) + def get(self, call_sid): """ Constructs a MemberContext diff --git a/twilio/rest/api/v2010/account/recording/__init__.py b/twilio/rest/api/v2010/account/recording/__init__.py index 6713743960..fecbaa2a4c 100644 --- a/twilio/rest/api/v2010/account/recording/__init__.py +++ b/twilio/rest/api/v2010/account/recording/__init__.py @@ -9,6 +9,7 @@ from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -140,6 +141,27 @@ def page(self, date_created_before=values.unset, date_created=values.unset, return RecordingPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of RecordingInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of RecordingInstance + :rtype: twilio.rest.api.v2010.account.recording.RecordingPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for RecordingInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return RecordingPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a RecordingContext diff --git a/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py b/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py index e6a8a72f0e..9df36130cd 100644 --- a/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py +++ b/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -110,6 +111,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return AddOnResultPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of AddOnResultInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of AddOnResultInstance + :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for AddOnResultInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return AddOnResultPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a AddOnResultContext diff --git a/twilio/rest/api/v2010/account/recording/add_on_result/payload/__init__.py b/twilio/rest/api/v2010/account/recording/add_on_result/payload/__init__.py index 624bbcb91b..03b13aab8c 100644 --- a/twilio/rest/api/v2010/account/recording/add_on_result/payload/__init__.py +++ b/twilio/rest/api/v2010/account/recording/add_on_result/payload/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -111,6 +112,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return PayloadPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of PayloadInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of PayloadInstance + :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for PayloadInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return PayloadPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a PayloadContext diff --git a/twilio/rest/api/v2010/account/recording/transcription.py b/twilio/rest/api/v2010/account/recording/transcription.py index 3838d914be..2e8a034cb3 100644 --- a/twilio/rest/api/v2010/account/recording/transcription.py +++ b/twilio/rest/api/v2010/account/recording/transcription.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -109,6 +110,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return TranscriptionPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of TranscriptionInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of TranscriptionInstance + :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for TranscriptionInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return TranscriptionPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a TranscriptionContext diff --git a/twilio/rest/api/v2010/account/short_code.py b/twilio/rest/api/v2010/account/short_code.py index 05102f4e9b..9d2e4b203e 100644 --- a/twilio/rest/api/v2010/account/short_code.py +++ b/twilio/rest/api/v2010/account/short_code.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -122,6 +123,27 @@ def page(self, friendly_name=values.unset, short_code=values.unset, return ShortCodePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of ShortCodeInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of ShortCodeInstance + :rtype: twilio.rest.api.v2010.account.short_code.ShortCodePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for ShortCodeInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return ShortCodePage(self._version, response, self._solution) + def get(self, sid): """ Constructs a ShortCodeContext diff --git a/twilio/rest/api/v2010/account/signing_key.py b/twilio/rest/api/v2010/account/signing_key.py index 2ce8f1fb07..6a1ddf59ab 100644 --- a/twilio/rest/api/v2010/account/signing_key.py +++ b/twilio/rest/api/v2010/account/signing_key.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -107,6 +108,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return SigningKeyPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of SigningKeyInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of SigningKeyInstance + :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for SigningKeyInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return SigningKeyPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a SigningKeyContext diff --git a/twilio/rest/api/v2010/account/sip/credential_list/__init__.py b/twilio/rest/api/v2010/account/sip/credential_list/__init__.py index f08d784094..981f032025 100644 --- a/twilio/rest/api/v2010/account/sip/credential_list/__init__.py +++ b/twilio/rest/api/v2010/account/sip/credential_list/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -108,6 +109,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return CredentialListPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of CredentialListInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of CredentialListInstance + :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for CredentialListInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return CredentialListPage(self._version, response, self._solution) + def create(self, friendly_name): """ Create a new CredentialListInstance diff --git a/twilio/rest/api/v2010/account/sip/credential_list/credential.py b/twilio/rest/api/v2010/account/sip/credential_list/credential.py index db3a0ef433..5219418599 100644 --- a/twilio/rest/api/v2010/account/sip/credential_list/credential.py +++ b/twilio/rest/api/v2010/account/sip/credential_list/credential.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -109,6 +110,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return CredentialPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of CredentialInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of CredentialInstance + :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for CredentialInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return CredentialPage(self._version, response, self._solution) + def create(self, username, password): """ Create a new CredentialInstance diff --git a/twilio/rest/api/v2010/account/sip/domain/__init__.py b/twilio/rest/api/v2010/account/sip/domain/__init__.py index 7f8b8812b3..a5204c4670 100644 --- a/twilio/rest/api/v2010/account/sip/domain/__init__.py +++ b/twilio/rest/api/v2010/account/sip/domain/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -109,6 +110,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return DomainPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of DomainInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of DomainInstance + :rtype: twilio.rest.api.v2010.account.sip.domain.DomainPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for DomainInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return DomainPage(self._version, response, self._solution) + def create(self, domain_name, friendly_name=values.unset, auth_type=values.unset, voice_url=values.unset, voice_method=values.unset, voice_fallback_url=values.unset, diff --git a/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py index 993e8484e2..7dfaf086c1 100644 --- a/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py +++ b/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -135,6 +136,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return CredentialListMappingPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of CredentialListMappingInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of CredentialListMappingInstance + :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for CredentialListMappingInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return CredentialListMappingPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a CredentialListMappingContext diff --git a/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py index 3b10f4f762..88a9222537 100644 --- a/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py +++ b/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -135,6 +136,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return IpAccessControlListMappingPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of IpAccessControlListMappingInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of IpAccessControlListMappingInstance + :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for IpAccessControlListMappingInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return IpAccessControlListMappingPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a IpAccessControlListMappingContext diff --git a/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py b/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py index c36f02346f..85780fe157 100644 --- a/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py +++ b/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -108,6 +109,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return IpAccessControlListPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of IpAccessControlListInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of IpAccessControlListInstance + :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for IpAccessControlListInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return IpAccessControlListPage(self._version, response, self._solution) + def create(self, friendly_name): """ Create a new IpAccessControlListInstance diff --git a/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py b/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py index bc6b28cbb3..c8ec3b2aad 100644 --- a/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py +++ b/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -109,6 +110,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return IpAddressPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of IpAddressInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of IpAddressInstance + :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for IpAddressInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return IpAddressPage(self._version, response, self._solution) + def create(self, friendly_name, ip_address): """ Create a new IpAddressInstance diff --git a/twilio/rest/api/v2010/account/transcription.py b/twilio/rest/api/v2010/account/transcription.py index 58b9876cad..9ea73ef652 100644 --- a/twilio/rest/api/v2010/account/transcription.py +++ b/twilio/rest/api/v2010/account/transcription.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -107,6 +108,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return TranscriptionPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of TranscriptionInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of TranscriptionInstance + :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for TranscriptionInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return TranscriptionPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a TranscriptionContext diff --git a/twilio/rest/api/v2010/account/usage/record/__init__.py b/twilio/rest/api/v2010/account/usage/record/__init__.py index 32380cee6f..b5f4767d6d 100644 --- a/twilio/rest/api/v2010/account/usage/record/__init__.py +++ b/twilio/rest/api/v2010/account/usage/record/__init__.py @@ -9,6 +9,7 @@ from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.page import Page @@ -146,6 +147,27 @@ def page(self, category=values.unset, start_date=values.unset, return RecordPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of RecordInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of RecordInstance + :rtype: twilio.rest.api.v2010.account.usage.record.RecordPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for RecordInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return RecordPage(self._version, response, self._solution) + @property def all_time(self): """ @@ -385,6 +407,12 @@ class Category(object): MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" + MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" + MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" + MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" + MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" + MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" + MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" MEDIASTORAGE = "mediastorage" MMS = "mms" MMS_INBOUND = "mms-inbound" @@ -396,12 +424,17 @@ class Category(object): MONITOR_READS = "monitor-reads" MONITOR_STORAGE = "monitor-storage" MONITOR_WRITES = "monitor-writes" + NOTIFY = "notify" + NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" + NOTIFY_CHANNELS = "notify-channels" NUMBER_FORMAT_LOOKUPS = "number-format-lookups" PCHAT = "pchat" PCHAT_ACTIONS = "pchat-actions" PCHAT_APS = "pchat-aps" PCHAT_NOTIFICATIONS = "pchat-notifications" PCHAT_READS = "pchat-reads" + PCHAT_USERS = "pchat-users" + PCHAT_MESSAGES = "pchat-messages" PFAX = "pfax" PFAX_MINUTES = "pfax-minutes" PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" @@ -443,6 +476,7 @@ class Category(object): SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" + SMS_MESSAGES_FEATURES = "sms-messages-features" TASKROUTER_TASKS = "taskrouter-tasks" TOTALPRICE = "totalprice" TRANSCRIPTIONS = "transcriptions" @@ -490,6 +524,7 @@ class Category(object): WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" + SYNC = "sync" def __init__(self, version, payload, account_sid): """ diff --git a/twilio/rest/api/v2010/account/usage/record/all_time.py b/twilio/rest/api/v2010/account/usage/record/all_time.py index b9def12c50..5be26a058f 100644 --- a/twilio/rest/api/v2010/account/usage/record/all_time.py +++ b/twilio/rest/api/v2010/account/usage/record/all_time.py @@ -9,6 +9,7 @@ from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.page import Page @@ -128,6 +129,27 @@ def page(self, category=values.unset, start_date=values.unset, return AllTimePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of AllTimeInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of AllTimeInstance + :rtype: twilio.rest.api.v2010.account.usage.record.all_time.AllTimePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for AllTimeInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return AllTimePage(self._version, response, self._solution) + def __repr__(self): """ Provide a friendly representation @@ -247,6 +269,12 @@ class Category(object): MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" + MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" + MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" + MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" + MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" + MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" + MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" MEDIASTORAGE = "mediastorage" MMS = "mms" MMS_INBOUND = "mms-inbound" @@ -258,12 +286,17 @@ class Category(object): MONITOR_READS = "monitor-reads" MONITOR_STORAGE = "monitor-storage" MONITOR_WRITES = "monitor-writes" + NOTIFY = "notify" + NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" + NOTIFY_CHANNELS = "notify-channels" NUMBER_FORMAT_LOOKUPS = "number-format-lookups" PCHAT = "pchat" PCHAT_ACTIONS = "pchat-actions" PCHAT_APS = "pchat-aps" PCHAT_NOTIFICATIONS = "pchat-notifications" PCHAT_READS = "pchat-reads" + PCHAT_USERS = "pchat-users" + PCHAT_MESSAGES = "pchat-messages" PFAX = "pfax" PFAX_MINUTES = "pfax-minutes" PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" @@ -305,6 +338,7 @@ class Category(object): SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" + SMS_MESSAGES_FEATURES = "sms-messages-features" TASKROUTER_TASKS = "taskrouter-tasks" TOTALPRICE = "totalprice" TRANSCRIPTIONS = "transcriptions" @@ -352,6 +386,7 @@ class Category(object): WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" + SYNC = "sync" def __init__(self, version, payload, account_sid): """ diff --git a/twilio/rest/api/v2010/account/usage/record/daily.py b/twilio/rest/api/v2010/account/usage/record/daily.py index 50f9c5d87f..2726591656 100644 --- a/twilio/rest/api/v2010/account/usage/record/daily.py +++ b/twilio/rest/api/v2010/account/usage/record/daily.py @@ -9,6 +9,7 @@ from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.page import Page @@ -128,6 +129,27 @@ def page(self, category=values.unset, start_date=values.unset, return DailyPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of DailyInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of DailyInstance + :rtype: twilio.rest.api.v2010.account.usage.record.daily.DailyPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for DailyInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return DailyPage(self._version, response, self._solution) + def __repr__(self): """ Provide a friendly representation @@ -247,6 +269,12 @@ class Category(object): MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" + MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" + MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" + MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" + MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" + MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" + MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" MEDIASTORAGE = "mediastorage" MMS = "mms" MMS_INBOUND = "mms-inbound" @@ -258,12 +286,17 @@ class Category(object): MONITOR_READS = "monitor-reads" MONITOR_STORAGE = "monitor-storage" MONITOR_WRITES = "monitor-writes" + NOTIFY = "notify" + NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" + NOTIFY_CHANNELS = "notify-channels" NUMBER_FORMAT_LOOKUPS = "number-format-lookups" PCHAT = "pchat" PCHAT_ACTIONS = "pchat-actions" PCHAT_APS = "pchat-aps" PCHAT_NOTIFICATIONS = "pchat-notifications" PCHAT_READS = "pchat-reads" + PCHAT_USERS = "pchat-users" + PCHAT_MESSAGES = "pchat-messages" PFAX = "pfax" PFAX_MINUTES = "pfax-minutes" PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" @@ -305,6 +338,7 @@ class Category(object): SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" + SMS_MESSAGES_FEATURES = "sms-messages-features" TASKROUTER_TASKS = "taskrouter-tasks" TOTALPRICE = "totalprice" TRANSCRIPTIONS = "transcriptions" @@ -352,6 +386,7 @@ class Category(object): WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" + SYNC = "sync" def __init__(self, version, payload, account_sid): """ diff --git a/twilio/rest/api/v2010/account/usage/record/last_month.py b/twilio/rest/api/v2010/account/usage/record/last_month.py index 7c76f155f0..80d234778b 100644 --- a/twilio/rest/api/v2010/account/usage/record/last_month.py +++ b/twilio/rest/api/v2010/account/usage/record/last_month.py @@ -9,6 +9,7 @@ from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.page import Page @@ -128,6 +129,27 @@ def page(self, category=values.unset, start_date=values.unset, return LastMonthPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of LastMonthInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of LastMonthInstance + :rtype: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for LastMonthInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return LastMonthPage(self._version, response, self._solution) + def __repr__(self): """ Provide a friendly representation @@ -247,6 +269,12 @@ class Category(object): MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" + MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" + MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" + MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" + MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" + MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" + MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" MEDIASTORAGE = "mediastorage" MMS = "mms" MMS_INBOUND = "mms-inbound" @@ -258,12 +286,17 @@ class Category(object): MONITOR_READS = "monitor-reads" MONITOR_STORAGE = "monitor-storage" MONITOR_WRITES = "monitor-writes" + NOTIFY = "notify" + NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" + NOTIFY_CHANNELS = "notify-channels" NUMBER_FORMAT_LOOKUPS = "number-format-lookups" PCHAT = "pchat" PCHAT_ACTIONS = "pchat-actions" PCHAT_APS = "pchat-aps" PCHAT_NOTIFICATIONS = "pchat-notifications" PCHAT_READS = "pchat-reads" + PCHAT_USERS = "pchat-users" + PCHAT_MESSAGES = "pchat-messages" PFAX = "pfax" PFAX_MINUTES = "pfax-minutes" PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" @@ -305,6 +338,7 @@ class Category(object): SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" + SMS_MESSAGES_FEATURES = "sms-messages-features" TASKROUTER_TASKS = "taskrouter-tasks" TOTALPRICE = "totalprice" TRANSCRIPTIONS = "transcriptions" @@ -352,6 +386,7 @@ class Category(object): WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" + SYNC = "sync" def __init__(self, version, payload, account_sid): """ diff --git a/twilio/rest/api/v2010/account/usage/record/monthly.py b/twilio/rest/api/v2010/account/usage/record/monthly.py index 647b72e073..4bc731a5dd 100644 --- a/twilio/rest/api/v2010/account/usage/record/monthly.py +++ b/twilio/rest/api/v2010/account/usage/record/monthly.py @@ -9,6 +9,7 @@ from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.page import Page @@ -128,6 +129,27 @@ def page(self, category=values.unset, start_date=values.unset, return MonthlyPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of MonthlyInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of MonthlyInstance + :rtype: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for MonthlyInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return MonthlyPage(self._version, response, self._solution) + def __repr__(self): """ Provide a friendly representation @@ -247,6 +269,12 @@ class Category(object): MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" + MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" + MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" + MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" + MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" + MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" + MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" MEDIASTORAGE = "mediastorage" MMS = "mms" MMS_INBOUND = "mms-inbound" @@ -258,12 +286,17 @@ class Category(object): MONITOR_READS = "monitor-reads" MONITOR_STORAGE = "monitor-storage" MONITOR_WRITES = "monitor-writes" + NOTIFY = "notify" + NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" + NOTIFY_CHANNELS = "notify-channels" NUMBER_FORMAT_LOOKUPS = "number-format-lookups" PCHAT = "pchat" PCHAT_ACTIONS = "pchat-actions" PCHAT_APS = "pchat-aps" PCHAT_NOTIFICATIONS = "pchat-notifications" PCHAT_READS = "pchat-reads" + PCHAT_USERS = "pchat-users" + PCHAT_MESSAGES = "pchat-messages" PFAX = "pfax" PFAX_MINUTES = "pfax-minutes" PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" @@ -305,6 +338,7 @@ class Category(object): SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" + SMS_MESSAGES_FEATURES = "sms-messages-features" TASKROUTER_TASKS = "taskrouter-tasks" TOTALPRICE = "totalprice" TRANSCRIPTIONS = "transcriptions" @@ -352,6 +386,7 @@ class Category(object): WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" + SYNC = "sync" def __init__(self, version, payload, account_sid): """ diff --git a/twilio/rest/api/v2010/account/usage/record/this_month.py b/twilio/rest/api/v2010/account/usage/record/this_month.py index 904547e3c1..a985356797 100644 --- a/twilio/rest/api/v2010/account/usage/record/this_month.py +++ b/twilio/rest/api/v2010/account/usage/record/this_month.py @@ -9,6 +9,7 @@ from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.page import Page @@ -128,6 +129,27 @@ def page(self, category=values.unset, start_date=values.unset, return ThisMonthPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of ThisMonthInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of ThisMonthInstance + :rtype: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for ThisMonthInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return ThisMonthPage(self._version, response, self._solution) + def __repr__(self): """ Provide a friendly representation @@ -247,6 +269,12 @@ class Category(object): MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" + MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" + MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" + MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" + MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" + MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" + MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" MEDIASTORAGE = "mediastorage" MMS = "mms" MMS_INBOUND = "mms-inbound" @@ -258,12 +286,17 @@ class Category(object): MONITOR_READS = "monitor-reads" MONITOR_STORAGE = "monitor-storage" MONITOR_WRITES = "monitor-writes" + NOTIFY = "notify" + NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" + NOTIFY_CHANNELS = "notify-channels" NUMBER_FORMAT_LOOKUPS = "number-format-lookups" PCHAT = "pchat" PCHAT_ACTIONS = "pchat-actions" PCHAT_APS = "pchat-aps" PCHAT_NOTIFICATIONS = "pchat-notifications" PCHAT_READS = "pchat-reads" + PCHAT_USERS = "pchat-users" + PCHAT_MESSAGES = "pchat-messages" PFAX = "pfax" PFAX_MINUTES = "pfax-minutes" PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" @@ -305,6 +338,7 @@ class Category(object): SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" + SMS_MESSAGES_FEATURES = "sms-messages-features" TASKROUTER_TASKS = "taskrouter-tasks" TOTALPRICE = "totalprice" TRANSCRIPTIONS = "transcriptions" @@ -352,6 +386,7 @@ class Category(object): WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" + SYNC = "sync" def __init__(self, version, payload, account_sid): """ diff --git a/twilio/rest/api/v2010/account/usage/record/today.py b/twilio/rest/api/v2010/account/usage/record/today.py index 779fa1f06a..31bd5a6580 100644 --- a/twilio/rest/api/v2010/account/usage/record/today.py +++ b/twilio/rest/api/v2010/account/usage/record/today.py @@ -9,6 +9,7 @@ from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.page import Page @@ -128,6 +129,27 @@ def page(self, category=values.unset, start_date=values.unset, return TodayPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of TodayInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of TodayInstance + :rtype: twilio.rest.api.v2010.account.usage.record.today.TodayPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for TodayInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return TodayPage(self._version, response, self._solution) + def __repr__(self): """ Provide a friendly representation @@ -247,6 +269,12 @@ class Category(object): MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" + MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" + MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" + MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" + MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" + MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" + MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" MEDIASTORAGE = "mediastorage" MMS = "mms" MMS_INBOUND = "mms-inbound" @@ -258,12 +286,17 @@ class Category(object): MONITOR_READS = "monitor-reads" MONITOR_STORAGE = "monitor-storage" MONITOR_WRITES = "monitor-writes" + NOTIFY = "notify" + NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" + NOTIFY_CHANNELS = "notify-channels" NUMBER_FORMAT_LOOKUPS = "number-format-lookups" PCHAT = "pchat" PCHAT_ACTIONS = "pchat-actions" PCHAT_APS = "pchat-aps" PCHAT_NOTIFICATIONS = "pchat-notifications" PCHAT_READS = "pchat-reads" + PCHAT_USERS = "pchat-users" + PCHAT_MESSAGES = "pchat-messages" PFAX = "pfax" PFAX_MINUTES = "pfax-minutes" PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" @@ -305,6 +338,7 @@ class Category(object): SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" + SMS_MESSAGES_FEATURES = "sms-messages-features" TASKROUTER_TASKS = "taskrouter-tasks" TOTALPRICE = "totalprice" TRANSCRIPTIONS = "transcriptions" @@ -352,6 +386,7 @@ class Category(object): WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" + SYNC = "sync" def __init__(self, version, payload, account_sid): """ diff --git a/twilio/rest/api/v2010/account/usage/record/yearly.py b/twilio/rest/api/v2010/account/usage/record/yearly.py index 56a2f1b244..b6d3126d4a 100644 --- a/twilio/rest/api/v2010/account/usage/record/yearly.py +++ b/twilio/rest/api/v2010/account/usage/record/yearly.py @@ -9,6 +9,7 @@ from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.page import Page @@ -128,6 +129,27 @@ def page(self, category=values.unset, start_date=values.unset, return YearlyPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of YearlyInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of YearlyInstance + :rtype: twilio.rest.api.v2010.account.usage.record.yearly.YearlyPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for YearlyInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return YearlyPage(self._version, response, self._solution) + def __repr__(self): """ Provide a friendly representation @@ -247,6 +269,12 @@ class Category(object): MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" + MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" + MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" + MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" + MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" + MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" + MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" MEDIASTORAGE = "mediastorage" MMS = "mms" MMS_INBOUND = "mms-inbound" @@ -258,12 +286,17 @@ class Category(object): MONITOR_READS = "monitor-reads" MONITOR_STORAGE = "monitor-storage" MONITOR_WRITES = "monitor-writes" + NOTIFY = "notify" + NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" + NOTIFY_CHANNELS = "notify-channels" NUMBER_FORMAT_LOOKUPS = "number-format-lookups" PCHAT = "pchat" PCHAT_ACTIONS = "pchat-actions" PCHAT_APS = "pchat-aps" PCHAT_NOTIFICATIONS = "pchat-notifications" PCHAT_READS = "pchat-reads" + PCHAT_USERS = "pchat-users" + PCHAT_MESSAGES = "pchat-messages" PFAX = "pfax" PFAX_MINUTES = "pfax-minutes" PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" @@ -305,6 +338,7 @@ class Category(object): SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" + SMS_MESSAGES_FEATURES = "sms-messages-features" TASKROUTER_TASKS = "taskrouter-tasks" TOTALPRICE = "totalprice" TRANSCRIPTIONS = "transcriptions" @@ -352,6 +386,7 @@ class Category(object): WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" + SYNC = "sync" def __init__(self, version, payload, account_sid): """ diff --git a/twilio/rest/api/v2010/account/usage/record/yesterday.py b/twilio/rest/api/v2010/account/usage/record/yesterday.py index c0c55c48d7..b2fc841e6c 100644 --- a/twilio/rest/api/v2010/account/usage/record/yesterday.py +++ b/twilio/rest/api/v2010/account/usage/record/yesterday.py @@ -9,6 +9,7 @@ from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.page import Page @@ -128,6 +129,27 @@ def page(self, category=values.unset, start_date=values.unset, return YesterdayPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of YesterdayInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of YesterdayInstance + :rtype: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for YesterdayInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return YesterdayPage(self._version, response, self._solution) + def __repr__(self): """ Provide a friendly representation @@ -247,6 +269,12 @@ class Category(object): MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" + MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" + MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" + MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" + MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" + MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" + MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" MEDIASTORAGE = "mediastorage" MMS = "mms" MMS_INBOUND = "mms-inbound" @@ -258,12 +286,17 @@ class Category(object): MONITOR_READS = "monitor-reads" MONITOR_STORAGE = "monitor-storage" MONITOR_WRITES = "monitor-writes" + NOTIFY = "notify" + NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" + NOTIFY_CHANNELS = "notify-channels" NUMBER_FORMAT_LOOKUPS = "number-format-lookups" PCHAT = "pchat" PCHAT_ACTIONS = "pchat-actions" PCHAT_APS = "pchat-aps" PCHAT_NOTIFICATIONS = "pchat-notifications" PCHAT_READS = "pchat-reads" + PCHAT_USERS = "pchat-users" + PCHAT_MESSAGES = "pchat-messages" PFAX = "pfax" PFAX_MINUTES = "pfax-minutes" PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" @@ -305,6 +338,7 @@ class Category(object): SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" + SMS_MESSAGES_FEATURES = "sms-messages-features" TASKROUTER_TASKS = "taskrouter-tasks" TOTALPRICE = "totalprice" TRANSCRIPTIONS = "transcriptions" @@ -352,6 +386,7 @@ class Category(object): WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" + SYNC = "sync" def __init__(self, version, payload, account_sid): """ diff --git a/twilio/rest/api/v2010/account/usage/trigger.py b/twilio/rest/api/v2010/account/usage/trigger.py index aba7a5c581..ad025e56aa 100644 --- a/twilio/rest/api/v2010/account/usage/trigger.py +++ b/twilio/rest/api/v2010/account/usage/trigger.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -167,6 +168,27 @@ def page(self, recurring=values.unset, trigger_by=values.unset, return TriggerPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of TriggerInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of TriggerInstance + :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for TriggerInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return TriggerPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a TriggerContext @@ -411,6 +433,12 @@ class UsageCategory(object): MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" + MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" + MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" + MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" + MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" + MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" + MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" MEDIASTORAGE = "mediastorage" MMS = "mms" MMS_INBOUND = "mms-inbound" @@ -422,12 +450,17 @@ class UsageCategory(object): MONITOR_READS = "monitor-reads" MONITOR_STORAGE = "monitor-storage" MONITOR_WRITES = "monitor-writes" + NOTIFY = "notify" + NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" + NOTIFY_CHANNELS = "notify-channels" NUMBER_FORMAT_LOOKUPS = "number-format-lookups" PCHAT = "pchat" PCHAT_ACTIONS = "pchat-actions" PCHAT_APS = "pchat-aps" PCHAT_NOTIFICATIONS = "pchat-notifications" PCHAT_READS = "pchat-reads" + PCHAT_USERS = "pchat-users" + PCHAT_MESSAGES = "pchat-messages" PFAX = "pfax" PFAX_MINUTES = "pfax-minutes" PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" @@ -469,6 +502,7 @@ class UsageCategory(object): SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" + SMS_MESSAGES_FEATURES = "sms-messages-features" TASKROUTER_TASKS = "taskrouter-tasks" TOTALPRICE = "totalprice" TRANSCRIPTIONS = "transcriptions" @@ -516,6 +550,7 @@ class UsageCategory(object): WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" + SYNC = "sync" class Recurring(object): DAILY = "daily" diff --git a/twilio/rest/chat/v1/credential.py b/twilio/rest/chat/v1/credential.py index 94670bfdd3..add3b5bc53 100644 --- a/twilio/rest/chat/v1/credential.py +++ b/twilio/rest/chat/v1/credential.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -104,6 +105,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return CredentialPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of CredentialInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of CredentialInstance + :rtype: twilio.rest.chat.v1.credential.CredentialPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for CredentialInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return CredentialPage(self._version, response, self._solution) + def create(self, type, friendly_name=values.unset, certificate=values.unset, private_key=values.unset, sandbox=values.unset, api_key=values.unset, secret=values.unset): diff --git a/twilio/rest/chat/v1/service/__init__.py b/twilio/rest/chat/v1/service/__init__.py index e3db4ce0aa..0b50422023 100644 --- a/twilio/rest/chat/v1/service/__init__.py +++ b/twilio/rest/chat/v1/service/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -131,6 +132,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return ServicePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of ServiceInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of ServiceInstance + :rtype: twilio.rest.chat.v1.service.ServicePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for ServiceInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return ServicePage(self._version, response, self._solution) + def get(self, sid): """ Constructs a ServiceContext diff --git a/twilio/rest/chat/v1/service/channel/__init__.py b/twilio/rest/chat/v1/service/channel/__init__.py index e2e5cdc5e0..7b63ffa6e6 100644 --- a/twilio/rest/chat/v1/service/channel/__init__.py +++ b/twilio/rest/chat/v1/service/channel/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -148,6 +149,27 @@ def page(self, type=values.unset, page_token=values.unset, return ChannelPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of ChannelInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of ChannelInstance + :rtype: twilio.rest.chat.v1.service.channel.ChannelPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for ChannelInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return ChannelPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a ChannelContext diff --git a/twilio/rest/chat/v1/service/channel/invite.py b/twilio/rest/chat/v1/service/channel/invite.py index 44ac4c647d..8b5b76a99f 100644 --- a/twilio/rest/chat/v1/service/channel/invite.py +++ b/twilio/rest/chat/v1/service/channel/invite.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -143,6 +144,27 @@ def page(self, identity=values.unset, page_token=values.unset, return InvitePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of InviteInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of InviteInstance + :rtype: twilio.rest.chat.v1.service.channel.invite.InvitePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for InviteInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return InvitePage(self._version, response, self._solution) + def get(self, sid): """ Constructs a InviteContext diff --git a/twilio/rest/chat/v1/service/channel/member.py b/twilio/rest/chat/v1/service/channel/member.py index 43f88be461..73305c575a 100644 --- a/twilio/rest/chat/v1/service/channel/member.py +++ b/twilio/rest/chat/v1/service/channel/member.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -143,6 +144,27 @@ def page(self, identity=values.unset, page_token=values.unset, return MemberPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of MemberInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of MemberInstance + :rtype: twilio.rest.chat.v1.service.channel.member.MemberPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for MemberInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return MemberPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a MemberContext diff --git a/twilio/rest/chat/v1/service/channel/message.py b/twilio/rest/chat/v1/service/channel/message.py index a2b842359a..88c4940497 100644 --- a/twilio/rest/chat/v1/service/channel/message.py +++ b/twilio/rest/chat/v1/service/channel/message.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -145,6 +146,27 @@ def page(self, order=values.unset, page_token=values.unset, return MessagePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of MessageInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of MessageInstance + :rtype: twilio.rest.chat.v1.service.channel.message.MessagePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for MessageInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return MessagePage(self._version, response, self._solution) + def get(self, sid): """ Constructs a MessageContext diff --git a/twilio/rest/chat/v1/service/role.py b/twilio/rest/chat/v1/service/role.py index 9f971f4bdf..229cbef279 100644 --- a/twilio/rest/chat/v1/service/role.py +++ b/twilio/rest/chat/v1/service/role.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -136,6 +137,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return RolePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of RoleInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of RoleInstance + :rtype: twilio.rest.chat.v1.service.role.RolePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for RoleInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return RolePage(self._version, response, self._solution) + def get(self, sid): """ Constructs a RoleContext diff --git a/twilio/rest/chat/v1/service/user/__init__.py b/twilio/rest/chat/v1/service/user/__init__.py index d3bb96e679..8f19544d07 100644 --- a/twilio/rest/chat/v1/service/user/__init__.py +++ b/twilio/rest/chat/v1/service/user/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -140,6 +141,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return UserPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of UserInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of UserInstance + :rtype: twilio.rest.chat.v1.service.user.UserPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for UserInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return UserPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a UserContext diff --git a/twilio/rest/chat/v1/service/user/user_channel.py b/twilio/rest/chat/v1/service/user/user_channel.py index 4d6052de69..b829c99693 100644 --- a/twilio/rest/chat/v1/service/user/user_channel.py +++ b/twilio/rest/chat/v1/service/user/user_channel.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.page import Page @@ -108,6 +109,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return UserChannelPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of UserChannelInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of UserChannelInstance + :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for UserChannelInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return UserChannelPage(self._version, response, self._solution) + def __repr__(self): """ Provide a friendly representation diff --git a/twilio/rest/chat/v2/credential.py b/twilio/rest/chat/v2/credential.py index ae77875b05..33abf9686d 100644 --- a/twilio/rest/chat/v2/credential.py +++ b/twilio/rest/chat/v2/credential.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -104,6 +105,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return CredentialPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of CredentialInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of CredentialInstance + :rtype: twilio.rest.chat.v2.credential.CredentialPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for CredentialInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return CredentialPage(self._version, response, self._solution) + def create(self, type, friendly_name=values.unset, certificate=values.unset, private_key=values.unset, sandbox=values.unset, api_key=values.unset, secret=values.unset): diff --git a/twilio/rest/chat/v2/service/__init__.py b/twilio/rest/chat/v2/service/__init__.py index 97da3064af..890f6fdc95 100644 --- a/twilio/rest/chat/v2/service/__init__.py +++ b/twilio/rest/chat/v2/service/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -131,6 +132,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return ServicePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of ServiceInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of ServiceInstance + :rtype: twilio.rest.chat.v2.service.ServicePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for ServiceInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return ServicePage(self._version, response, self._solution) + def get(self, sid): """ Constructs a ServiceContext diff --git a/twilio/rest/chat/v2/service/channel/__init__.py b/twilio/rest/chat/v2/service/channel/__init__.py index e7e8ebc7f0..7d8226e344 100644 --- a/twilio/rest/chat/v2/service/channel/__init__.py +++ b/twilio/rest/chat/v2/service/channel/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -148,6 +149,27 @@ def page(self, type=values.unset, page_token=values.unset, return ChannelPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of ChannelInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of ChannelInstance + :rtype: twilio.rest.chat.v2.service.channel.ChannelPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for ChannelInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return ChannelPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a ChannelContext diff --git a/twilio/rest/chat/v2/service/channel/invite.py b/twilio/rest/chat/v2/service/channel/invite.py index 1b8737a080..9c17e01ffc 100644 --- a/twilio/rest/chat/v2/service/channel/invite.py +++ b/twilio/rest/chat/v2/service/channel/invite.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -143,6 +144,27 @@ def page(self, identity=values.unset, page_token=values.unset, return InvitePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of InviteInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of InviteInstance + :rtype: twilio.rest.chat.v2.service.channel.invite.InvitePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for InviteInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return InvitePage(self._version, response, self._solution) + def get(self, sid): """ Constructs a InviteContext diff --git a/twilio/rest/chat/v2/service/channel/member.py b/twilio/rest/chat/v2/service/channel/member.py index 7ca16967e7..fb69c3f9f0 100644 --- a/twilio/rest/chat/v2/service/channel/member.py +++ b/twilio/rest/chat/v2/service/channel/member.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -143,6 +144,27 @@ def page(self, identity=values.unset, page_token=values.unset, return MemberPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of MemberInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of MemberInstance + :rtype: twilio.rest.chat.v2.service.channel.member.MemberPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for MemberInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return MemberPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a MemberContext diff --git a/twilio/rest/chat/v2/service/channel/message.py b/twilio/rest/chat/v2/service/channel/message.py index f3328c0f7b..893df08f8d 100644 --- a/twilio/rest/chat/v2/service/channel/message.py +++ b/twilio/rest/chat/v2/service/channel/message.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -145,6 +146,27 @@ def page(self, order=values.unset, page_token=values.unset, return MessagePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of MessageInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of MessageInstance + :rtype: twilio.rest.chat.v2.service.channel.message.MessagePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for MessageInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return MessagePage(self._version, response, self._solution) + def get(self, sid): """ Constructs a MessageContext diff --git a/twilio/rest/chat/v2/service/role.py b/twilio/rest/chat/v2/service/role.py index ec2d6f7e7b..fbc30c0ee0 100644 --- a/twilio/rest/chat/v2/service/role.py +++ b/twilio/rest/chat/v2/service/role.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -136,6 +137,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return RolePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of RoleInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of RoleInstance + :rtype: twilio.rest.chat.v2.service.role.RolePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for RoleInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return RolePage(self._version, response, self._solution) + def get(self, sid): """ Constructs a RoleContext diff --git a/twilio/rest/chat/v2/service/user/__init__.py b/twilio/rest/chat/v2/service/user/__init__.py index 9a791687a6..1e067372fc 100644 --- a/twilio/rest/chat/v2/service/user/__init__.py +++ b/twilio/rest/chat/v2/service/user/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -140,6 +141,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return UserPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of UserInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of UserInstance + :rtype: twilio.rest.chat.v2.service.user.UserPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for UserInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return UserPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a UserContext diff --git a/twilio/rest/chat/v2/service/user/user_channel.py b/twilio/rest/chat/v2/service/user/user_channel.py index 13a2538d6c..3e687cf5fa 100644 --- a/twilio/rest/chat/v2/service/user/user_channel.py +++ b/twilio/rest/chat/v2/service/user/user_channel.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.page import Page @@ -108,6 +109,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return UserChannelPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of UserChannelInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of UserChannelInstance + :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for UserChannelInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return UserChannelPage(self._version, response, self._solution) + def __repr__(self): """ Provide a friendly representation diff --git a/twilio/rest/ip_messaging/v1/credential.py b/twilio/rest/ip_messaging/v1/credential.py index 1c16f992c0..b8147ac3fc 100644 --- a/twilio/rest/ip_messaging/v1/credential.py +++ b/twilio/rest/ip_messaging/v1/credential.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -104,6 +105,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return CredentialPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of CredentialInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of CredentialInstance + :rtype: twilio.rest.chat.v1.credential.CredentialPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for CredentialInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return CredentialPage(self._version, response, self._solution) + def create(self, type, friendly_name=values.unset, certificate=values.unset, private_key=values.unset, sandbox=values.unset, api_key=values.unset, secret=values.unset): diff --git a/twilio/rest/ip_messaging/v1/service/__init__.py b/twilio/rest/ip_messaging/v1/service/__init__.py index 5e52d5a015..8e9ff21b71 100644 --- a/twilio/rest/ip_messaging/v1/service/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -131,6 +132,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return ServicePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of ServiceInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of ServiceInstance + :rtype: twilio.rest.chat.v1.service.ServicePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for ServiceInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return ServicePage(self._version, response, self._solution) + def get(self, sid): """ Constructs a ServiceContext diff --git a/twilio/rest/ip_messaging/v1/service/channel/__init__.py b/twilio/rest/ip_messaging/v1/service/channel/__init__.py index 5f64485db6..9b1c50223a 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/channel/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -148,6 +149,27 @@ def page(self, type=values.unset, page_token=values.unset, return ChannelPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of ChannelInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of ChannelInstance + :rtype: twilio.rest.chat.v1.service.channel.ChannelPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for ChannelInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return ChannelPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a ChannelContext diff --git a/twilio/rest/ip_messaging/v1/service/channel/invite.py b/twilio/rest/ip_messaging/v1/service/channel/invite.py index 66af50aec4..4df82b5922 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/invite.py +++ b/twilio/rest/ip_messaging/v1/service/channel/invite.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -143,6 +144,27 @@ def page(self, identity=values.unset, page_token=values.unset, return InvitePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of InviteInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of InviteInstance + :rtype: twilio.rest.chat.v1.service.channel.invite.InvitePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for InviteInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return InvitePage(self._version, response, self._solution) + def get(self, sid): """ Constructs a InviteContext diff --git a/twilio/rest/ip_messaging/v1/service/channel/member.py b/twilio/rest/ip_messaging/v1/service/channel/member.py index 2e9be038a7..f02216534b 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/member.py +++ b/twilio/rest/ip_messaging/v1/service/channel/member.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -143,6 +144,27 @@ def page(self, identity=values.unset, page_token=values.unset, return MemberPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of MemberInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of MemberInstance + :rtype: twilio.rest.chat.v1.service.channel.member.MemberPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for MemberInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return MemberPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a MemberContext diff --git a/twilio/rest/ip_messaging/v1/service/channel/message.py b/twilio/rest/ip_messaging/v1/service/channel/message.py index 6d11061880..b35cac2814 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/message.py +++ b/twilio/rest/ip_messaging/v1/service/channel/message.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -145,6 +146,27 @@ def page(self, order=values.unset, page_token=values.unset, return MessagePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of MessageInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of MessageInstance + :rtype: twilio.rest.chat.v1.service.channel.message.MessagePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for MessageInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return MessagePage(self._version, response, self._solution) + def get(self, sid): """ Constructs a MessageContext diff --git a/twilio/rest/ip_messaging/v1/service/role.py b/twilio/rest/ip_messaging/v1/service/role.py index b55ba19fca..d615d30457 100644 --- a/twilio/rest/ip_messaging/v1/service/role.py +++ b/twilio/rest/ip_messaging/v1/service/role.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -136,6 +137,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return RolePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of RoleInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of RoleInstance + :rtype: twilio.rest.chat.v1.service.role.RolePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for RoleInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return RolePage(self._version, response, self._solution) + def get(self, sid): """ Constructs a RoleContext diff --git a/twilio/rest/ip_messaging/v1/service/user/__init__.py b/twilio/rest/ip_messaging/v1/service/user/__init__.py index 35756848c9..3b5bd516f8 100644 --- a/twilio/rest/ip_messaging/v1/service/user/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/user/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -140,6 +141,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return UserPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of UserInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of UserInstance + :rtype: twilio.rest.chat.v1.service.user.UserPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for UserInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return UserPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a UserContext diff --git a/twilio/rest/ip_messaging/v1/service/user/user_channel.py b/twilio/rest/ip_messaging/v1/service/user/user_channel.py index f1d7a2e651..4321fffa57 100644 --- a/twilio/rest/ip_messaging/v1/service/user/user_channel.py +++ b/twilio/rest/ip_messaging/v1/service/user/user_channel.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.page import Page @@ -108,6 +109,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return UserChannelPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of UserChannelInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of UserChannelInstance + :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for UserChannelInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return UserChannelPage(self._version, response, self._solution) + def __repr__(self): """ Provide a friendly representation diff --git a/twilio/rest/ip_messaging/v2/credential.py b/twilio/rest/ip_messaging/v2/credential.py index 4de2cbf25b..1632bdd234 100644 --- a/twilio/rest/ip_messaging/v2/credential.py +++ b/twilio/rest/ip_messaging/v2/credential.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -104,6 +105,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return CredentialPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of CredentialInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of CredentialInstance + :rtype: twilio.rest.chat.v2.credential.CredentialPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for CredentialInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return CredentialPage(self._version, response, self._solution) + def create(self, type, friendly_name=values.unset, certificate=values.unset, private_key=values.unset, sandbox=values.unset, api_key=values.unset, secret=values.unset): diff --git a/twilio/rest/ip_messaging/v2/service/__init__.py b/twilio/rest/ip_messaging/v2/service/__init__.py index 8b26281b11..7c2fa0c825 100644 --- a/twilio/rest/ip_messaging/v2/service/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -131,6 +132,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return ServicePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of ServiceInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of ServiceInstance + :rtype: twilio.rest.chat.v2.service.ServicePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for ServiceInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return ServicePage(self._version, response, self._solution) + def get(self, sid): """ Constructs a ServiceContext diff --git a/twilio/rest/ip_messaging/v2/service/channel/__init__.py b/twilio/rest/ip_messaging/v2/service/channel/__init__.py index c0a49aa066..a50346df99 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/channel/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -148,6 +149,27 @@ def page(self, type=values.unset, page_token=values.unset, return ChannelPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of ChannelInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of ChannelInstance + :rtype: twilio.rest.chat.v2.service.channel.ChannelPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for ChannelInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return ChannelPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a ChannelContext diff --git a/twilio/rest/ip_messaging/v2/service/channel/invite.py b/twilio/rest/ip_messaging/v2/service/channel/invite.py index 929f103bdc..aed3e071d1 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/invite.py +++ b/twilio/rest/ip_messaging/v2/service/channel/invite.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -143,6 +144,27 @@ def page(self, identity=values.unset, page_token=values.unset, return InvitePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of InviteInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of InviteInstance + :rtype: twilio.rest.chat.v2.service.channel.invite.InvitePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for InviteInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return InvitePage(self._version, response, self._solution) + def get(self, sid): """ Constructs a InviteContext diff --git a/twilio/rest/ip_messaging/v2/service/channel/member.py b/twilio/rest/ip_messaging/v2/service/channel/member.py index fe597d2988..6e2671c840 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/member.py +++ b/twilio/rest/ip_messaging/v2/service/channel/member.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -143,6 +144,27 @@ def page(self, identity=values.unset, page_token=values.unset, return MemberPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of MemberInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of MemberInstance + :rtype: twilio.rest.chat.v2.service.channel.member.MemberPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for MemberInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return MemberPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a MemberContext diff --git a/twilio/rest/ip_messaging/v2/service/channel/message.py b/twilio/rest/ip_messaging/v2/service/channel/message.py index 05cf89a5db..845d6f4f52 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/message.py +++ b/twilio/rest/ip_messaging/v2/service/channel/message.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -145,6 +146,27 @@ def page(self, order=values.unset, page_token=values.unset, return MessagePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of MessageInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of MessageInstance + :rtype: twilio.rest.chat.v2.service.channel.message.MessagePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for MessageInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return MessagePage(self._version, response, self._solution) + def get(self, sid): """ Constructs a MessageContext diff --git a/twilio/rest/ip_messaging/v2/service/role.py b/twilio/rest/ip_messaging/v2/service/role.py index a6a2af1e02..9a052da0b2 100644 --- a/twilio/rest/ip_messaging/v2/service/role.py +++ b/twilio/rest/ip_messaging/v2/service/role.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -136,6 +137,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return RolePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of RoleInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of RoleInstance + :rtype: twilio.rest.chat.v2.service.role.RolePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for RoleInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return RolePage(self._version, response, self._solution) + def get(self, sid): """ Constructs a RoleContext diff --git a/twilio/rest/ip_messaging/v2/service/user/__init__.py b/twilio/rest/ip_messaging/v2/service/user/__init__.py index 1d385a16af..e5d39929d6 100644 --- a/twilio/rest/ip_messaging/v2/service/user/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/user/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -140,6 +141,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return UserPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of UserInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of UserInstance + :rtype: twilio.rest.chat.v2.service.user.UserPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for UserInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return UserPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a UserContext diff --git a/twilio/rest/ip_messaging/v2/service/user/user_channel.py b/twilio/rest/ip_messaging/v2/service/user/user_channel.py index 39d52395d2..ec73a5f3de 100644 --- a/twilio/rest/ip_messaging/v2/service/user/user_channel.py +++ b/twilio/rest/ip_messaging/v2/service/user/user_channel.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.page import Page @@ -108,6 +109,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return UserChannelPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of UserChannelInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of UserChannelInstance + :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for UserChannelInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return UserChannelPage(self._version, response, self._solution) + def __repr__(self): """ Provide a friendly representation diff --git a/twilio/rest/monitor/v1/alert.py b/twilio/rest/monitor/v1/alert.py index 02edc75386..ac05976767 100644 --- a/twilio/rest/monitor/v1/alert.py +++ b/twilio/rest/monitor/v1/alert.py @@ -9,6 +9,7 @@ from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -126,6 +127,27 @@ def page(self, log_level=values.unset, start_date=values.unset, return AlertPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of AlertInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of AlertInstance + :rtype: twilio.rest.monitor.v1.alert.AlertPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for AlertInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return AlertPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a AlertContext diff --git a/twilio/rest/monitor/v1/event.py b/twilio/rest/monitor/v1/event.py index 5b8560867d..49c0ace374 100644 --- a/twilio/rest/monitor/v1/event.py +++ b/twilio/rest/monitor/v1/event.py @@ -9,6 +9,7 @@ from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -150,6 +151,27 @@ def page(self, actor_sid=values.unset, event_type=values.unset, return EventPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of EventInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of EventInstance + :rtype: twilio.rest.monitor.v1.event.EventPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for EventInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return EventPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a EventContext diff --git a/twilio/rest/pricing/v1/messaging/country.py b/twilio/rest/pricing/v1/messaging/country.py index aa476a2118..80be27d1f3 100644 --- a/twilio/rest/pricing/v1/messaging/country.py +++ b/twilio/rest/pricing/v1/messaging/country.py @@ -7,6 +7,7 @@ """ from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -103,6 +104,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return CountryPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of CountryInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of CountryInstance + :rtype: twilio.rest.pricing.v1.messaging.country.CountryPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for CountryInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return CountryPage(self._version, response, self._solution) + def get(self, iso_country): """ Constructs a CountryContext diff --git a/twilio/rest/pricing/v1/phone_number/country.py b/twilio/rest/pricing/v1/phone_number/country.py index 19ece9f0b5..af8fe27f83 100644 --- a/twilio/rest/pricing/v1/phone_number/country.py +++ b/twilio/rest/pricing/v1/phone_number/country.py @@ -7,6 +7,7 @@ """ from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -103,6 +104,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return CountryPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of CountryInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of CountryInstance + :rtype: twilio.rest.pricing.v1.phone_number.country.CountryPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for CountryInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return CountryPage(self._version, response, self._solution) + def get(self, iso_country): """ Constructs a CountryContext diff --git a/twilio/rest/pricing/v1/voice/country.py b/twilio/rest/pricing/v1/voice/country.py index dc4726b33f..052ceff49f 100644 --- a/twilio/rest/pricing/v1/voice/country.py +++ b/twilio/rest/pricing/v1/voice/country.py @@ -7,6 +7,7 @@ """ from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -103,6 +104,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return CountryPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of CountryInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of CountryInstance + :rtype: twilio.rest.pricing.v1.voice.country.CountryPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for CountryInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return CountryPage(self._version, response, self._solution) + def get(self, iso_country): """ Constructs a CountryContext diff --git a/twilio/rest/taskrouter/v1/workspace/__init__.py b/twilio/rest/taskrouter/v1/workspace/__init__.py index 8cde61e557..a6ed0cdeea 100644 --- a/twilio/rest/taskrouter/v1/workspace/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -118,6 +119,27 @@ def page(self, friendly_name=values.unset, page_token=values.unset, return WorkspacePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of WorkspaceInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of WorkspaceInstance + :rtype: twilio.rest.taskrouter.v1.workspace.WorkspacePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for WorkspaceInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return WorkspacePage(self._version, response, self._solution) + def create(self, friendly_name, event_callback_url=values.unset, events_filter=values.unset, multi_task_enabled=values.unset, template=values.unset, prioritize_queue_order=values.unset): diff --git a/twilio/rest/taskrouter/v1/workspace/activity.py b/twilio/rest/taskrouter/v1/workspace/activity.py index ce48b7d237..1d0892c6c1 100644 --- a/twilio/rest/taskrouter/v1/workspace/activity.py +++ b/twilio/rest/taskrouter/v1/workspace/activity.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -122,6 +123,27 @@ def page(self, friendly_name=values.unset, available=values.unset, return ActivityPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of ActivityInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of ActivityInstance + :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for ActivityInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return ActivityPage(self._version, response, self._solution) + def create(self, friendly_name, available=values.unset): """ Create a new ActivityInstance diff --git a/twilio/rest/taskrouter/v1/workspace/event.py b/twilio/rest/taskrouter/v1/workspace/event.py index 31842c5b8f..d7d1bdd892 100644 --- a/twilio/rest/taskrouter/v1/workspace/event.py +++ b/twilio/rest/taskrouter/v1/workspace/event.py @@ -9,6 +9,7 @@ from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -174,6 +175,27 @@ def page(self, end_date=values.unset, event_type=values.unset, return EventPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of EventInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of EventInstance + :rtype: twilio.rest.taskrouter.v1.workspace.event.EventPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for EventInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return EventPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a EventContext diff --git a/twilio/rest/taskrouter/v1/workspace/task/__init__.py b/twilio/rest/taskrouter/v1/workspace/task/__init__.py index 44b6e015e5..37dfa78c67 100644 --- a/twilio/rest/taskrouter/v1/workspace/task/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/task/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -174,6 +175,27 @@ def page(self, priority=values.unset, assignment_status=values.unset, return TaskPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of TaskInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of TaskInstance + :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for TaskInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return TaskPage(self._version, response, self._solution) + def create(self, timeout=values.unset, priority=values.unset, task_channel=values.unset, workflow_sid=values.unset, attributes=values.unset): diff --git a/twilio/rest/taskrouter/v1/workspace/task/reservation.py b/twilio/rest/taskrouter/v1/workspace/task/reservation.py index ceaafb1073..e485e0222f 100644 --- a/twilio/rest/taskrouter/v1/workspace/task/reservation.py +++ b/twilio/rest/taskrouter/v1/workspace/task/reservation.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -115,6 +116,27 @@ def page(self, reservation_status=values.unset, page_token=values.unset, return ReservationPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of ReservationInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of ReservationInstance + :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for ReservationInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return ReservationPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a ReservationContext diff --git a/twilio/rest/taskrouter/v1/workspace/task_channel.py b/twilio/rest/taskrouter/v1/workspace/task_channel.py index 617f57f1da..279cdd1438 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_channel.py +++ b/twilio/rest/taskrouter/v1/workspace/task_channel.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -107,6 +108,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return TaskChannelPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of TaskChannelInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of TaskChannelInstance + :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for TaskChannelInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return TaskChannelPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a TaskChannelContext diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py b/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py index 9eea52ea45..cc3be8faf8 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -133,6 +134,27 @@ def page(self, friendly_name=values.unset, return TaskQueuePage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of TaskQueueInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of TaskQueueInstance + :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueuePage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for TaskQueueInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return TaskQueuePage(self._version, response, self._solution) + def create(self, friendly_name, reservation_activity_sid, assignment_activity_sid, target_workers=values.unset, max_reserved_workers=values.unset, task_order=values.unset): diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py index 32cf1e0feb..d78f849495 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py @@ -8,6 +8,7 @@ from twilio.base import serialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.page import Page @@ -135,6 +136,27 @@ def page(self, end_date=values.unset, friendly_name=values.unset, return TaskQueuesStatisticsPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of TaskQueuesStatisticsInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of TaskQueuesStatisticsInstance + :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for TaskQueuesStatisticsInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return TaskQueuesStatisticsPage(self._version, response, self._solution) + def __repr__(self): """ Provide a friendly representation diff --git a/twilio/rest/taskrouter/v1/workspace/worker/__init__.py b/twilio/rest/taskrouter/v1/workspace/worker/__init__.py index 8b64a28ab5..2ede212e10 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -165,6 +166,27 @@ def page(self, activity_name=values.unset, activity_sid=values.unset, return WorkerPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of WorkerInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of WorkerInstance + :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for WorkerInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return WorkerPage(self._version, response, self._solution) + def create(self, friendly_name, activity_sid=values.unset, attributes=values.unset): """ diff --git a/twilio/rest/taskrouter/v1/workspace/worker/reservation.py b/twilio/rest/taskrouter/v1/workspace/worker/reservation.py index 8c4787b4dc..6f24b1b218 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/reservation.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/reservation.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -115,6 +116,27 @@ def page(self, reservation_status=values.unset, page_token=values.unset, return ReservationPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of ReservationInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of ReservationInstance + :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for ReservationInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return ReservationPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a ReservationContext diff --git a/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py b/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py index 1c4ddc0e75..a5ee340971 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -109,6 +110,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return WorkerChannelPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of WorkerChannelInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of WorkerChannelInstance + :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for WorkerChannelInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return WorkerChannelPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a WorkerChannelContext diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py b/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py index 913d90b476..0f2f37c54f 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -114,6 +115,27 @@ def page(self, friendly_name=values.unset, page_token=values.unset, return WorkflowPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of WorkflowInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of WorkflowInstance + :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for WorkflowInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return WorkflowPage(self._version, response, self._solution) + def create(self, friendly_name, configuration, assignment_callback_url=values.unset, fallback_assignment_callback_url=values.unset, diff --git a/twilio/rest/trunking/v1/trunk/__init__.py b/twilio/rest/trunking/v1/trunk/__init__.py index bea1201b3f..8b4bab97cf 100644 --- a/twilio/rest/trunking/v1/trunk/__init__.py +++ b/twilio/rest/trunking/v1/trunk/__init__.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -145,6 +146,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return TrunkPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of TrunkInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of TrunkInstance + :rtype: twilio.rest.trunking.v1.trunk.TrunkPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for TrunkInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return TrunkPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a TrunkContext diff --git a/twilio/rest/trunking/v1/trunk/credential_list.py b/twilio/rest/trunking/v1/trunk/credential_list.py index 357c863fd8..60d8d07fe2 100644 --- a/twilio/rest/trunking/v1/trunk/credential_list.py +++ b/twilio/rest/trunking/v1/trunk/credential_list.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -132,6 +133,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return CredentialListPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of CredentialListInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of CredentialListInstance + :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for CredentialListInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return CredentialListPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a CredentialListContext diff --git a/twilio/rest/trunking/v1/trunk/ip_access_control_list.py b/twilio/rest/trunking/v1/trunk/ip_access_control_list.py index e611cfc553..c842bf2944 100644 --- a/twilio/rest/trunking/v1/trunk/ip_access_control_list.py +++ b/twilio/rest/trunking/v1/trunk/ip_access_control_list.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -132,6 +133,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return IpAccessControlListPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of IpAccessControlListInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of IpAccessControlListInstance + :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for IpAccessControlListInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return IpAccessControlListPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a IpAccessControlListContext diff --git a/twilio/rest/trunking/v1/trunk/origination_url.py b/twilio/rest/trunking/v1/trunk/origination_url.py index a2b9238f9f..ba5df27510 100644 --- a/twilio/rest/trunking/v1/trunk/origination_url.py +++ b/twilio/rest/trunking/v1/trunk/origination_url.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -140,6 +141,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return OriginationUrlPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of OriginationUrlInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of OriginationUrlInstance + :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for OriginationUrlInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return OriginationUrlPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a OriginationUrlContext diff --git a/twilio/rest/trunking/v1/trunk/phone_number.py b/twilio/rest/trunking/v1/trunk/phone_number.py index f94e4aea85..ac041e2cde 100644 --- a/twilio/rest/trunking/v1/trunk/phone_number.py +++ b/twilio/rest/trunking/v1/trunk/phone_number.py @@ -8,6 +8,7 @@ from twilio.base import deserialize from twilio.base import values +from twilio.base.exceptions import TwilioException from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -132,6 +133,27 @@ def page(self, page_token=values.unset, page_number=values.unset, return PhoneNumberPage(self._version, response, self._solution) + def get_page(self, target_url): + """ + Retrieve a specific page of PhoneNumberInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of PhoneNumberInstance + :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for PhoneNumberInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return PhoneNumberPage(self._version, response, self._solution) + def get(self, sid): """ Constructs a PhoneNumberContext diff --git a/twilio/rest/video/__init__.py b/twilio/rest/video/__init__.py new file mode 100644 index 0000000000..1c1ae09f13 --- /dev/null +++ b/twilio/rest/video/__init__.py @@ -0,0 +1,60 @@ +# coding=utf-8 +""" +This code was generated by +\ / _ _ _| _ _ + | (_)\/(_)(_|\/| |(/_ v1.0.0 + / / +""" + +from twilio.base.domain import Domain +from twilio.rest.video.v1 import V1 + + +class Video(Domain): + + def __init__(self, twilio): + """ + Initialize the Video Domain + + :returns: Domain for Video + :rtype: twilio.rest.video.Video + """ + super(Video, self).__init__(twilio) + + self.base_url = 'https://video.twilio.com' + + # Versions + self._v1 = None + + @property + def v1(self): + """ + :returns: Version v1 of video + :rtype: twilio.rest.video.v1.V1 + """ + if self._v1 is None: + self._v1 = V1(self) + return self._v1 + + @property + def recordings(self): + """ + :rtype: twilio.rest.video.v1.recording.RecordingList + """ + return self.v1.recordings + + @property + def rooms(self): + """ + :rtype: twilio.rest.video.v1.room.RoomList + """ + return self.v1.rooms + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + return '' diff --git a/twilio/rest/video/v1/__init__.py b/twilio/rest/video/v1/__init__.py new file mode 100644 index 0000000000..9560bde353 --- /dev/null +++ b/twilio/rest/video/v1/__init__.py @@ -0,0 +1,53 @@ +# coding=utf-8 +""" +This code was generated by +\ / _ _ _| _ _ + | (_)\/(_)(_|\/| |(/_ v1.0.0 + / / +""" + +from twilio.base.version import Version +from twilio.rest.video.v1.recording import RecordingList +from twilio.rest.video.v1.room import RoomList + + +class V1(Version): + + def __init__(self, domain): + """ + Initialize the V1 version of Video + + :returns: V1 version of Video + :rtype: twilio.rest.video.v1.V1.V1 + """ + super(V1, self).__init__(domain) + self.version = 'v1' + self._recordings = None + self._rooms = None + + @property + def recordings(self): + """ + :rtype: twilio.rest.video.v1.recording.RecordingList + """ + if self._recordings is None: + self._recordings = RecordingList(self) + return self._recordings + + @property + def rooms(self): + """ + :rtype: twilio.rest.video.v1.room.RoomList + """ + if self._rooms is None: + self._rooms = RoomList(self) + return self._rooms + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + return '' diff --git a/twilio/rest/video/v1/recording/__init__.py b/twilio/rest/video/v1/recording/__init__.py new file mode 100644 index 0000000000..014efa4bb6 --- /dev/null +++ b/twilio/rest/video/v1/recording/__init__.py @@ -0,0 +1,491 @@ +# coding=utf-8 +""" +This code was generated by +\ / _ _ _| _ _ + | (_)\/(_)(_|\/| |(/_ v1.0.0 + / / +""" + +from twilio.base import deserialize +from twilio.base import values +from twilio.base.exceptions import TwilioException +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.page import Page + + +class RecordingList(ListResource): + + def __init__(self, version): + """ + Initialize the RecordingList + + :param Version version: Version that contains the resource + + :returns: twilio.rest.video.v1.recording.RecordingList + :rtype: twilio.rest.video.v1.recording.RecordingList + """ + super(RecordingList, self).__init__(version) + + # Path Solution + self._solution = {} + self._uri = '/Recordings'.format(**self._solution) + + def stream(self, status=values.unset, source_sid=values.unset, + grouping_sid=values.unset, limit=None, page_size=None): + """ + Streams RecordingInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param RecordingInstance.Status status: The status + :param unicode source_sid: The source_sid + :param unicode grouping_sid: The grouping_sid + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + :rtype: list[twilio.rest.video.v1.recording.RecordingInstance] + """ + limits = self._version.read_limits(limit, page_size) + + page = self.page( + status=status, + source_sid=source_sid, + grouping_sid=grouping_sid, + page_size=limits['page_size'], + ) + + return self._version.stream(page, limits['limit'], limits['page_limit']) + + def list(self, status=values.unset, source_sid=values.unset, + grouping_sid=values.unset, limit=None, page_size=None): + """ + Lists RecordingInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param RecordingInstance.Status status: The status + :param unicode source_sid: The source_sid + :param unicode grouping_sid: The grouping_sid + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + :rtype: list[twilio.rest.video.v1.recording.RecordingInstance] + """ + return list(self.stream( + status=status, + source_sid=source_sid, + grouping_sid=grouping_sid, + limit=limit, + page_size=page_size, + )) + + def page(self, status=values.unset, source_sid=values.unset, + grouping_sid=values.unset, page_token=values.unset, + page_number=values.unset, page_size=values.unset): + """ + Retrieve a single page of RecordingInstance records from the API. + Request is executed immediately + + :param RecordingInstance.Status status: The status + :param unicode source_sid: The source_sid + :param unicode grouping_sid: The grouping_sid + :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 + + :returns: Page of RecordingInstance + :rtype: twilio.rest.video.v1.recording.RecordingPage + """ + params = values.of({ + 'Status': status, + 'SourceSid': source_sid, + 'GroupingSid': grouping_sid, + 'PageToken': page_token, + 'Page': page_number, + 'PageSize': page_size, + }) + + response = self._version.page( + 'GET', + self._uri, + params=params, + ) + + return RecordingPage(self._version, response, self._solution) + + def get_page(self, target_url): + """ + Retrieve a specific page of RecordingInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of RecordingInstance + :rtype: twilio.rest.video.v1.recording.RecordingPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for RecordingInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return RecordingPage(self._version, response, self._solution) + + def get(self, sid): + """ + Constructs a RecordingContext + + :param sid: The sid + + :returns: twilio.rest.video.v1.recording.RecordingContext + :rtype: twilio.rest.video.v1.recording.RecordingContext + """ + return RecordingContext( + self._version, + sid=sid, + ) + + def __call__(self, sid): + """ + Constructs a RecordingContext + + :param sid: The sid + + :returns: twilio.rest.video.v1.recording.RecordingContext + :rtype: twilio.rest.video.v1.recording.RecordingContext + """ + return RecordingContext( + self._version, + sid=sid, + ) + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + return '' + + +class RecordingPage(Page): + + def __init__(self, version, response, solution): + """ + Initialize the RecordingPage + + :param Version version: Version that contains the resource + :param Response response: Response from the API + + :returns: twilio.rest.video.v1.recording.RecordingPage + :rtype: twilio.rest.video.v1.recording.RecordingPage + """ + super(RecordingPage, self).__init__(version, response) + + # Path Solution + self._solution = solution + + def get_instance(self, payload): + """ + Build an instance of RecordingInstance + + :param dict payload: Payload response from the API + + :returns: twilio.rest.video.v1.recording.RecordingInstance + :rtype: twilio.rest.video.v1.recording.RecordingInstance + """ + return RecordingInstance( + self._version, + payload, + ) + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + return '' + + +class RecordingContext(InstanceContext): + + def __init__(self, version, sid): + """ + Initialize the RecordingContext + + :param Version version: Version that contains the resource + :param sid: The sid + + :returns: twilio.rest.video.v1.recording.RecordingContext + :rtype: twilio.rest.video.v1.recording.RecordingContext + """ + super(RecordingContext, self).__init__(version) + + # Path Solution + self._solution = { + 'sid': sid, + } + self._uri = '/Recordings/{sid}'.format(**self._solution) + + def fetch(self): + """ + Fetch a RecordingInstance + + :returns: Fetched RecordingInstance + :rtype: twilio.rest.video.v1.recording.RecordingInstance + """ + params = values.of({}) + + payload = self._version.fetch( + 'GET', + self._uri, + params=params, + ) + + return RecordingInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + def delete(self): + """ + Deletes the RecordingInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete('delete', self._uri) + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + +class RecordingInstance(InstanceResource): + + class Status(object): + PROCESSING = "processing" + COMPLETED = "completed" + DELETED = "deleted" + FAILED = "failed" + + class Type(object): + AUDIO = "audio" + VIDEO = "video" + DATA = "data" + + class Format(object): + MKA = "mka" + MKV = "mkv" + + class Codec(object): + VP8 = "VP8" + H264 = "H264" + OPUS = "OPUS" + PCMU = "PCMU" + + def __init__(self, version, payload, sid=None): + """ + Initialize the RecordingInstance + + :returns: twilio.rest.video.v1.recording.RecordingInstance + :rtype: twilio.rest.video.v1.recording.RecordingInstance + """ + super(RecordingInstance, self).__init__(version) + + # Marshaled Properties + self._properties = { + 'account_sid': payload['account_sid'], + 'status': payload['status'], + 'date_created': deserialize.iso8601_datetime(payload['date_created']), + 'sid': payload['sid'], + 'source_sid': payload['source_sid'], + 'size': deserialize.integer(payload['size']), + 'url': payload['url'], + 'type': payload['type'], + 'duration': deserialize.integer(payload['duration']), + 'container_format': payload['container_format'], + 'codec': payload['codec'], + 'grouping_sids': payload['grouping_sids'], + 'links': payload['links'], + } + + # Context + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'], + } + + @property + def _proxy(self): + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: RecordingContext for this RecordingInstance + :rtype: twilio.rest.video.v1.recording.RecordingContext + """ + if self._context is None: + self._context = RecordingContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def account_sid(self): + """ + :returns: The account_sid + :rtype: unicode + """ + return self._properties['account_sid'] + + @property + def status(self): + """ + :returns: The status + :rtype: RecordingInstance.Status + """ + return self._properties['status'] + + @property + def date_created(self): + """ + :returns: The date_created + :rtype: datetime + """ + return self._properties['date_created'] + + @property + def sid(self): + """ + :returns: The sid + :rtype: unicode + """ + return self._properties['sid'] + + @property + def source_sid(self): + """ + :returns: The source_sid + :rtype: unicode + """ + return self._properties['source_sid'] + + @property + def size(self): + """ + :returns: The size + :rtype: unicode + """ + return self._properties['size'] + + @property + def url(self): + """ + :returns: The url + :rtype: unicode + """ + return self._properties['url'] + + @property + def type(self): + """ + :returns: The type + :rtype: RecordingInstance.Type + """ + return self._properties['type'] + + @property + def duration(self): + """ + :returns: The duration + :rtype: unicode + """ + return self._properties['duration'] + + @property + def container_format(self): + """ + :returns: The container_format + :rtype: RecordingInstance.Format + """ + return self._properties['container_format'] + + @property + def codec(self): + """ + :returns: The codec + :rtype: RecordingInstance.Codec + """ + return self._properties['codec'] + + @property + def grouping_sids(self): + """ + :returns: The grouping_sids + :rtype: dict + """ + return self._properties['grouping_sids'] + + @property + def links(self): + """ + :returns: The links + :rtype: unicode + """ + return self._properties['links'] + + def fetch(self): + """ + Fetch a RecordingInstance + + :returns: Fetched RecordingInstance + :rtype: twilio.rest.video.v1.recording.RecordingInstance + """ + return self._proxy.fetch() + + def delete(self): + """ + Deletes the RecordingInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._proxy.delete() + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) diff --git a/twilio/rest/video/v1/room/__init__.py b/twilio/rest/video/v1/room/__init__.py new file mode 100644 index 0000000000..bd2ed254cf --- /dev/null +++ b/twilio/rest/video/v1/room/__init__.py @@ -0,0 +1,604 @@ +# coding=utf-8 +""" +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.exceptions import TwilioException +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.page import Page +from twilio.rest.video.v1.room.recording import RecordingList + + +class RoomList(ListResource): + + def __init__(self, version): + """ + Initialize the RoomList + + :param Version version: Version that contains the resource + + :returns: twilio.rest.video.v1.room.RoomList + :rtype: twilio.rest.video.v1.room.RoomList + """ + super(RoomList, self).__init__(version) + + # Path Solution + self._solution = {} + self._uri = '/Rooms'.format(**self._solution) + + def create(self, enable_turn=values.unset, type=values.unset, + unique_name=values.unset, status_callback=values.unset, + status_callback_method=values.unset, max_participants=values.unset, + record_participants_on_connect=values.unset): + """ + Create a new RoomInstance + + :param bool enable_turn: The enable_turn + :param RoomInstance.RoomType type: The type + :param unicode unique_name: The unique_name + :param unicode status_callback: The status_callback + :param unicode status_callback_method: The status_callback_method + :param unicode max_participants: The max_participants + :param bool record_participants_on_connect: The record_participants_on_connect + + :returns: Newly created RoomInstance + :rtype: twilio.rest.video.v1.room.RoomInstance + """ + data = values.of({ + 'EnableTurn': enable_turn, + 'Type': type, + 'UniqueName': unique_name, + 'StatusCallback': status_callback, + 'StatusCallbackMethod': status_callback_method, + 'MaxParticipants': max_participants, + 'RecordParticipantsOnConnect': record_participants_on_connect, + }) + + payload = self._version.create( + 'POST', + self._uri, + data=data, + ) + + return RoomInstance( + self._version, + payload, + ) + + def stream(self, status=values.unset, unique_name=values.unset, + date_created_after=values.unset, date_created_before=values.unset, + limit=None, page_size=None): + """ + Streams RoomInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param RoomInstance.RoomStatus status: The status + :param unicode unique_name: The unique_name + :param datetime date_created_after: The date_created_after + :param datetime date_created_before: The date_created_before + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + :rtype: list[twilio.rest.video.v1.room.RoomInstance] + """ + limits = self._version.read_limits(limit, page_size) + + page = self.page( + status=status, + unique_name=unique_name, + date_created_after=date_created_after, + date_created_before=date_created_before, + page_size=limits['page_size'], + ) + + return self._version.stream(page, limits['limit'], limits['page_limit']) + + def list(self, status=values.unset, unique_name=values.unset, + date_created_after=values.unset, date_created_before=values.unset, + limit=None, page_size=None): + """ + Lists RoomInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param RoomInstance.RoomStatus status: The status + :param unicode unique_name: The unique_name + :param datetime date_created_after: The date_created_after + :param datetime date_created_before: The date_created_before + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + :rtype: list[twilio.rest.video.v1.room.RoomInstance] + """ + return list(self.stream( + status=status, + unique_name=unique_name, + date_created_after=date_created_after, + date_created_before=date_created_before, + limit=limit, + page_size=page_size, + )) + + def page(self, status=values.unset, unique_name=values.unset, + date_created_after=values.unset, date_created_before=values.unset, + page_token=values.unset, page_number=values.unset, + page_size=values.unset): + """ + Retrieve a single page of RoomInstance records from the API. + Request is executed immediately + + :param RoomInstance.RoomStatus status: The status + :param unicode unique_name: The unique_name + :param datetime date_created_after: The date_created_after + :param datetime date_created_before: The date_created_before + :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 + + :returns: Page of RoomInstance + :rtype: twilio.rest.video.v1.room.RoomPage + """ + params = values.of({ + 'Status': status, + 'UniqueName': unique_name, + 'DateCreatedAfter': serialize.iso8601_datetime(date_created_after), + 'DateCreatedBefore': serialize.iso8601_datetime(date_created_before), + 'PageToken': page_token, + 'Page': page_number, + 'PageSize': page_size, + }) + + response = self._version.page( + 'GET', + self._uri, + params=params, + ) + + return RoomPage(self._version, response, self._solution) + + def get_page(self, target_url): + """ + Retrieve a specific page of RoomInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of RoomInstance + :rtype: twilio.rest.video.v1.room.RoomPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for RoomInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return RoomPage(self._version, response, self._solution) + + def get(self, sid): + """ + Constructs a RoomContext + + :param sid: The sid + + :returns: twilio.rest.video.v1.room.RoomContext + :rtype: twilio.rest.video.v1.room.RoomContext + """ + return RoomContext( + self._version, + sid=sid, + ) + + def __call__(self, sid): + """ + Constructs a RoomContext + + :param sid: The sid + + :returns: twilio.rest.video.v1.room.RoomContext + :rtype: twilio.rest.video.v1.room.RoomContext + """ + return RoomContext( + self._version, + sid=sid, + ) + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + return '' + + +class RoomPage(Page): + + def __init__(self, version, response, solution): + """ + Initialize the RoomPage + + :param Version version: Version that contains the resource + :param Response response: Response from the API + + :returns: twilio.rest.video.v1.room.RoomPage + :rtype: twilio.rest.video.v1.room.RoomPage + """ + super(RoomPage, self).__init__(version, response) + + # Path Solution + self._solution = solution + + def get_instance(self, payload): + """ + Build an instance of RoomInstance + + :param dict payload: Payload response from the API + + :returns: twilio.rest.video.v1.room.RoomInstance + :rtype: twilio.rest.video.v1.room.RoomInstance + """ + return RoomInstance( + self._version, + payload, + ) + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + return '' + + +class RoomContext(InstanceContext): + + def __init__(self, version, sid): + """ + Initialize the RoomContext + + :param Version version: Version that contains the resource + :param sid: The sid + + :returns: twilio.rest.video.v1.room.RoomContext + :rtype: twilio.rest.video.v1.room.RoomContext + """ + super(RoomContext, self).__init__(version) + + # Path Solution + self._solution = { + 'sid': sid, + } + self._uri = '/Rooms/{sid}'.format(**self._solution) + + # Dependents + self._recordings = None + + def fetch(self): + """ + Fetch a RoomInstance + + :returns: Fetched RoomInstance + :rtype: twilio.rest.video.v1.room.RoomInstance + """ + params = values.of({}) + + payload = self._version.fetch( + 'GET', + self._uri, + params=params, + ) + + return RoomInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + def update(self, status): + """ + Update the RoomInstance + + :param RoomInstance.RoomStatus status: The status + + :returns: Updated RoomInstance + :rtype: twilio.rest.video.v1.room.RoomInstance + """ + data = values.of({ + 'Status': status, + }) + + payload = self._version.update( + 'POST', + self._uri, + data=data, + ) + + return RoomInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + @property + def recordings(self): + """ + Access the recordings + + :returns: twilio.rest.video.v1.room.recording.RecordingList + :rtype: twilio.rest.video.v1.room.recording.RecordingList + """ + if self._recordings is None: + self._recordings = RecordingList( + self._version, + room_sid=self._solution['sid'], + ) + return self._recordings + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + +class RoomInstance(InstanceResource): + + class RoomStatus(object): + IN_PROGRESS = "in-progress" + COMPLETED = "completed" + FAILED = "failed" + + class RoomType(object): + PEER_TO_PEER = "peer-to-peer" + GROUP = "group" + + def __init__(self, version, payload, sid=None): + """ + Initialize the RoomInstance + + :returns: twilio.rest.video.v1.room.RoomInstance + :rtype: twilio.rest.video.v1.room.RoomInstance + """ + super(RoomInstance, self).__init__(version) + + # Marshaled Properties + self._properties = { + 'sid': payload['sid'], + 'status': payload['status'], + 'date_created': deserialize.iso8601_datetime(payload['date_created']), + 'date_updated': deserialize.iso8601_datetime(payload['date_updated']), + 'account_sid': payload['account_sid'], + 'enable_turn': payload['enable_turn'], + 'unique_name': payload['unique_name'], + 'status_callback': payload['status_callback'], + 'status_callback_method': payload['status_callback_method'], + 'end_time': deserialize.iso8601_datetime(payload['end_time']), + 'duration': deserialize.integer(payload['duration']), + 'type': payload['type'], + 'max_participants': deserialize.integer(payload['max_participants']), + 'record_participants_on_connect': payload['record_participants_on_connect'], + 'url': payload['url'], + 'links': payload['links'], + } + + # Context + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'], + } + + @property + def _proxy(self): + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: RoomContext for this RoomInstance + :rtype: twilio.rest.video.v1.room.RoomContext + """ + if self._context is None: + self._context = RoomContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def sid(self): + """ + :returns: The sid + :rtype: unicode + """ + return self._properties['sid'] + + @property + def status(self): + """ + :returns: The status + :rtype: RoomInstance.RoomStatus + """ + return self._properties['status'] + + @property + def date_created(self): + """ + :returns: The date_created + :rtype: datetime + """ + return self._properties['date_created'] + + @property + def date_updated(self): + """ + :returns: The date_updated + :rtype: datetime + """ + return self._properties['date_updated'] + + @property + def account_sid(self): + """ + :returns: The account_sid + :rtype: unicode + """ + return self._properties['account_sid'] + + @property + def enable_turn(self): + """ + :returns: The enable_turn + :rtype: bool + """ + return self._properties['enable_turn'] + + @property + def unique_name(self): + """ + :returns: The unique_name + :rtype: unicode + """ + return self._properties['unique_name'] + + @property + def status_callback(self): + """ + :returns: The status_callback + :rtype: unicode + """ + return self._properties['status_callback'] + + @property + def status_callback_method(self): + """ + :returns: The status_callback_method + :rtype: unicode + """ + return self._properties['status_callback_method'] + + @property + def end_time(self): + """ + :returns: The end_time + :rtype: datetime + """ + return self._properties['end_time'] + + @property + def duration(self): + """ + :returns: The duration + :rtype: unicode + """ + return self._properties['duration'] + + @property + def type(self): + """ + :returns: The type + :rtype: RoomInstance.RoomType + """ + return self._properties['type'] + + @property + def max_participants(self): + """ + :returns: The max_participants + :rtype: unicode + """ + return self._properties['max_participants'] + + @property + def record_participants_on_connect(self): + """ + :returns: The record_participants_on_connect + :rtype: bool + """ + return self._properties['record_participants_on_connect'] + + @property + def url(self): + """ + :returns: The url + :rtype: unicode + """ + return self._properties['url'] + + @property + def links(self): + """ + :returns: The links + :rtype: unicode + """ + return self._properties['links'] + + def fetch(self): + """ + Fetch a RoomInstance + + :returns: Fetched RoomInstance + :rtype: twilio.rest.video.v1.room.RoomInstance + """ + return self._proxy.fetch() + + def update(self, status): + """ + Update the RoomInstance + + :param RoomInstance.RoomStatus status: The status + + :returns: Updated RoomInstance + :rtype: twilio.rest.video.v1.room.RoomInstance + """ + return self._proxy.update( + status, + ) + + @property + def recordings(self): + """ + Access the recordings + + :returns: twilio.rest.video.v1.room.recording.RecordingList + :rtype: twilio.rest.video.v1.room.recording.RecordingList + """ + return self._proxy.recordings + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) diff --git a/twilio/rest/video/v1/room/recording/__init__.py b/twilio/rest/video/v1/room/recording/__init__.py new file mode 100644 index 0000000000..c6411656d2 --- /dev/null +++ b/twilio/rest/video/v1/room/recording/__init__.py @@ -0,0 +1,473 @@ +# coding=utf-8 +""" +This code was generated by +\ / _ _ _| _ _ + | (_)\/(_)(_|\/| |(/_ v1.0.0 + / / +""" + +from twilio.base import deserialize +from twilio.base import values +from twilio.base.exceptions import TwilioException +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.page import Page + + +class RecordingList(ListResource): + + def __init__(self, version, room_sid): + """ + Initialize the RecordingList + + :param Version version: Version that contains the resource + :param room_sid: The room_sid + + :returns: twilio.rest.video.v1.room.recording.RecordingList + :rtype: twilio.rest.video.v1.room.recording.RecordingList + """ + super(RecordingList, self).__init__(version) + + # Path Solution + self._solution = { + 'room_sid': room_sid, + } + self._uri = '/Rooms/{room_sid}/Recordings'.format(**self._solution) + + def stream(self, limit=None, page_size=None): + """ + Streams RecordingInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param 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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + :rtype: list[twilio.rest.video.v1.room.recording.RecordingInstance] + """ + limits = self._version.read_limits(limit, page_size) + + page = self.page( + page_size=limits['page_size'], + ) + + return self._version.stream(page, limits['limit'], limits['page_limit']) + + def list(self, limit=None, page_size=None): + """ + Lists RecordingInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param 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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + :rtype: list[twilio.rest.video.v1.room.recording.RecordingInstance] + """ + return list(self.stream( + limit=limit, + page_size=page_size, + )) + + def page(self, page_token=values.unset, page_number=values.unset, + page_size=values.unset): + """ + Retrieve a single page of RecordingInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of RecordingInstance + :rtype: twilio.rest.video.v1.room.recording.RecordingPage + """ + params = values.of({ + 'PageToken': page_token, + 'Page': page_number, + 'PageSize': page_size, + }) + + response = self._version.page( + 'GET', + self._uri, + params=params, + ) + + return RecordingPage(self._version, response, self._solution) + + def get_page(self, target_url): + """ + Retrieve a specific page of RecordingInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of RecordingInstance + :rtype: twilio.rest.video.v1.room.recording.RecordingPage + """ + resource_url = self._version.absolute_url(self._uri) + if not target_url.startswith(resource_url): + raise TwilioException('Invalid target_url for RecordingInstance resource.') + + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return RecordingPage(self._version, response, self._solution) + + def get(self, sid): + """ + Constructs a RecordingContext + + :param sid: The sid + + :returns: twilio.rest.video.v1.room.recording.RecordingContext + :rtype: twilio.rest.video.v1.room.recording.RecordingContext + """ + return RecordingContext( + self._version, + room_sid=self._solution['room_sid'], + sid=sid, + ) + + def __call__(self, sid): + """ + Constructs a RecordingContext + + :param sid: The sid + + :returns: twilio.rest.video.v1.room.recording.RecordingContext + :rtype: twilio.rest.video.v1.room.recording.RecordingContext + """ + return RecordingContext( + self._version, + room_sid=self._solution['room_sid'], + sid=sid, + ) + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + return '' + + +class RecordingPage(Page): + + def __init__(self, version, response, solution): + """ + Initialize the RecordingPage + + :param Version version: Version that contains the resource + :param Response response: Response from the API + :param room_sid: The room_sid + + :returns: twilio.rest.video.v1.room.recording.RecordingPage + :rtype: twilio.rest.video.v1.room.recording.RecordingPage + """ + super(RecordingPage, self).__init__(version, response) + + # Path Solution + self._solution = solution + + def get_instance(self, payload): + """ + Build an instance of RecordingInstance + + :param dict payload: Payload response from the API + + :returns: twilio.rest.video.v1.room.recording.RecordingInstance + :rtype: twilio.rest.video.v1.room.recording.RecordingInstance + """ + return RecordingInstance( + self._version, + payload, + room_sid=self._solution['room_sid'], + ) + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + return '' + + +class RecordingContext(InstanceContext): + + def __init__(self, version, room_sid, sid): + """ + Initialize the RecordingContext + + :param Version version: Version that contains the resource + :param room_sid: The room_sid + :param sid: The sid + + :returns: twilio.rest.video.v1.room.recording.RecordingContext + :rtype: twilio.rest.video.v1.room.recording.RecordingContext + """ + super(RecordingContext, self).__init__(version) + + # Path Solution + self._solution = { + 'room_sid': room_sid, + 'sid': sid, + } + self._uri = '/Rooms/{room_sid}/Recordings/{sid}'.format(**self._solution) + + def fetch(self): + """ + Fetch a RecordingInstance + + :returns: Fetched RecordingInstance + :rtype: twilio.rest.video.v1.room.recording.RecordingInstance + """ + params = values.of({}) + + payload = self._version.fetch( + 'GET', + self._uri, + params=params, + ) + + return RecordingInstance( + self._version, + payload, + room_sid=self._solution['room_sid'], + sid=self._solution['sid'], + ) + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + +class RecordingInstance(InstanceResource): + + class Status(object): + PROCESSING = "processing" + COMPLETED = "completed" + DELETED = "deleted" + FAILED = "failed" + + class Type(object): + AUDIO = "audio" + VIDEO = "video" + DATA = "data" + + class Format(object): + MKA = "mka" + MKV = "mkv" + + class Codec(object): + VP8 = "VP8" + H264 = "H264" + OPUS = "OPUS" + PCMU = "PCMU" + + def __init__(self, version, payload, room_sid, sid=None): + """ + Initialize the RecordingInstance + + :returns: twilio.rest.video.v1.room.recording.RecordingInstance + :rtype: twilio.rest.video.v1.room.recording.RecordingInstance + """ + super(RecordingInstance, self).__init__(version) + + # Marshaled Properties + self._properties = { + 'account_sid': payload['account_sid'], + 'status': payload['status'], + 'date_created': deserialize.iso8601_datetime(payload['date_created']), + 'sid': payload['sid'], + 'source_sid': payload['source_sid'], + 'size': deserialize.integer(payload['size']), + 'type': payload['type'], + 'duration': deserialize.integer(payload['duration']), + 'container_format': payload['container_format'], + 'codec': payload['codec'], + 'grouping_sids': payload['grouping_sids'], + 'room_sid': payload['room_sid'], + 'url': payload['url'], + 'links': payload['links'], + } + + # Context + self._context = None + self._solution = { + 'room_sid': room_sid, + 'sid': sid or self._properties['sid'], + } + + @property + def _proxy(self): + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: RecordingContext for this RecordingInstance + :rtype: twilio.rest.video.v1.room.recording.RecordingContext + """ + if self._context is None: + self._context = RecordingContext( + self._version, + room_sid=self._solution['room_sid'], + sid=self._solution['sid'], + ) + return self._context + + @property + def account_sid(self): + """ + :returns: The account_sid + :rtype: unicode + """ + return self._properties['account_sid'] + + @property + def status(self): + """ + :returns: The status + :rtype: RecordingInstance.Status + """ + return self._properties['status'] + + @property + def date_created(self): + """ + :returns: The date_created + :rtype: datetime + """ + return self._properties['date_created'] + + @property + def sid(self): + """ + :returns: The sid + :rtype: unicode + """ + return self._properties['sid'] + + @property + def source_sid(self): + """ + :returns: The source_sid + :rtype: unicode + """ + return self._properties['source_sid'] + + @property + def size(self): + """ + :returns: The size + :rtype: unicode + """ + return self._properties['size'] + + @property + def type(self): + """ + :returns: The type + :rtype: RecordingInstance.Type + """ + return self._properties['type'] + + @property + def duration(self): + """ + :returns: The duration + :rtype: unicode + """ + return self._properties['duration'] + + @property + def container_format(self): + """ + :returns: The container_format + :rtype: RecordingInstance.Format + """ + return self._properties['container_format'] + + @property + def codec(self): + """ + :returns: The codec + :rtype: RecordingInstance.Codec + """ + return self._properties['codec'] + + @property + def grouping_sids(self): + """ + :returns: The grouping_sids + :rtype: dict + """ + return self._properties['grouping_sids'] + + @property + def room_sid(self): + """ + :returns: The room_sid + :rtype: unicode + """ + return self._properties['room_sid'] + + @property + def url(self): + """ + :returns: The url + :rtype: unicode + """ + return self._properties['url'] + + @property + def links(self): + """ + :returns: The links + :rtype: unicode + """ + return self._properties['links'] + + def fetch(self): + """ + Fetch a RecordingInstance + + :returns: Fetched RecordingInstance + :rtype: twilio.rest.video.v1.room.recording.RecordingInstance + """ + return self._proxy.fetch() + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context)