diff --git a/CHANGES.md b/CHANGES.md index 1a58f0c1a2..2f9a854a8e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,40 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2021-02-10] Version 6.52.0 +--------------------------- +**Library - Docs** +- [PR #553](https://github.com/twilio/twilio-python/pull/553): fix simple typo, ommited -> omitted. Thanks to [@timgates42](https://github.com/timgates42)! + +**Library - Fix** +- [PR #558](https://github.com/twilio/twilio-python/pull/558): shortcut syntax for new non-GA versions. Thanks to [@eshanholtz](https://github.com/eshanholtz)! + +**Api** +- Revert change that conference participant create `from` and `to` param to be endpoint type for supporting client identifier and sip address +- Update the conference participant create `from` and `to` param to be endpoint type for supporting client identifier and sip address + +**Events** +- Documentation should state that no fields are PII + +**Flex** +- Adding `notifications` and `markdown` to Flex Configuration + +**Messaging** +- Add A2P use cases API +- Add Brand Registrations API +- Add Campaigns API + +**Serverless** +- Add runtime field to Build response and as an optional parameter to the Build create endpoint. +- Add @twilio/runtime-handler dependency to Build response example. + +**Sync** +- Remove If-Match header for Document **(breaking change)** + +**Twiml** +- Add `refer_url` and `refer_method` to `Dial`. + + [2021-01-27] Version 6.51.1 --------------------------- **Studio** diff --git a/tests/integration/api/v2010/account/test_conference.py b/tests/integration/api/v2010/account/test_conference.py index 58bab25fea..ad58b0ae77 100644 --- a/tests/integration/api/v2010/account/test_conference.py +++ b/tests/integration/api/v2010/account/test_conference.py @@ -177,7 +177,82 @@ def test_read_empty_response(self): self.assertIsNotNone(actual) - def test_read_full_response(self): + def test_read_next_response(self): + self.holodeck.mock(Response( + 200, + ''' + { + "conferences": [ + { + "status": "in-progress", + "region": "jp1", + "sid": "CFdddddddddddddddddddddddddddddddd", + "date_updated": "Thu, 01 Jan 2015 10:23:45 +0000", + "date_created": "Thu, 01 Jan 2015 10:23:45 +0000", + "subresource_uris": { + "participants": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFdddddddddddddddddddddddddddddddd/Participants.json", + "recordings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFdddddddddddddddddddddddddddddddd/Recordings.json" + }, + "friendly_name": "friendly_name", + "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFdddddddddddddddddddddddddddddddd.json", + "api_version": "2010-04-01", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "reason_conference_ended": null, + "call_sid_ending_conference": null + }, + { + "status": "in-progress", + "region": "unknown", + "sid": "CFeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + "date_updated": "Thu, 01 Jan 2015 09:23:45 +0000", + "date_created": "Thu, 01 Jan 2015 09:23:45 +0000", + "subresource_uris": { + "participants": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee/Participants.json", + "recordings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee/Recordings.json" + }, + "friendly_name": "friendly_name", + "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee.json", + "api_version": "2010-04-01", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "reason_conference_ended": null, + "call_sid_ending_conference": null + }, + { + "status": "in-progress", + "region": "us1", + "sid": "CFffffffffffffffffffffffffffffffff", + "date_updated": "Thu, 01 Jan 2015 08:23:45 +0000", + "date_created": "Thu, 01 Jan 2015 08:23:45 +0000", + "subresource_uris": { + "participants": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFffffffffffffffffffffffffffffffff/Participants.json", + "recordings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFffffffffffffffffffffffffffffffff/Recordings.json" + }, + "friendly_name": "friendly_name", + "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFffffffffffffffffffffffffffffffff.json", + "api_version": "2010-04-01", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "reason_conference_ended": null, + "call_sid_ending_conference": null + } + ], + "first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences.json?Status=in-progress&DateUpdated%3E=2018-11-12&DateUpdated%3C=2018-11-11&DateCreated=2008-01-03&FriendlyName=friendly_name&DateUpdated=2018-11-13&DateCreated%3C=2008-01-01&DateCreated%3E=2008-01-02&PageSize=3&Page=0", + "next_page_uri": null, + "previous_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences.json?Status=in-progress&DateUpdated%3E=2018-11-12&DateUpdated%3C=2018-11-11&DateCreated=2008-01-03&FriendlyName=friendly_name&DateUpdated=2018-11-13&DateCreated%3C=2008-01-01&DateCreated%3E=2008-01-02&PageSize=3&Page=0&PageToken=PBCFdddddddddddddddddddddddddddddddd", + "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences.json?Status=in-progress&DateUpdated%3E=2018-11-12&DateUpdated%3C=2018-11-11&DateCreated=2008-01-03&FriendlyName=friendly_name&DateUpdated=2018-11-13&DateCreated%3C=2008-01-01&DateCreated%3E=2008-01-02&PageSize=3&Page=1&PageToken=PACFcccccccccccccccccccccccccccccccc", + "page": 1, + "page_size": 3, + "start": 3, + "end": 5 + } + ''' + )) + + actual = self.client.api.v2010.accounts("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ + .conferences.list() + + self.assertIsNotNone(actual) + + def test_read_previous_response(self): self.holodeck.mock(Response( 200, ''' @@ -238,7 +313,7 @@ def test_read_full_response(self): "first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences.json?Status=in-progress&DateUpdated%3E=2018-11-12&DateUpdated%3C=2018-11-11&DateCreated=2008-01-03&FriendlyName=friendly_name&DateUpdated=2018-11-13&DateCreated%3C=2008-01-01&DateCreated%3E=2008-01-02&PageSize=3&Page=0", "next_page_uri": null, "previous_page_uri": null, - "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences.json?Status=in-progress&DateUpdated%3E=2018-11-12&DateUpdated%3C=2018-11-11&DateCreated=2008-01-03&FriendlyName=friendly_name&DateUpdated=2018-11-13&DateCreated%3C=2008-01-01&DateCreated%3E=2008-01-02&PageSize=3&Page=0", + "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences.json?Status=in-progress&DateUpdated%3E=2018-11-12&DateUpdated%3C=2018-11-11&DateCreated=2008-01-03&FriendlyName=friendly_name&DateUpdated=2018-11-13&DateCreated%3C=2008-01-01&DateCreated%3E=2008-01-02&PageSize=3&Page=0&PageToken=PBCFdddddddddddddddddddddddddddddddd", "page": 0, "page_size": 3, "start": 0, @@ -252,7 +327,7 @@ def test_read_full_response(self): self.assertIsNotNone(actual) - def test_read_next_response(self): + def test_read_myroom_inprogress_response(self): self.holodeck.mock(Response( 200, ''' @@ -261,15 +336,15 @@ def test_read_next_response(self): { "status": "in-progress", "region": "jp1", - "sid": "CFdddddddddddddddddddddddddddddddd", - "date_updated": "Thu, 01 Jan 2015 10:23:45 +0000", - "date_created": "Thu, 01 Jan 2015 10:23:45 +0000", + "sid": "CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "date_updated": "Sun, 03 Jan 2021 11:23:45 +0000", + "date_created": "Sun, 03 Jan 2021 11:23:45 +0000", "subresource_uris": { - "participants": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFdddddddddddddddddddddddddddddddd/Participants.json", - "recordings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFdddddddddddddddddddddddddddddddd/Recordings.json" + "participants": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants.json", + "recordings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings.json" }, - "friendly_name": "friendly_name", - "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFdddddddddddddddddddddddddddddddd.json", + "friendly_name": "MyRoom", + "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json", "api_version": "2010-04-01", "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "reason_conference_ended": null, @@ -277,16 +352,16 @@ def test_read_next_response(self): }, { "status": "in-progress", - "region": "unknown", - "sid": "CFeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", - "date_updated": "Thu, 01 Jan 2015 09:23:45 +0000", - "date_created": "Thu, 01 Jan 2015 09:23:45 +0000", + "region": "us1", + "sid": "CFbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", + "date_updated": "Sat, 02 Jan 2021 11:23:45 +0000", + "date_created": "Sat, 02 Jan 2021 11:23:45 +0000", "subresource_uris": { - "participants": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee/Participants.json", - "recordings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee/Recordings.json" + "participants": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/Participants.json", + "recordings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/Recordings.json" }, - "friendly_name": "friendly_name", - "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee.json", + "friendly_name": "MyRoom", + "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.json", "api_version": "2010-04-01", "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "reason_conference_ended": null, @@ -294,30 +369,105 @@ def test_read_next_response(self): }, { "status": "in-progress", - "region": "us1", - "sid": "CFffffffffffffffffffffffffffffffff", - "date_updated": "Thu, 01 Jan 2015 08:23:45 +0000", - "date_created": "Thu, 01 Jan 2015 08:23:45 +0000", + "region": "ie1", + "sid": "CFcccccccccccccccccccccccccccccccc", + "date_updated": "Fri, 01 Jan 2021 11:23:45 +0000", + "date_created": "Fri, 01 Jan 2021 11:23:45 +0000", "subresource_uris": { - "participants": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFffffffffffffffffffffffffffffffff/Participants.json", - "recordings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFffffffffffffffffffffffffffffffff/Recordings.json" + "participants": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFcccccccccccccccccccccccccccccccc/Participants.json", + "recordings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFcccccccccccccccccccccccccccccccc/Recordings.json" + }, + "friendly_name": "MyRoom", + "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFcccccccccccccccccccccccccccccccc.json", + "api_version": "2010-04-01", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "reason_conference_ended": null, + "call_sid_ending_conference": null + } + ], + "first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences.json?FriendlyName=MyRoom&Status=in-progress&PageSize=20&Page=0", + "next_page_uri": null, + "previous_page_uri": null, + "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences.json?FriendlyName=MyRoom&Status=in-progress&PageSize=20&Page=0", + "page": 0, + "page_size": 20, + "start": 0, + "end": 2 + } + ''' + )) + + actual = self.client.api.v2010.accounts("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ + .conferences.list() + + self.assertIsNotNone(actual) + + def test_read_full_response(self): + self.holodeck.mock(Response( + 200, + ''' + { + "conferences": [ + { + "status": "in-progress", + "region": "jp1", + "sid": "CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "date_updated": "Fri, 03 Jul 2020 11:23:45 +0000", + "date_created": "Fri, 03 Jul 2020 11:23:45 +0000", + "subresource_uris": { + "participants": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants.json", + "recordings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings.json" }, "friendly_name": "friendly_name", - "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFffffffffffffffffffffffffffffffff.json", + "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json", "api_version": "2010-04-01", "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "reason_conference_ended": null, "call_sid_ending_conference": null + }, + { + "status": "in-progress", + "region": "de1", + "sid": "CFbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", + "date_updated": "Thu, 02 Jul 2020 11:23:45 +0000", + "date_created": "Thu, 02 Jul 2020 11:23:45 +0000", + "subresource_uris": { + "participants": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/Participants.json", + "recordings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/Recordings.json" + }, + "friendly_name": "MyRoom", + "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.json", + "api_version": "2010-04-01", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "reason_conference_ended": null, + "call_sid_ending_conference": null + }, + { + "status": "completed", + "region": "br1", + "sid": "CFcccccccccccccccccccccccccccccccc", + "date_updated": "Wed, 01 Jul 2020 11:23:45 +0000", + "date_created": "Wed, 01 Jul 2020 11:23:45 +0000", + "subresource_uris": { + "participants": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFcccccccccccccccccccccccccccccccc/Participants.json", + "recordings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFcccccccccccccccccccccccccccccccc/Recordings.json" + }, + "friendly_name": "FRIEND", + "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFcccccccccccccccccccccccccccccccc.json", + "api_version": "2010-04-01", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "reason_conference_ended": "participant-with-end-conference-on-exit-left", + "call_sid_ending_conference": "CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ], - "first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences.json?Status=in-progress&DateUpdated%3E=2018-11-12&DateUpdated%3C=2018-11-11&DateCreated=2008-01-03&FriendlyName=friendly_name&DateUpdated=2018-11-13&DateCreated%3C=2008-01-01&DateCreated%3E=2008-01-02&PageSize=3&Page=0", + "first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences.json?PageSize=3&Page=0", "next_page_uri": null, - "previous_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences.json?Status=in-progress&DateUpdated%3E=2018-11-12&DateUpdated%3C=2018-11-11&DateCreated=2008-01-03&FriendlyName=friendly_name&DateUpdated=2018-11-13&DateCreated%3C=2008-01-01&DateCreated%3E=2008-01-02&PageSize=3&Page=0&PageToken=PBCFdddddddddddddddddddddddddddddddd", - "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences.json?Status=in-progress&DateUpdated%3E=2018-11-12&DateUpdated%3C=2018-11-11&DateCreated=2008-01-03&FriendlyName=friendly_name&DateUpdated=2018-11-13&DateCreated%3C=2008-01-01&DateCreated%3E=2008-01-02&PageSize=3&Page=1&PageToken=PACFcccccccccccccccccccccccccccccccc", - "page": 1, + "previous_page_uri": null, + "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences.json?PageSize=3&Page=0", + "page": 0, "page_size": 3, - "start": 3, - "end": 5 + "start": 0, + "end": 2 } ''' )) @@ -327,7 +477,7 @@ def test_read_next_response(self): self.assertIsNotNone(actual) - def test_read_previous_response(self): + def test_read_date_created_equals_response(self): self.holodeck.mock(Response( 200, ''' @@ -337,8 +487,8 @@ def test_read_previous_response(self): "status": "in-progress", "region": "jp1", "sid": "CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - "date_updated": "Sat, 03 Jan 2015 11:23:45 +0000", - "date_created": "Sat, 03 Jan 2015 11:23:45 +0000", + "date_updated": "Tue, 07 Jul 2020 11:23:45 +0000", + "date_created": "Tue, 07 Jul 2020 11:23:45 +0000", "subresource_uris": { "participants": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants.json", "recordings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings.json" @@ -352,15 +502,90 @@ def test_read_previous_response(self): }, { "status": "in-progress", - "region": "unknown", + "region": "de1", "sid": "CFbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", - "date_updated": "Fri, 02 Jan 2015 11:23:45 +0000", - "date_created": "Fri, 02 Jan 2015 11:23:45 +0000", + "date_updated": "Tue, 07 Jul 2020 11:23:45 +0000", + "date_created": "Tue, 07 Jul 2020 11:23:45 +0000", "subresource_uris": { "participants": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/Participants.json", "recordings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/Recordings.json" }, + "friendly_name": "MyRoom", + "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.json", + "api_version": "2010-04-01", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "reason_conference_ended": null, + "call_sid_ending_conference": null + }, + { + "status": "completed", + "region": "br1", + "sid": "CFcccccccccccccccccccccccccccccccc", + "date_updated": "Tue, 07 Jul 2020 11:23:45 +0000", + "date_created": "Tue, 07 Jul 2020 11:23:45 +0000", + "subresource_uris": { + "participants": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFcccccccccccccccccccccccccccccccc/Participants.json", + "recordings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFcccccccccccccccccccccccccccccccc/Recordings.json" + }, + "friendly_name": "FRIEND", + "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFcccccccccccccccccccccccccccccccc.json", + "api_version": "2010-04-01", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "reason_conference_ended": "participant-with-end-conference-on-exit-left", + "call_sid_ending_conference": "CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + } + ], + "first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences.json?DateCreated=2020-07-07&PageSize=3&Page=0", + "next_page_uri": null, + "previous_page_uri": null, + "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences.json?DateCreated=2020-07-07&PageSize=3&Page=0", + "page": 0, + "page_size": 3, + "start": 0, + "end": 2 + } + ''' + )) + + actual = self.client.api.v2010.accounts("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ + .conferences.list() + + self.assertIsNotNone(actual) + + def test_read_date_created_on_or_after_response(self): + self.holodeck.mock(Response( + 200, + ''' + { + "conferences": [ + { + "status": "in-progress", + "region": "jp1", + "sid": "CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "date_updated": "Fri, 01 Jan 2021 11:23:45 +0000", + "date_created": "Fri, 01 Jan 2021 11:23:45 +0000", + "subresource_uris": { + "participants": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants.json", + "recordings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings.json" + }, "friendly_name": "friendly_name", + "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json", + "api_version": "2010-04-01", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "reason_conference_ended": null, + "call_sid_ending_conference": null + }, + { + "status": "in-progress", + "region": "de1", + "sid": "CFbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", + "date_updated": "Fri, 01 Jan 2021 11:23:45 +0000", + "date_created": "Fri, 01 Jan 2021 11:23:45 +0000", + "subresource_uris": { + "participants": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/Participants.json", + "recordings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/Recordings.json" + }, + "friendly_name": "MyRoom", "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.json", "api_version": "2010-04-01", "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", @@ -369,15 +594,15 @@ def test_read_previous_response(self): }, { "status": "in-progress", - "region": "us1", + "region": "br1", "sid": "CFcccccccccccccccccccccccccccccccc", - "date_updated": "Thu, 01 Jan 2015 11:23:45 +0000", - "date_created": "Thu, 01 Jan 2015 11:23:45 +0000", + "date_updated": "Fri, 01 Jan 2021 11:23:45 +0000", + "date_created": "Fri, 01 Jan 2021 11:23:45 +0000", "subresource_uris": { "participants": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFcccccccccccccccccccccccccccccccc/Participants.json", "recordings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFcccccccccccccccccccccccccccccccc/Recordings.json" }, - "friendly_name": "friendly_name", + "friendly_name": "FRIEND", "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFcccccccccccccccccccccccccccccccc.json", "api_version": "2010-04-01", "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", @@ -385,12 +610,12 @@ def test_read_previous_response(self): "call_sid_ending_conference": null } ], - "first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences.json?Status=in-progress&DateUpdated%3E=2018-11-12&DateUpdated%3C=2018-11-11&DateCreated=2008-01-03&FriendlyName=friendly_name&DateUpdated=2018-11-13&DateCreated%3C=2008-01-01&DateCreated%3E=2008-01-02&PageSize=3&Page=0", + "first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences.json?Status=in-progress&DateCreated%3E=2021-01-01&PageSize=20&Page=0", "next_page_uri": null, "previous_page_uri": null, - "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences.json?Status=in-progress&DateUpdated%3E=2018-11-12&DateUpdated%3C=2018-11-11&DateCreated=2008-01-03&FriendlyName=friendly_name&DateUpdated=2018-11-13&DateCreated%3C=2008-01-01&DateCreated%3E=2008-01-02&PageSize=3&Page=0&PageToken=PBCFdddddddddddddddddddddddddddddddd", + "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences.json?Status=in-progress&DateCreated%3E=2021-01-01&PageSize=20&Page=0", "page": 0, - "page_size": 3, + "page_size": 20, "start": 0, "end": 2 } @@ -442,3 +667,32 @@ def test_update_end_conference_response(self): .conferences("CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update() self.assertIsNotNone(actual) + + def test_announce_to_conference_response(self): + self.holodeck.mock(Response( + 200, + ''' + { + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "api_version": "2010-04-01", + "date_created": "Mon, 08 Feb 2021 20:58:45 +0000", + "date_updated": "Mon, 08 Feb 2021 20:58:46 +0000", + "friendly_name": "MyRoom", + "region": "us1", + "sid": "CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "status": "in-progress", + "subresource_uris": { + "participants": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants.json", + "recordings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings.json" + }, + "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json", + "reason_conference_ended": null, + "call_sid_ending_conference": null + } + ''' + )) + + actual = self.client.api.v2010.accounts("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ + .conferences("CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update() + + self.assertIsNotNone(actual) diff --git a/tests/integration/flex_api/v1/test_configuration.py b/tests/integration/flex_api/v1/test_configuration.py index 1db6e681f7..daa8914c64 100644 --- a/tests/integration/flex_api/v1/test_configuration.py +++ b/tests/integration/flex_api/v1/test_configuration.py @@ -182,6 +182,14 @@ def test_fetch_response(self): "ZSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "ZSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab" ], + "notifications": { + "enabled": true, + "mode": "whenNotInFocus" + }, + "markdown": { + "enabled": false, + "mode": "readOnly" + }, "url": "https://flex-api.twilio.com/v1/Configuration" } ''' @@ -359,6 +367,14 @@ def test_create_response(self): "ZSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "ZSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab" ], + "notifications": { + "enabled": true, + "mode": "whenNotInFocus" + }, + "markdown": { + "enabled": false, + "mode": "readOnly" + }, "url": "https://flex-api.twilio.com/v1/Configuration" } ''' @@ -536,6 +552,14 @@ def test_update_response(self): "ZSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "ZSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab" ], + "notifications": { + "enabled": true, + "mode": "whenNotInFocus" + }, + "markdown": { + "enabled": false, + "mode": "readOnly" + }, "url": "https://flex-api.twilio.com/v1/Configuration" } ''' diff --git a/tests/integration/messaging/v1/test_brand_registration.py b/tests/integration/messaging/v1/test_brand_registration.py new file mode 100644 index 0000000000..08b25d11bf --- /dev/null +++ b/tests/integration/messaging/v1/test_brand_registration.py @@ -0,0 +1,136 @@ +# coding=utf-8 +r""" +This code was generated by +\ / _ _ _| _ _ + | (_)\/(_)(_|\/| |(/_ v1.0.0 + / / +""" + +from tests import IntegrationTestCase +from tests.holodeck import Request +from twilio.base.exceptions import TwilioException +from twilio.http.response import Response + + +class BrandRegistrationTestCase(IntegrationTestCase): + + def test_fetch_request(self): + self.holodeck.mock(Response(500, '')) + + with self.assertRaises(TwilioException): + self.client.messaging.v1.brand_registrations("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch() + + self.holodeck.assert_has_request(Request( + 'get', + 'https://messaging.twilio.com/v1/a2p/BrandRegistrations/BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', + )) + + def test_fetch_response(self): + self.holodeck.mock(Response( + 200, + ''' + { + "sid": "BN0044409f7e067e279523808d267e2d85", + "account_sid": "AC78e8e67fc0246521490fb9907fd0c165", + "customer_profile_bundle_sid": "BU3344409f7e067e279523808d267e2d85", + "a2p_profile_bundle_sid": "BU3344409f7e067e279523808d267e2d85", + "date_created": "2021-01-27T14:18:35Z", + "date_updated": "2021-01-27T14:18:36Z", + "status": "IN_PROGRESS", + "tcr_id": "BXXXXXX", + "failure_reason": "Registration error", + "url": "https://messaging.twilio.com/v1/a2p/BrandRegistrations/BN0044409f7e067e279523808d267e2d85" + } + ''' + )) + + actual = self.client.messaging.v1.brand_registrations("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch() + + self.assertIsNotNone(actual) + + def test_list_request(self): + self.holodeck.mock(Response(500, '')) + + with self.assertRaises(TwilioException): + self.client.messaging.v1.brand_registrations.list() + + self.holodeck.assert_has_request(Request( + 'get', + 'https://messaging.twilio.com/v1/a2p/BrandRegistrations', + )) + + def test_read_response(self): + self.holodeck.mock(Response( + 200, + ''' + { + "meta": { + "page": 0, + "page_size": 50, + "first_page_url": "https://messaging.twilio.com/v1/a2p/BrandRegistrations?PageSize=50&Page=0", + "previous_page_url": null, + "next_page_url": null, + "key": "data", + "url": "https://messaging.twilio.com/v1/a2p/BrandRegistrations?PageSize=50&Page=0" + }, + "data": [ + { + "sid": "BN0044409f7e067e279523808d267e2d85", + "account_sid": "AC78e8e67fc0246521490fb9907fd0c165", + "customer_profile_bundle_sid": "BU3344409f7e067e279523808d267e2d85", + "a2p_profile_bundle_sid": "BU3344409f7e067e279523808d267e2d85", + "date_created": "2021-01-27T14:18:35Z", + "date_updated": "2021-01-27T14:18:36Z", + "status": "IN_PROGRESS", + "tcr_id": "BXXXXXX", + "failure_reason": "Registration error", + "url": "https://messaging.twilio.com/v1/a2p/BrandRegistrations/BN0044409f7e067e279523808d267e2d85" + } + ] + } + ''' + )) + + actual = self.client.messaging.v1.brand_registrations.list() + + self.assertIsNotNone(actual) + + def test_create_request(self): + self.holodeck.mock(Response(500, '')) + + with self.assertRaises(TwilioException): + self.client.messaging.v1.brand_registrations.create(customer_profile_bundle_sid="BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", a2p_profile_bundle_sid="BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + + values = { + 'CustomerProfileBundleSid': "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + 'A2PProfileBundleSid': "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + } + + self.holodeck.assert_has_request(Request( + 'post', + 'https://messaging.twilio.com/v1/a2p/BrandRegistrations', + data=values, + )) + + def test_create_response(self): + self.holodeck.mock(Response( + 201, + ''' + { + "sid": "BN0044409f7e067e279523808d267e2d85", + "account_sid": "AC78e8e67fc0246521490fb9907fd0c165", + "customer_profile_bundle_sid": "BU0000009f7e067e279523808d267e2d90", + "a2p_profile_bundle_sid": "BU1111109f7e067e279523808d267e2d85", + "date_created": "2021-01-28T10:45:51Z", + "date_updated": "2021-01-28T10:45:51Z", + "status": "PENDING", + "tcr_id": "BXXXXXX", + "failure_reason": "Registration error", + "url": "https://messaging.twilio.com/v1/a2p/BrandRegistrations/BN0044409f7e067e279523808d267e2d85" + } + ''' + )) + + actual = self.client.messaging.v1.brand_registrations.create(customer_profile_bundle_sid="BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", a2p_profile_bundle_sid="BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + + self.assertIsNotNone(actual) diff --git a/tests/integration/messaging/v1/test_campaign.py b/tests/integration/messaging/v1/test_campaign.py new file mode 100644 index 0000000000..065adea4a8 --- /dev/null +++ b/tests/integration/messaging/v1/test_campaign.py @@ -0,0 +1,184 @@ +# coding=utf-8 +r""" +This code was generated by +\ / _ _ _| _ _ + | (_)\/(_)(_|\/| |(/_ v1.0.0 + / / +""" + +from tests import IntegrationTestCase +from tests.holodeck import Request +from twilio.base import serialize +from twilio.base.exceptions import TwilioException +from twilio.http.response import Response + + +class CampaignTestCase(IntegrationTestCase): + + def test_fetch_request(self): + self.holodeck.mock(Response(500, '')) + + with self.assertRaises(TwilioException): + self.client.messaging.v1.campaigns("CMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch() + + self.holodeck.assert_has_request(Request( + 'get', + 'https://messaging.twilio.com/v1/a2p/Campaigns/CMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', + )) + + def test_fetch_response(self): + self.holodeck.mock(Response( + 200, + ''' + { + "sid": "CMdeadbeef66043a43b62be6d67c635c85", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "date_created": "2021-01-27T14:47:52Z", + "date_updated": "2021-01-27T14:47:52Z", + "description": "Test description for test campaing", + "message_samples": [ + "Test_Sample_1", + "Another_test_sample_2" + ], + "status": "pending", + "failure_reason": null, + "use_case": "PUBLIC_SERVICE_ANNOUNCEMENT", + "has_embedded_links": true, + "has_embedded_phone": false, + "brand_registration_sid": "BN0044409f7e067e279523808d267e2d85", + "url": "https://messaging.twilio.com/v1/a2p/Campaigns/CMdeadbeef66043a43b62be6d67c635c85" + } + ''' + )) + + actual = self.client.messaging.v1.campaigns("CMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch() + + self.assertIsNotNone(actual) + + def test_list_request(self): + self.holodeck.mock(Response(500, '')) + + with self.assertRaises(TwilioException): + self.client.messaging.v1.campaigns.list() + + self.holodeck.assert_has_request(Request( + 'get', + 'https://messaging.twilio.com/v1/a2p/Campaigns', + )) + + def test_read_full_response(self): + self.holodeck.mock(Response( + 200, + ''' + { + "meta": { + "page": 0, + "page_size": 50, + "first_page_url": "https://messaging.twilio.com/v1/a2p/Campaigns?PageSize=50&Page=0", + "previous_page_url": null, + "next_page_url": null, + "key": "data", + "url": "https://messaging.twilio.com/v1/a2p/Campaigns?PageSize=50&Page=0" + }, + "data": [ + { + "sid": "CMdeadbeef66043a43b62be6d67c635c85", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "date_created": "2021-01-27T14:47:52Z", + "date_updated": "2021-01-27T14:47:53Z", + "description": "Test description for test campaing", + "message_samples": [ + "Test_Sample_1", + "Another_test_sample_2" + ], + "status": "pending", + "failure_reason": null, + "use_case": "GAMBLING_SWEEPSTAKE", + "has_embedded_links": true, + "has_embedded_phone": false, + "brand_registration_sid": "BN0044409f7e067e279523808d267e2d85", + "url": "https://messaging.twilio.com/v1/a2p/Campaigns/CMdeadbeef66043a43b62be6d67c635c85" + } + ] + } + ''' + )) + + actual = self.client.messaging.v1.campaigns.list() + + self.assertIsNotNone(actual) + + def test_create_request(self): + self.holodeck.mock(Response(500, '')) + + with self.assertRaises(TwilioException): + self.client.messaging.v1.campaigns.create(brand_registration_sid="BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", use_case="use_case", description="description", message_samples=['message_samples'], has_embedded_links=True, has_embedded_phone=True, messaging_service_sid="MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + + values = { + 'BrandRegistrationSid': "BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + 'UseCase': "use_case", + 'Description': "description", + 'MessageSamples': serialize.map(['message_samples'], lambda e: e), + 'HasEmbeddedLinks': True, + 'HasEmbeddedPhone': True, + 'MessagingServiceSid': "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + } + + self.holodeck.assert_has_request(Request( + 'post', + 'https://messaging.twilio.com/v1/a2p/Campaigns', + data=values, + )) + + def test_create_response(self): + self.holodeck.mock(Response( + 201, + ''' + { + "sid": "CMdeadbeef66043a43b62be6d67c635c85", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "messaging_service_sid": "MG3u3kcgofdljponkatswl3ad3ev0c123u", + "brand_registration_sid": "BN0044409f7e067e279523808d267e2d85", + "date_created": "2021-01-27T14:47:52Z", + "date_updated": "2021-01-27T14:47:52Z", + "description": "Send marketing messages about sales and offers to opted in customers.", + "message_samples": [ + "EXPRESS: Denim Days Event is ON", + "LAST CHANCE: Book your next flight for just 1 (ONE) EUR" + ], + "status": "pending", + "failure_reason": null, + "use_case": "2FA", + "has_embedded_links": true, + "has_embedded_phone": false, + "url": "https://messaging.twilio.com/v1/a2p/Campaigns/CMdeadbeef66043a43b62be6d67c635c85" + } + ''' + )) + + actual = self.client.messaging.v1.campaigns.create(brand_registration_sid="BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", use_case="use_case", description="description", message_samples=['message_samples'], has_embedded_links=True, has_embedded_phone=True, messaging_service_sid="MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + + self.assertIsNotNone(actual) + + def test_delete_request(self): + self.holodeck.mock(Response(500, '')) + + with self.assertRaises(TwilioException): + self.client.messaging.v1.campaigns("CMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete() + + self.holodeck.assert_has_request(Request( + 'delete', + 'https://messaging.twilio.com/v1/a2p/Campaigns/CMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', + )) + + def test_delete_response(self): + self.holodeck.mock(Response( + 204, + None, + )) + + actual = self.client.messaging.v1.campaigns("CMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete() + + self.assertTrue(actual) diff --git a/tests/integration/messaging/v1/test_use_case.py b/tests/integration/messaging/v1/test_use_case.py new file mode 100644 index 0000000000..db724d4325 --- /dev/null +++ b/tests/integration/messaging/v1/test_use_case.py @@ -0,0 +1,55 @@ +# coding=utf-8 +r""" +This code was generated by +\ / _ _ _| _ _ + | (_)\/(_)(_|\/| |(/_ v1.0.0 + / / +""" + +from tests import IntegrationTestCase +from tests.holodeck import Request +from twilio.base.exceptions import TwilioException +from twilio.http.response import Response + + +class UseCaseTestCase(IntegrationTestCase): + + def test_list_request(self): + self.holodeck.mock(Response(500, '')) + + with self.assertRaises(TwilioException): + self.client.messaging.v1.use_cases.list() + + self.holodeck.assert_has_request(Request( + 'get', + 'https://messaging.twilio.com/v1/a2p/UseCases', + )) + + def test_read_response(self): + self.holodeck.mock(Response( + 200, + ''' + { + "meta": { + "page": 0, + "page_size": 50, + "first_page_url": "https://messaging.twilio.com/v1/a2p/UseCases?PageSize=50&Page=0", + "previous_page_url": null, + "next_page_url": null, + "key": "data", + "url": "https://messaging.twilio.com/v1/a2p/UseCases?PageSize=50&Page=0" + }, + "data": [ + { + "code": "HIGHER_EDUCATION", + "name": "Higher Education", + "description": "Higher Education: For campaigns created on behalf of Colleges or Universities" + } + ] + } + ''' + )) + + actual = self.client.messaging.v1.use_cases.list() + + self.assertIsNotNone(actual) diff --git a/tests/integration/preview/sync/service/test_document.py b/tests/integration/preview/sync/service/test_document.py index 21e1e6bf2f..a71ff3e6d1 100644 --- a/tests/integration/preview/sync/service/test_document.py +++ b/tests/integration/preview/sync/service/test_document.py @@ -59,13 +59,11 @@ def test_delete_request(self): with self.assertRaises(TwilioException): self.client.preview.sync.services("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ - .documents("ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(if_match="if_match") + .documents("ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete() - headers = {'If-Match': "if_match", } self.holodeck.assert_has_request(Request( 'delete', 'https://preview.twilio.com/Sync/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Documents/ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', - headers=headers, )) def test_delete_response(self): diff --git a/tests/integration/serverless/v1/service/test_build.py b/tests/integration/serverless/v1/service/test_build.py index 5843825a1d..0b025aecdb 100644 --- a/tests/integration/serverless/v1/service/test_build.py +++ b/tests/integration/serverless/v1/service/test_build.py @@ -95,9 +95,14 @@ def test_fetch_response(self): "dependencies": [ { "name": "twilio", - "version": "3.6.3" + "version": "3.29.2" + }, + { + "name": "@twilio/runtime-handler", + "version": "1.0.1" } ], + "runtime": "node10", "status": "deploying", "date_created": "2018-11-10T20:00:00Z", "date_updated": "2018-11-10T20:00:00Z", @@ -182,9 +187,14 @@ def test_create_response(self): "dependencies": [ { "name": "twilio", - "version": "3.6.3" + "version": "3.29.2" + }, + { + "name": "@twilio/runtime-handler", + "version": "1.0.1" } ], + "runtime": "node10", "status": "building", "date_created": "2018-11-10T20:00:00Z", "date_updated": "2018-11-10T20:00:00Z", diff --git a/tests/integration/supersim/v1/test_fleet.py b/tests/integration/supersim/v1/test_fleet.py index 8e578cb9bb..44f5ea1a7e 100644 --- a/tests/integration/supersim/v1/test_fleet.py +++ b/tests/integration/supersim/v1/test_fleet.py @@ -43,6 +43,8 @@ def test_create_response(self): "commands_enabled": true, "commands_method": "GET", "commands_url": "https://google.com", + "ip_commands_method": "GET", + "ip_commands_url": "https://google.com", "network_access_profile_sid": "HAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "sid": "HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "url": "https://supersim.twilio.com/v1/Fleets/HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" @@ -80,6 +82,8 @@ def test_fetch_response(self): "commands_enabled": true, "commands_method": "POST", "commands_url": null, + "ip_commands_method": "POST", + "ip_commands_url": null, "network_access_profile_sid": "HAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "sid": "HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "url": "https://supersim.twilio.com/v1/Fleets/HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" @@ -151,6 +155,8 @@ def test_read_full_response(self): "commands_enabled": true, "commands_method": "POST", "commands_url": null, + "ip_commands_method": "POST", + "ip_commands_url": null, "network_access_profile_sid": "HAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "sid": "HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "url": "https://supersim.twilio.com/v1/Fleets/HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" @@ -190,6 +196,8 @@ def test_update_unique_name_response(self): "commands_enabled": true, "commands_method": "POST", "commands_url": null, + "ip_commands_method": "POST", + "ip_commands_url": null, "network_access_profile_sid": "HAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "sid": "HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "url": "https://supersim.twilio.com/v1/Fleets/HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" diff --git a/tests/integration/sync/v1/service/test_document.py b/tests/integration/sync/v1/service/test_document.py index 0b1ebe282b..95c5148068 100644 --- a/tests/integration/sync/v1/service/test_document.py +++ b/tests/integration/sync/v1/service/test_document.py @@ -59,13 +59,11 @@ def test_delete_request(self): with self.assertRaises(TwilioException): self.client.sync.v1.services("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ - .documents("ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(if_match="if_match") + .documents("ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete() - headers = {'If-Match': "if_match", } self.holodeck.assert_has_request(Request( 'delete', 'https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Documents/ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', - headers=headers, )) def test_delete_response(self): diff --git a/twilio/rest/flex_api/v1/configuration.py b/twilio/rest/flex_api/v1/configuration.py index a1a237938d..c4133500a7 100644 --- a/twilio/rest/flex_api/v1/configuration.py +++ b/twilio/rest/flex_api/v1/configuration.py @@ -215,6 +215,8 @@ def __init__(self, version, payload): 'outbound_call_flows': payload.get('outbound_call_flows'), 'serverless_service_sids': payload.get('serverless_service_sids'), 'queue_stats_configuration': payload.get('queue_stats_configuration'), + 'notifications': payload.get('notifications'), + 'markdown': payload.get('markdown'), 'url': payload.get('url'), } @@ -523,6 +525,22 @@ def queue_stats_configuration(self): """ return self._properties['queue_stats_configuration'] + @property + def notifications(self): + """ + :returns: Configurable parameters for Notifications + :rtype: dict + """ + return self._properties['notifications'] + + @property + def markdown(self): + """ + :returns: Configurable parameters for Markdown + :rtype: dict + """ + return self._properties['markdown'] + @property def url(self): """ diff --git a/twilio/rest/messaging/__init__.py b/twilio/rest/messaging/__init__.py index 0058db3f75..284d05293a 100644 --- a/twilio/rest/messaging/__init__.py +++ b/twilio/rest/messaging/__init__.py @@ -36,6 +36,20 @@ def v1(self): self._v1 = V1(self) return self._v1 + @property + def brand_registrations(self): + """ + :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationList + """ + return self.v1.brand_registrations + + @property + def campaigns(self): + """ + :rtype: twilio.rest.messaging.v1.campaign.CampaignList + """ + return self.v1.campaigns + @property def deactivations(self): """ @@ -50,6 +64,13 @@ def services(self): """ return self.v1.services + @property + def use_cases(self): + """ + :rtype: twilio.rest.messaging.v1.use_case.UseCaseList + """ + return self.v1.use_cases + def __repr__(self): """ Provide a friendly representation diff --git a/twilio/rest/messaging/v1/__init__.py b/twilio/rest/messaging/v1/__init__.py index db5d64e5ef..a870c08ba4 100644 --- a/twilio/rest/messaging/v1/__init__.py +++ b/twilio/rest/messaging/v1/__init__.py @@ -7,8 +7,11 @@ """ from twilio.base.version import Version +from twilio.rest.messaging.v1.brand_registration import BrandRegistrationList +from twilio.rest.messaging.v1.campaign import CampaignList from twilio.rest.messaging.v1.deactivation import DeactivationsList from twilio.rest.messaging.v1.service import ServiceList +from twilio.rest.messaging.v1.use_case import UseCaseList class V1(Version): @@ -22,8 +25,29 @@ def __init__(self, domain): """ super(V1, self).__init__(domain) self.version = 'v1' + self._brand_registrations = None + self._campaigns = None self._deactivations = None self._services = None + self._use_cases = None + + @property + def brand_registrations(self): + """ + :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationList + """ + if self._brand_registrations is None: + self._brand_registrations = BrandRegistrationList(self) + return self._brand_registrations + + @property + def campaigns(self): + """ + :rtype: twilio.rest.messaging.v1.campaign.CampaignList + """ + if self._campaigns is None: + self._campaigns = CampaignList(self) + return self._campaigns @property def deactivations(self): @@ -43,6 +67,15 @@ def services(self): self._services = ServiceList(self) return self._services + @property + def use_cases(self): + """ + :rtype: twilio.rest.messaging.v1.use_case.UseCaseList + """ + if self._use_cases is None: + self._use_cases = UseCaseList(self) + return self._use_cases + def __repr__(self): """ Provide a friendly representation diff --git a/twilio/rest/messaging/v1/brand_registration.py b/twilio/rest/messaging/v1/brand_registration.py new file mode 100644 index 0000000000..cbcca42a6a --- /dev/null +++ b/twilio/rest/messaging/v1/brand_registration.py @@ -0,0 +1,392 @@ +# coding=utf-8 +r""" +This code was generated by +\ / _ _ _| _ _ + | (_)\/(_)(_|\/| |(/_ v1.0.0 + / / +""" + +from twilio.base import deserialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.page import Page + + +class BrandRegistrationList(ListResource): + """ PLEASE NOTE that this class contains beta products that are subject to + change. Use them with caution. """ + + def __init__(self, version): + """ + Initialize the BrandRegistrationList + + :param Version version: Version that contains the resource + + :returns: twilio.rest.messaging.v1.brand_registration.BrandRegistrationList + :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationList + """ + super(BrandRegistrationList, self).__init__(version) + + # Path Solution + self._solution = {} + self._uri = '/a2p/BrandRegistrations'.format(**self._solution) + + def stream(self, limit=None, page_size=None): + """ + Streams BrandRegistrationInstance 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.messaging.v1.brand_registration.BrandRegistrationInstance] + """ + limits = self._version.read_limits(limit, page_size) + + page = self.page(page_size=limits['page_size'], ) + + return self._version.stream(page, limits['limit']) + + def list(self, limit=None, page_size=None): + """ + Lists BrandRegistrationInstance 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.messaging.v1.brand_registration.BrandRegistrationInstance] + """ + 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 BrandRegistrationInstance 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 BrandRegistrationInstance + :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationPage + """ + data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) + + response = self._version.page(method='GET', uri=self._uri, params=data, ) + + return BrandRegistrationPage(self._version, response, self._solution) + + def get_page(self, target_url): + """ + Retrieve a specific page of BrandRegistrationInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of BrandRegistrationInstance + :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationPage + """ + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return BrandRegistrationPage(self._version, response, self._solution) + + def create(self, customer_profile_bundle_sid, a2p_profile_bundle_sid): + """ + Create the BrandRegistrationInstance + + :param unicode customer_profile_bundle_sid: Customer Profile Bundle Sid + :param unicode a2p_profile_bundle_sid: A2P Messaging Profile Bundle Sid + + :returns: The created BrandRegistrationInstance + :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationInstance + """ + data = values.of({ + 'CustomerProfileBundleSid': customer_profile_bundle_sid, + 'A2PProfileBundleSid': a2p_profile_bundle_sid, + }) + + payload = self._version.create(method='POST', uri=self._uri, data=data, ) + + return BrandRegistrationInstance(self._version, payload, ) + + def get(self, sid): + """ + Constructs a BrandRegistrationContext + + :param sid: The SID that identifies the resource to fetch + + :returns: twilio.rest.messaging.v1.brand_registration.BrandRegistrationContext + :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationContext + """ + return BrandRegistrationContext(self._version, sid=sid, ) + + def __call__(self, sid): + """ + Constructs a BrandRegistrationContext + + :param sid: The SID that identifies the resource to fetch + + :returns: twilio.rest.messaging.v1.brand_registration.BrandRegistrationContext + :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationContext + """ + return BrandRegistrationContext(self._version, sid=sid, ) + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + return '' + + +class BrandRegistrationPage(Page): + """ PLEASE NOTE that this class contains beta products that are subject to + change. Use them with caution. """ + + def __init__(self, version, response, solution): + """ + Initialize the BrandRegistrationPage + + :param Version version: Version that contains the resource + :param Response response: Response from the API + + :returns: twilio.rest.messaging.v1.brand_registration.BrandRegistrationPage + :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationPage + """ + super(BrandRegistrationPage, self).__init__(version, response) + + # Path Solution + self._solution = solution + + def get_instance(self, payload): + """ + Build an instance of BrandRegistrationInstance + + :param dict payload: Payload response from the API + + :returns: twilio.rest.messaging.v1.brand_registration.BrandRegistrationInstance + :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationInstance + """ + return BrandRegistrationInstance(self._version, payload, ) + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + return '' + + +class BrandRegistrationContext(InstanceContext): + """ PLEASE NOTE that this class contains beta products that are subject to + change. Use them with caution. """ + + def __init__(self, version, sid): + """ + Initialize the BrandRegistrationContext + + :param Version version: Version that contains the resource + :param sid: The SID that identifies the resource to fetch + + :returns: twilio.rest.messaging.v1.brand_registration.BrandRegistrationContext + :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationContext + """ + super(BrandRegistrationContext, self).__init__(version) + + # Path Solution + self._solution = {'sid': sid, } + self._uri = '/a2p/BrandRegistrations/{sid}'.format(**self._solution) + + def fetch(self): + """ + Fetch the BrandRegistrationInstance + + :returns: The fetched BrandRegistrationInstance + :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationInstance + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + + return BrandRegistrationInstance(self._version, payload, 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 BrandRegistrationInstance(InstanceResource): + """ PLEASE NOTE that this class contains beta products that are subject to + change. Use them with caution. """ + + class Status(object): + IN_PROGRESS = "IN_PROGRESS" + VERIFIED = "VERIFIED" + FAILED = "FAILED" + + def __init__(self, version, payload, sid=None): + """ + Initialize the BrandRegistrationInstance + + :returns: twilio.rest.messaging.v1.brand_registration.BrandRegistrationInstance + :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationInstance + """ + super(BrandRegistrationInstance, self).__init__(version) + + # Marshaled Properties + self._properties = { + 'sid': payload.get('sid'), + 'account_sid': payload.get('account_sid'), + 'customer_profile_bundle_sid': payload.get('customer_profile_bundle_sid'), + 'a2p_profile_bundle_sid': payload.get('a2p_profile_bundle_sid'), + 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), + 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), + 'status': payload.get('status'), + 'tcr_id': payload.get('tcr_id'), + 'failure_reason': payload.get('failure_reason'), + 'url': payload.get('url'), + } + + # 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: BrandRegistrationContext for this BrandRegistrationInstance + :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationContext + """ + if self._context is None: + self._context = BrandRegistrationContext(self._version, sid=self._solution['sid'], ) + return self._context + + @property + def sid(self): + """ + :returns: A2P BrandRegistration Sid + :rtype: unicode + """ + return self._properties['sid'] + + @property + def account_sid(self): + """ + :returns: The SID of the Account that created the resource + :rtype: unicode + """ + return self._properties['account_sid'] + + @property + def customer_profile_bundle_sid(self): + """ + :returns: A2P Messaging Profile Bundle BundleSid + :rtype: unicode + """ + return self._properties['customer_profile_bundle_sid'] + + @property + def a2p_profile_bundle_sid(self): + """ + :returns: A2P Messaging Profile Bundle BundleSid + :rtype: unicode + """ + return self._properties['a2p_profile_bundle_sid'] + + @property + def date_created(self): + """ + :returns: The ISO 8601 date and time in GMT when the resource was created + :rtype: datetime + """ + return self._properties['date_created'] + + @property + def date_updated(self): + """ + :returns: The ISO 8601 date and time in GMT when the resource was last updated + :rtype: datetime + """ + return self._properties['date_updated'] + + @property + def status(self): + """ + :returns: Brand Registration status + :rtype: BrandRegistrationInstance.Status + """ + return self._properties['status'] + + @property + def tcr_id(self): + """ + :returns: Campaign Registry (TCR) Brand ID + :rtype: unicode + """ + return self._properties['tcr_id'] + + @property + def failure_reason(self): + """ + :returns: A reason why brand registration has failed + :rtype: unicode + """ + return self._properties['failure_reason'] + + @property + def url(self): + """ + :returns: The absolute URL of the Brand Registration + :rtype: unicode + """ + return self._properties['url'] + + def fetch(self): + """ + Fetch the BrandRegistrationInstance + + :returns: The fetched BrandRegistrationInstance + :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationInstance + """ + 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) diff --git a/twilio/rest/messaging/v1/campaign.py b/twilio/rest/messaging/v1/campaign.py new file mode 100644 index 0000000000..89f1ff2d26 --- /dev/null +++ b/twilio/rest/messaging/v1/campaign.py @@ -0,0 +1,458 @@ +# coding=utf-8 +r""" +This code was generated by +\ / _ _ _| _ _ + | (_)\/(_)(_|\/| |(/_ v1.0.0 + / / +""" + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.page import Page + + +class CampaignList(ListResource): + """ PLEASE NOTE that this class contains beta products that are subject to + change. Use them with caution. """ + + def __init__(self, version): + """ + Initialize the CampaignList + + :param Version version: Version that contains the resource + + :returns: twilio.rest.messaging.v1.campaign.CampaignList + :rtype: twilio.rest.messaging.v1.campaign.CampaignList + """ + super(CampaignList, self).__init__(version) + + # Path Solution + self._solution = {} + self._uri = '/a2p/Campaigns'.format(**self._solution) + + def stream(self, limit=None, page_size=None): + """ + Streams CampaignInstance 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.messaging.v1.campaign.CampaignInstance] + """ + limits = self._version.read_limits(limit, page_size) + + page = self.page(page_size=limits['page_size'], ) + + return self._version.stream(page, limits['limit']) + + def list(self, limit=None, page_size=None): + """ + Lists CampaignInstance 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.messaging.v1.campaign.CampaignInstance] + """ + 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 CampaignInstance 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 CampaignInstance + :rtype: twilio.rest.messaging.v1.campaign.CampaignPage + """ + data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) + + response = self._version.page(method='GET', uri=self._uri, params=data, ) + + return CampaignPage(self._version, response, self._solution) + + def get_page(self, target_url): + """ + Retrieve a specific page of CampaignInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of CampaignInstance + :rtype: twilio.rest.messaging.v1.campaign.CampaignPage + """ + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return CampaignPage(self._version, response, self._solution) + + def create(self, brand_registration_sid, use_case, description, message_samples, + has_embedded_links, has_embedded_phone, messaging_service_sid): + """ + Create the CampaignInstance + + :param unicode brand_registration_sid: A2P BrandRegistration Sid + :param unicode use_case: A2P Campaign UseCase. + :param unicode description: A short description of what this SMS campaign does + :param list[unicode] message_samples: Message samples + :param bool has_embedded_links: Indicate that this SMS campaign will send messages that contain links + :param bool has_embedded_phone: Indicates that this SMS campaign will send messages that contain phone numbers + :param unicode messaging_service_sid: MessagingService SID + + :returns: The created CampaignInstance + :rtype: twilio.rest.messaging.v1.campaign.CampaignInstance + """ + data = values.of({ + 'BrandRegistrationSid': brand_registration_sid, + 'UseCase': use_case, + 'Description': description, + 'MessageSamples': serialize.map(message_samples, lambda e: e), + 'HasEmbeddedLinks': has_embedded_links, + 'HasEmbeddedPhone': has_embedded_phone, + 'MessagingServiceSid': messaging_service_sid, + }) + + payload = self._version.create(method='POST', uri=self._uri, data=data, ) + + return CampaignInstance(self._version, payload, ) + + def get(self, sid): + """ + Constructs a CampaignContext + + :param sid: The SID that identifies the resource to fetch + + :returns: twilio.rest.messaging.v1.campaign.CampaignContext + :rtype: twilio.rest.messaging.v1.campaign.CampaignContext + """ + return CampaignContext(self._version, sid=sid, ) + + def __call__(self, sid): + """ + Constructs a CampaignContext + + :param sid: The SID that identifies the resource to fetch + + :returns: twilio.rest.messaging.v1.campaign.CampaignContext + :rtype: twilio.rest.messaging.v1.campaign.CampaignContext + """ + return CampaignContext(self._version, sid=sid, ) + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + return '' + + +class CampaignPage(Page): + """ PLEASE NOTE that this class contains beta products that are subject to + change. Use them with caution. """ + + def __init__(self, version, response, solution): + """ + Initialize the CampaignPage + + :param Version version: Version that contains the resource + :param Response response: Response from the API + + :returns: twilio.rest.messaging.v1.campaign.CampaignPage + :rtype: twilio.rest.messaging.v1.campaign.CampaignPage + """ + super(CampaignPage, self).__init__(version, response) + + # Path Solution + self._solution = solution + + def get_instance(self, payload): + """ + Build an instance of CampaignInstance + + :param dict payload: Payload response from the API + + :returns: twilio.rest.messaging.v1.campaign.CampaignInstance + :rtype: twilio.rest.messaging.v1.campaign.CampaignInstance + """ + return CampaignInstance(self._version, payload, ) + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + return '' + + +class CampaignContext(InstanceContext): + """ PLEASE NOTE that this class contains beta products that are subject to + change. Use them with caution. """ + + def __init__(self, version, sid): + """ + Initialize the CampaignContext + + :param Version version: Version that contains the resource + :param sid: The SID that identifies the resource to fetch + + :returns: twilio.rest.messaging.v1.campaign.CampaignContext + :rtype: twilio.rest.messaging.v1.campaign.CampaignContext + """ + super(CampaignContext, self).__init__(version) + + # Path Solution + self._solution = {'sid': sid, } + self._uri = '/a2p/Campaigns/{sid}'.format(**self._solution) + + def fetch(self): + """ + Fetch the CampaignInstance + + :returns: The fetched CampaignInstance + :rtype: twilio.rest.messaging.v1.campaign.CampaignInstance + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + + return CampaignInstance(self._version, payload, sid=self._solution['sid'], ) + + def delete(self): + """ + Deletes the CampaignInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=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 CampaignInstance(InstanceResource): + """ PLEASE NOTE that this class contains beta products that are subject to + change. Use them with caution. """ + + class Status(object): + APPROVED = "approved" + PENDING = "pending" + FAILED = "failed" + + def __init__(self, version, payload, sid=None): + """ + Initialize the CampaignInstance + + :returns: twilio.rest.messaging.v1.campaign.CampaignInstance + :rtype: twilio.rest.messaging.v1.campaign.CampaignInstance + """ + super(CampaignInstance, self).__init__(version) + + # Marshaled Properties + self._properties = { + 'account_sid': payload.get('account_sid'), + 'messaging_service_sid': payload.get('messaging_service_sid'), + 'brand_registration_sid': payload.get('brand_registration_sid'), + 'sid': payload.get('sid'), + 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), + 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), + 'description': payload.get('description'), + 'message_samples': payload.get('message_samples'), + 'status': payload.get('status'), + 'failure_reason': payload.get('failure_reason'), + 'use_case': payload.get('use_case'), + 'has_embedded_links': payload.get('has_embedded_links'), + 'has_embedded_phone': payload.get('has_embedded_phone'), + 'url': payload.get('url'), + } + + # 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: CampaignContext for this CampaignInstance + :rtype: twilio.rest.messaging.v1.campaign.CampaignContext + """ + if self._context is None: + self._context = CampaignContext(self._version, sid=self._solution['sid'], ) + return self._context + + @property + def account_sid(self): + """ + :returns: The SID of the Account that created the resource + :rtype: unicode + """ + return self._properties['account_sid'] + + @property + def messaging_service_sid(self): + """ + :returns: MessagingService SID + :rtype: unicode + """ + return self._properties['messaging_service_sid'] + + @property + def brand_registration_sid(self): + """ + :returns: A2P BrandRegistration Sid + :rtype: unicode + """ + return self._properties['brand_registration_sid'] + + @property + def sid(self): + """ + :returns: Campaign sid + :rtype: unicode + """ + return self._properties['sid'] + + @property + def date_created(self): + """ + :returns: The ISO 8601 date and time in GMT when the resource was created + :rtype: datetime + """ + return self._properties['date_created'] + + @property + def date_updated(self): + """ + :returns: The ISO 8601 date and time in GMT when the resource was last updated + :rtype: datetime + """ + return self._properties['date_updated'] + + @property + def description(self): + """ + :returns: A short description of what this SMS campaign does + :rtype: unicode + """ + return self._properties['description'] + + @property + def message_samples(self): + """ + :returns: Message samples + :rtype: list[unicode] + """ + return self._properties['message_samples'] + + @property + def status(self): + """ + :returns: Campaign status + :rtype: CampaignInstance.Status + """ + return self._properties['status'] + + @property + def failure_reason(self): + """ + :returns: A reason why campaign registration has failed + :rtype: unicode + """ + return self._properties['failure_reason'] + + @property + def use_case(self): + """ + :returns: A2P Campaign UseCase. + :rtype: unicode + """ + return self._properties['use_case'] + + @property + def has_embedded_links(self): + """ + :returns: Indicate that this SMS campaign will send messages that contain links + :rtype: bool + """ + return self._properties['has_embedded_links'] + + @property + def has_embedded_phone(self): + """ + :returns: Indicates that this SMS campaign will send messages that contain phone numbers + :rtype: bool + """ + return self._properties['has_embedded_phone'] + + @property + def url(self): + """ + :returns: The absolute URL of the Campaign resource + :rtype: unicode + """ + return self._properties['url'] + + def fetch(self): + """ + Fetch the CampaignInstance + + :returns: The fetched CampaignInstance + :rtype: twilio.rest.messaging.v1.campaign.CampaignInstance + """ + return self._proxy.fetch() + + def delete(self): + """ + Deletes the CampaignInstance + + :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/messaging/v1/use_case.py b/twilio/rest/messaging/v1/use_case.py new file mode 100644 index 0000000000..e5367ed254 --- /dev/null +++ b/twilio/rest/messaging/v1/use_case.py @@ -0,0 +1,216 @@ +# coding=utf-8 +r""" +This code was generated by +\ / _ _ _| _ _ + | (_)\/(_)(_|\/| |(/_ v1.0.0 + / / +""" + +from twilio.base import values +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.page import Page + + +class UseCaseList(ListResource): + """ PLEASE NOTE that this class contains beta products that are subject to + change. Use them with caution. """ + + def __init__(self, version): + """ + Initialize the UseCaseList + + :param Version version: Version that contains the resource + + :returns: twilio.rest.messaging.v1.use_case.UseCaseList + :rtype: twilio.rest.messaging.v1.use_case.UseCaseList + """ + super(UseCaseList, self).__init__(version) + + # Path Solution + self._solution = {} + self._uri = '/a2p/UseCases'.format(**self._solution) + + def stream(self, limit=None, page_size=None): + """ + Streams UseCaseInstance 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.messaging.v1.use_case.UseCaseInstance] + """ + limits = self._version.read_limits(limit, page_size) + + page = self.page(page_size=limits['page_size'], ) + + return self._version.stream(page, limits['limit']) + + def list(self, limit=None, page_size=None): + """ + Lists UseCaseInstance 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.messaging.v1.use_case.UseCaseInstance] + """ + 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 UseCaseInstance 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 UseCaseInstance + :rtype: twilio.rest.messaging.v1.use_case.UseCasePage + """ + data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) + + response = self._version.page(method='GET', uri=self._uri, params=data, ) + + return UseCasePage(self._version, response, self._solution) + + def get_page(self, target_url): + """ + Retrieve a specific page of UseCaseInstance records from the API. + Request is executed immediately + + :param str target_url: API-generated URL for the requested results page + + :returns: Page of UseCaseInstance + :rtype: twilio.rest.messaging.v1.use_case.UseCasePage + """ + response = self._version.domain.twilio.request( + 'GET', + target_url, + ) + + return UseCasePage(self._version, response, self._solution) + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + return '' + + +class UseCasePage(Page): + """ PLEASE NOTE that this class contains beta products that are subject to + change. Use them with caution. """ + + def __init__(self, version, response, solution): + """ + Initialize the UseCasePage + + :param Version version: Version that contains the resource + :param Response response: Response from the API + + :returns: twilio.rest.messaging.v1.use_case.UseCasePage + :rtype: twilio.rest.messaging.v1.use_case.UseCasePage + """ + super(UseCasePage, self).__init__(version, response) + + # Path Solution + self._solution = solution + + def get_instance(self, payload): + """ + Build an instance of UseCaseInstance + + :param dict payload: Payload response from the API + + :returns: twilio.rest.messaging.v1.use_case.UseCaseInstance + :rtype: twilio.rest.messaging.v1.use_case.UseCaseInstance + """ + return UseCaseInstance(self._version, payload, ) + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + return '' + + +class UseCaseInstance(InstanceResource): + """ PLEASE NOTE that this class contains beta products that are subject to + change. Use them with caution. """ + + def __init__(self, version, payload): + """ + Initialize the UseCaseInstance + + :returns: twilio.rest.messaging.v1.use_case.UseCaseInstance + :rtype: twilio.rest.messaging.v1.use_case.UseCaseInstance + """ + super(UseCaseInstance, self).__init__(version) + + # Marshaled Properties + self._properties = { + 'name': payload.get('name'), + 'code': payload.get('code'), + 'description': payload.get('description'), + } + + # Context + self._context = None + self._solution = {} + + @property + def name(self): + """ + :returns: Human readable name + :rtype: unicode + """ + return self._properties['name'] + + @property + def code(self): + """ + :returns: Unique Use Case code + :rtype: unicode + """ + return self._properties['code'] + + @property + def description(self): + """ + :returns: Description of Use Case + :rtype: unicode + """ + return self._properties['description'] + + def __repr__(self): + """ + Provide a friendly representation + + :returns: Machine friendly representation + :rtype: str + """ + return '' diff --git a/twilio/rest/preview/sync/service/document/__init__.py b/twilio/rest/preview/sync/service/document/__init__.py index 731e9d1568..5f40b4f725 100644 --- a/twilio/rest/preview/sync/service/document/__init__.py +++ b/twilio/rest/preview/sync/service/document/__init__.py @@ -245,18 +245,14 @@ def fetch(self): sid=self._solution['sid'], ) - def delete(self, if_match=values.unset): + def delete(self): """ Deletes the DocumentInstance - :param unicode if_match: The If-Match HTTP request header - :returns: True if delete succeeds, False otherwise :rtype: bool """ - headers = values.of({'If-Match': if_match, }) - - return self._version.delete(method='DELETE', uri=self._uri, headers=headers, ) + return self._version.delete(method='DELETE', uri=self._uri, ) def update(self, data, if_match=values.unset): """ @@ -454,16 +450,14 @@ def fetch(self): """ return self._proxy.fetch() - def delete(self, if_match=values.unset): + def delete(self): """ Deletes the DocumentInstance - :param unicode if_match: The If-Match HTTP request header - :returns: True if delete succeeds, False otherwise :rtype: bool """ - return self._proxy.delete(if_match=if_match, ) + return self._proxy.delete() def update(self, data, if_match=values.unset): """ diff --git a/twilio/rest/serverless/v1/service/build/__init__.py b/twilio/rest/serverless/v1/service/build/__init__.py index 3b0e5c1849..8e7b2eba23 100644 --- a/twilio/rest/serverless/v1/service/build/__init__.py +++ b/twilio/rest/serverless/v1/service/build/__init__.py @@ -114,13 +114,14 @@ def get_page(self, target_url): return BuildPage(self._version, response, self._solution) def create(self, asset_versions=values.unset, function_versions=values.unset, - dependencies=values.unset): + dependencies=values.unset, runtime=values.unset): """ Create the BuildInstance :param list[unicode] asset_versions: The list of Asset Version resource SIDs to include in the Build :param list[unicode] function_versions: The list of the Function Version resource SIDs to include in the Build :param unicode dependencies: A list of objects that describe the Dependencies included in the Build + :param unicode runtime: The Runtime version that will be used to run the Build. :returns: The created BuildInstance :rtype: twilio.rest.serverless.v1.service.build.BuildInstance @@ -129,6 +130,7 @@ def create(self, asset_versions=values.unset, function_versions=values.unset, 'AssetVersions': serialize.map(asset_versions, lambda e: e), 'FunctionVersions': serialize.map(function_versions, lambda e: e), 'Dependencies': dependencies, + 'Runtime': runtime, }) payload = self._version.create(method='POST', uri=self._uri, data=data, ) @@ -293,6 +295,11 @@ class Status(object): COMPLETED = "completed" FAILED = "failed" + class Runtime(object): + NODE8 = "node8" + NODE10 = "node10" + NODE12 = "node12" + def __init__(self, version, payload, service_sid, sid=None): """ Initialize the BuildInstance @@ -311,6 +318,7 @@ def __init__(self, version, payload, service_sid, sid=None): 'asset_versions': payload.get('asset_versions'), 'function_versions': payload.get('function_versions'), 'dependencies': payload.get('dependencies'), + 'runtime': payload.get('runtime'), 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), 'url': payload.get('url'), @@ -394,6 +402,14 @@ def dependencies(self): """ return self._properties['dependencies'] + @property + def runtime(self): + """ + :returns: The Runtime version that will be used to run the Build. + :rtype: BuildInstance.Runtime + """ + return self._properties['runtime'] + @property def date_created(self): """ diff --git a/twilio/rest/studio/__init__.py b/twilio/rest/studio/__init__.py index f2a6b82d18..b54999d003 100644 --- a/twilio/rest/studio/__init__.py +++ b/twilio/rest/studio/__init__.py @@ -51,9 +51,9 @@ def v2(self): @property def flows(self): """ - :rtype: twilio.rest.studio.v1.flow.FlowList + :rtype: twilio.rest.studio.v2.flow.FlowList """ - return self.v1.flows + return self.v2.flows @property def flow_validate(self): diff --git a/twilio/rest/supersim/v1/fleet.py b/twilio/rest/supersim/v1/fleet.py index 5101d8ad59..bf4718a302 100644 --- a/twilio/rest/supersim/v1/fleet.py +++ b/twilio/rest/supersim/v1/fleet.py @@ -45,7 +45,7 @@ def create(self, network_access_profile, unique_name=values.unset, :param bool data_enabled: Defines whether SIMs in the Fleet are capable of using data connectivity :param unicode data_limit: The total data usage (download and upload combined) in Megabytes that each Sim resource assigned to the Fleet resource can consume :param bool commands_enabled: Defines whether SIMs in the Fleet are capable of sending and receiving machine-to-machine SMS via Commands - :param unicode commands_url: The URL that will receive a webhook when a SIM in the Fleet is used to send an SMS from your device (mobile originated) to the Commands number + :param unicode commands_url: The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the Commands number :param unicode commands_method: A string representing the HTTP method to use when making a request to `commands_url` :returns: The created FleetInstance @@ -265,7 +265,7 @@ def update(self, unique_name=values.unset, network_access_profile=values.unset, :param unicode unique_name: An application-defined string that uniquely identifies the resource :param unicode network_access_profile: The SID or unique name of the Network Access Profile of the Fleet - :param unicode commands_url: The URL that will receive a webhook when a SIM in the Fleet is used to send an SMS from your device (mobile originated) to the Commands number + :param unicode commands_url: The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the Commands number :param unicode commands_method: A string representing the HTTP method to use when making a request to `commands_url` :returns: The updated FleetInstance @@ -426,7 +426,7 @@ def commands_enabled(self): @property def commands_url(self): """ - :returns: The URL that will receive a webhook when a SIM in the Fleet is used to send an SMS from your device (mobile originated) to the Commands number + :returns: The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the Commands number :rtype: unicode """ return self._properties['commands_url'] @@ -463,7 +463,7 @@ def update(self, unique_name=values.unset, network_access_profile=values.unset, :param unicode unique_name: An application-defined string that uniquely identifies the resource :param unicode network_access_profile: The SID or unique name of the Network Access Profile of the Fleet - :param unicode commands_url: The URL that will receive a webhook when a SIM in the Fleet is used to send an SMS from your device (mobile originated) to the Commands number + :param unicode commands_url: The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the Commands number :param unicode commands_method: A string representing the HTTP method to use when making a request to `commands_url` :returns: The updated FleetInstance diff --git a/twilio/rest/sync/v1/service/__init__.py b/twilio/rest/sync/v1/service/__init__.py index 9650e9b651..c5e7cf5a6c 100644 --- a/twilio/rest/sync/v1/service/__init__.py +++ b/twilio/rest/sync/v1/service/__init__.py @@ -19,8 +19,6 @@ class ServiceList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version): """ @@ -180,8 +178,6 @@ def __repr__(self): class ServicePage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, response, solution): """ @@ -220,8 +216,6 @@ def __repr__(self): class ServiceContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, sid): """ @@ -358,8 +352,6 @@ def __repr__(self): class ServiceInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, payload, sid=None): """ diff --git a/twilio/rest/sync/v1/service/document/__init__.py b/twilio/rest/sync/v1/service/document/__init__.py index e82831b51f..9e8e3a4652 100644 --- a/twilio/rest/sync/v1/service/document/__init__.py +++ b/twilio/rest/sync/v1/service/document/__init__.py @@ -17,8 +17,6 @@ class DocumentList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, service_sid): """ @@ -163,8 +161,6 @@ def __repr__(self): class DocumentPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, response, solution): """ @@ -204,8 +200,6 @@ def __repr__(self): class DocumentContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, service_sid, sid): """ @@ -243,18 +237,14 @@ def fetch(self): sid=self._solution['sid'], ) - def delete(self, if_match=values.unset): + def delete(self): """ Deletes the DocumentInstance - :param unicode if_match: The If-Match HTTP request header - :returns: True if delete succeeds, False otherwise :rtype: bool """ - headers = values.of({'If-Match': if_match, }) - - return self._version.delete(method='DELETE', uri=self._uri, headers=headers, ) + return self._version.delete(method='DELETE', uri=self._uri, ) def update(self, data=values.unset, ttl=values.unset, if_match=values.unset): """ @@ -307,8 +297,6 @@ def __repr__(self): class DocumentInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, payload, service_sid, sid=None): """ @@ -461,16 +449,14 @@ def fetch(self): """ return self._proxy.fetch() - def delete(self, if_match=values.unset): + def delete(self): """ Deletes the DocumentInstance - :param unicode if_match: The If-Match HTTP request header - :returns: True if delete succeeds, False otherwise :rtype: bool """ - return self._proxy.delete(if_match=if_match, ) + return self._proxy.delete() def update(self, data=values.unset, ttl=values.unset, if_match=values.unset): """ diff --git a/twilio/rest/sync/v1/service/document/document_permission.py b/twilio/rest/sync/v1/service/document/document_permission.py index 2a0c0d2d86..ba70c2618e 100644 --- a/twilio/rest/sync/v1/service/document/document_permission.py +++ b/twilio/rest/sync/v1/service/document/document_permission.py @@ -14,8 +14,6 @@ class DocumentPermissionList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, service_sid, document_sid): """ @@ -154,8 +152,6 @@ def __repr__(self): class DocumentPermissionPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, response, solution): """ @@ -201,8 +197,6 @@ def __repr__(self): class DocumentPermissionContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, service_sid, document_sid, identity): """ @@ -283,8 +277,6 @@ def __repr__(self): class DocumentPermissionInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, payload, service_sid, document_sid, identity=None): """ diff --git a/twilio/rest/sync/v1/service/sync_list/__init__.py b/twilio/rest/sync/v1/service/sync_list/__init__.py index 78359ad825..5f14f6e8f0 100644 --- a/twilio/rest/sync/v1/service/sync_list/__init__.py +++ b/twilio/rest/sync/v1/service/sync_list/__init__.py @@ -17,8 +17,6 @@ class SyncListList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, service_sid): """ @@ -164,8 +162,6 @@ def __repr__(self): class SyncListPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, response, solution): """ @@ -205,8 +201,6 @@ def __repr__(self): class SyncListContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, service_sid, sid): """ @@ -319,8 +313,6 @@ def __repr__(self): class SyncListInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, payload, service_sid, sid=None): """ diff --git a/twilio/rest/sync/v1/service/sync_list/sync_list_item.py b/twilio/rest/sync/v1/service/sync_list/sync_list_item.py index 090aa336e0..3c1c26d7e4 100644 --- a/twilio/rest/sync/v1/service/sync_list/sync_list_item.py +++ b/twilio/rest/sync/v1/service/sync_list/sync_list_item.py @@ -16,8 +16,6 @@ class SyncListItemList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, service_sid, list_sid): """ @@ -204,8 +202,6 @@ def __repr__(self): class SyncListItemPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, response, solution): """ @@ -251,8 +247,6 @@ def __repr__(self): class SyncListItemContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, service_sid, list_sid, index): """ @@ -346,8 +340,6 @@ def __repr__(self): class SyncListItemInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ class QueryResultOrder(object): ASC = "asc" diff --git a/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py b/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py index c6dff7707c..05b3192b8b 100644 --- a/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py +++ b/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py @@ -14,8 +14,6 @@ class SyncListPermissionList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, service_sid, list_sid): """ @@ -154,8 +152,6 @@ def __repr__(self): class SyncListPermissionPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, response, solution): """ @@ -201,8 +197,6 @@ def __repr__(self): class SyncListPermissionContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, service_sid, list_sid, identity): """ @@ -283,8 +277,6 @@ def __repr__(self): class SyncListPermissionInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, payload, service_sid, list_sid, identity=None): """ diff --git a/twilio/rest/sync/v1/service/sync_map/__init__.py b/twilio/rest/sync/v1/service/sync_map/__init__.py index 6eaa6620f2..3187566862 100644 --- a/twilio/rest/sync/v1/service/sync_map/__init__.py +++ b/twilio/rest/sync/v1/service/sync_map/__init__.py @@ -17,8 +17,6 @@ class SyncMapList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, service_sid): """ @@ -164,8 +162,6 @@ def __repr__(self): class SyncMapPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, response, solution): """ @@ -205,8 +201,6 @@ def __repr__(self): class SyncMapContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, service_sid, sid): """ @@ -319,8 +313,6 @@ def __repr__(self): class SyncMapInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, payload, service_sid, sid=None): """ diff --git a/twilio/rest/sync/v1/service/sync_map/sync_map_item.py b/twilio/rest/sync/v1/service/sync_map/sync_map_item.py index 707e2a7d1d..41baa916ff 100644 --- a/twilio/rest/sync/v1/service/sync_map/sync_map_item.py +++ b/twilio/rest/sync/v1/service/sync_map/sync_map_item.py @@ -16,8 +16,6 @@ class SyncMapItemList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, service_sid, map_sid): """ @@ -206,8 +204,6 @@ def __repr__(self): class SyncMapItemPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, response, solution): """ @@ -253,8 +249,6 @@ def __repr__(self): class SyncMapItemContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, service_sid, map_sid, key): """ @@ -348,8 +342,6 @@ def __repr__(self): class SyncMapItemInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ class QueryResultOrder(object): ASC = "asc" diff --git a/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py b/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py index fe487b884d..a3e2a8b58a 100644 --- a/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py +++ b/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py @@ -14,8 +14,6 @@ class SyncMapPermissionList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, service_sid, map_sid): """ @@ -154,8 +152,6 @@ def __repr__(self): class SyncMapPermissionPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, response, solution): """ @@ -201,8 +197,6 @@ def __repr__(self): class SyncMapPermissionContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, service_sid, map_sid, identity): """ @@ -283,8 +277,6 @@ def __repr__(self): class SyncMapPermissionInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, payload, service_sid, map_sid, identity=None): """ diff --git a/twilio/rest/sync/v1/service/sync_stream/__init__.py b/twilio/rest/sync/v1/service/sync_stream/__init__.py index 4d8ed0d0eb..9f59826558 100644 --- a/twilio/rest/sync/v1/service/sync_stream/__init__.py +++ b/twilio/rest/sync/v1/service/sync_stream/__init__.py @@ -16,8 +16,6 @@ class SyncStreamList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, service_sid): """ @@ -161,8 +159,6 @@ def __repr__(self): class SyncStreamPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, response, solution): """ @@ -202,8 +198,6 @@ def __repr__(self): class SyncStreamContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, service_sid, sid): """ @@ -298,8 +292,6 @@ def __repr__(self): class SyncStreamInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, payload, service_sid, sid=None): """ diff --git a/twilio/rest/sync/v1/service/sync_stream/stream_message.py b/twilio/rest/sync/v1/service/sync_stream/stream_message.py index b2a155e469..460fc00400 100644 --- a/twilio/rest/sync/v1/service/sync_stream/stream_message.py +++ b/twilio/rest/sync/v1/service/sync_stream/stream_message.py @@ -14,8 +14,6 @@ class StreamMessageList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, service_sid, stream_sid): """ @@ -65,8 +63,6 @@ def __repr__(self): class StreamMessagePage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, response, solution): """ @@ -112,8 +108,6 @@ def __repr__(self): class StreamMessageInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ def __init__(self, version, payload, service_sid, stream_sid): """ diff --git a/twilio/twiml/voice_response.py b/twilio/twiml/voice_response.py index 817a67a1be..c8749fd83c 100644 --- a/twilio/twiml/voice_response.py +++ b/twilio/twiml/voice_response.py @@ -38,7 +38,8 @@ def dial(self, number=None, action=None, method=None, timeout=None, trim=None, recording_status_callback=None, recording_status_callback_method=None, recording_status_callback_event=None, answer_on_bridge=None, - ring_tone=None, recording_track=None, sequential=None, **kwargs): + ring_tone=None, recording_track=None, sequential=None, refer_url=None, + refer_method=None, **kwargs): """ Create a element @@ -58,6 +59,8 @@ def dial(self, number=None, action=None, method=None, timeout=None, :param ring_tone: Ringtone allows you to override the ringback tone that Twilio will play back to the caller while executing the Dial :param recording_track: To indicate which audio track should be recorded :param sequential: Used to determine if child TwiML nouns should be dialed in order, one after the other (sequential) or dial all at once (parallel). Default is false, parallel + :param refer_url: Webhook that will receive future SIP REFER requests + :param refer_method: The HTTP method to use for the refer Webhook :param kwargs: additional attributes :returns: element @@ -79,6 +82,8 @@ def dial(self, number=None, action=None, method=None, timeout=None, ring_tone=ring_tone, recording_track=recording_track, sequential=sequential, + refer_url=refer_url, + refer_method=refer_method, **kwargs ))