Skip to content

Commit 7ac9607

Browse files
committed
[Librarian] Regenerated @ 063fefeb406fa3d6866703c240040a1e9146ca75
1 parent d420607 commit 7ac9607

20 files changed

+1547
-12
lines changed

CHANGES.md

+12
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@ twilio-python Changelog
33

44
Here you can see the full list of changes between each twilio-python release.
55

6+
[2023-03-22] Version 7.17.0
7+
---------------------------
8+
**Api**
9+
- Revert Corrected the data type for `friendly_name` in Available Phone Number Local, Mobile and TollFree resources
10+
- Corrected the data type for `friendly_name` in Available Phone Number Local, Mobile and TollFree resources **(breaking change)**
11+
12+
**Messaging**
13+
- Add `linkshortening_messaging_service` resource
14+
- Add new endpoint for GetDomainConfigByMessagingServiceSid
15+
- Remove `validated` parameter and add `cert_in_validation` parameter to Link Shortening API **(breaking change)**
16+
17+
618
[2023-03-09] Version 7.16.5
719
---------------------------
820
**Api**

tests/integration/content/v1/content/test_approval_fetch.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ def test_get_approval_response(self):
3838
"name": "tree_fiddy",
3939
"category": "ACCOUNT_UPDATE",
4040
"content_type": "twilio/location",
41-
"status": "unsubmitted",
42-
"rejection_reason": ""
41+
"status": "approved",
42+
"rejection_reason": "",
43+
"allow_category_change": true
4344
},
4445
"url": "https://content.twilio.com/v1/Content/HXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ApprovalRequests"
4546
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# coding=utf-8
2+
r"""
3+
This code was generated by
4+
\ / _ _ _| _ _
5+
| (_)\/(_)(_|\/| |(/_ v1.0.0
6+
/ /
7+
"""
8+
9+
from tests import IntegrationTestCase
10+
from tests.holodeck import Request
11+
from twilio.base.exceptions import TwilioException
12+
from twilio.http.response import Response
13+
14+
15+
class ContentAndApprovalsTestCase(IntegrationTestCase):
16+
17+
def test_list_request(self):
18+
self.holodeck.mock(Response(500, ''))
19+
20+
with self.assertRaises(TwilioException):
21+
self.client.content.v1.content_and_approvals.list()
22+
23+
self.holodeck.assert_has_request(Request(
24+
'get',
25+
'https://content.twilio.com/v1/ContentAndApprovals',
26+
))
27+
28+
def test_read_empty_response(self):
29+
self.holodeck.mock(Response(
30+
200,
31+
'''
32+
{
33+
"contents": [],
34+
"meta": {
35+
"page": 0,
36+
"page_size": 10,
37+
"first_page_url": "https://content.twilio.com/v1/ContentAndApprovals?PageSize=10&Page=0",
38+
"previous_page_url": null,
39+
"next_page_url": null,
40+
"url": "https://content.twilio.com/v1/ContentAndApprovals?PageSize=10&Page=0",
41+
"key": "contents"
42+
}
43+
}
44+
'''
45+
))
46+
47+
actual = self.client.content.v1.content_and_approvals.list()
48+
49+
self.assertIsNotNone(actual)
50+
51+
def test_read_results_response(self):
52+
self.holodeck.mock(Response(
53+
200,
54+
'''
55+
{
56+
"contents": [
57+
{
58+
"date_created": "2015-07-30T19:00:00Z",
59+
"date_updated": "2015-07-30T19:00:00Z",
60+
"sid": "HXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
61+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
62+
"friendly_name": "Some content",
63+
"language": "en",
64+
"variables": {
65+
"name": "foo"
66+
},
67+
"types": {
68+
"twilio/text": {
69+
"body": "Foo Bar Co is located at 39.7392, 104.9903"
70+
},
71+
"twilio/location": {
72+
"longitude": 104.9903,
73+
"latitude": 39.7392,
74+
"label": "Foo Bar Co"
75+
}
76+
},
77+
"approval_requests": {
78+
"name": "",
79+
"category": "",
80+
"content_type": "",
81+
"status": "unsubmitted",
82+
"rejection_reason": "",
83+
"allow_category_change": true
84+
}
85+
},
86+
{
87+
"language": "en",
88+
"date_updated": "2023-01-13T23:33:46Z",
89+
"variables": {
90+
"1": "name",
91+
"2": "typedocument"
92+
},
93+
"friendly_name": "Media Test",
94+
"account_sid": "AC25c0d4b9093547216c460212e24e77ee",
95+
"sid": "HX5fcd48a417c1cb59da349ad6d5da4607",
96+
"date_created": "2023-01-13T23:33:46Z",
97+
"types": {
98+
"twilio/media": {
99+
"body": "{{1}}, Congratulations {{2}}! For additional assistance, please contact us at [email protected]",
100+
"media": [
101+
"https://example.com/template"
102+
]
103+
}
104+
},
105+
"approval_requests": {
106+
"category": "TRANSACTIONAL",
107+
"status": "approved",
108+
"rejection_reason": "",
109+
"name": "Media Test",
110+
"content_type": "twilio/media",
111+
"allow_category_change": false
112+
}
113+
},
114+
{
115+
"language": "en",
116+
"date_updated": "2023-01-18T02:46:35Z",
117+
"variables": {
118+
"1": "name",
119+
"2": "type_video",
120+
"3": "small.mp4"
121+
},
122+
"friendly_name": "Video Highlights",
123+
"account_sid": "AC25c0d4b9093547216c460212e24e77ee",
124+
"sid": "HX15c711fcc6d9ea5268d7ab77938a20ff",
125+
"date_created": "2023-01-18T02:46:35Z",
126+
"types": {
127+
"twilio/media": {
128+
"body": "Hi there, {{1}}, we have received your request to upload {{2}}, and should be uploaded shortly.",
129+
"media": [
130+
"http://example.com/highlights/{{3}}"
131+
]
132+
}
133+
},
134+
"approval_requests": {
135+
"category": "TRANSACTIONAL",
136+
"status": "rejected",
137+
"rejection_reason": "INVALID_FORMAT. Facebook is not able to create template with templateName=Video Highlights_hx15c711fcc6d9ea5268d7ab77938a20ff due to the following error: Invalid parameter. More Details: Message template 'components' param is missing expected field(s). component of type HEADER is missing expected field(s) (example)",
138+
"name": "Video Highlights",
139+
"content_type": "twilio/media",
140+
"allow_category_change": true
141+
}
142+
}
143+
],
144+
"meta": {
145+
"page": 0,
146+
"page_size": 20,
147+
"first_page_url": "https://content.twilio.com/v1/ContentAndApprovals?PageSize=20&Page=0",
148+
"url": "https://content.twilio.com/v1/ContentAndApprovals?PageSize=20&Page=0",
149+
"previous_page_url": null,
150+
"next_page_url": null,
151+
"key": "contents"
152+
}
153+
}
154+
'''
155+
))
156+
157+
actual = self.client.content.v1.content_and_approvals.list()
158+
159+
self.assertIsNotNone(actual)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# coding=utf-8
2+
r"""
3+
This code was generated by
4+
\ / _ _ _| _ _
5+
| (_)\/(_)(_|\/| |(/_ v1.0.0
6+
/ /
7+
"""
8+
9+
from tests import IntegrationTestCase
10+
from tests.holodeck import Request
11+
from twilio.base.exceptions import TwilioException
12+
from twilio.http.response import Response
13+
14+
15+
class InsightsConversationsTestCase(IntegrationTestCase):
16+
17+
def test_list_request(self):
18+
self.holodeck.mock(Response(500, ''))
19+
20+
with self.assertRaises(TwilioException):
21+
self.client.flex_api.v1.insights_conversations.list(token="token")
22+
23+
headers = {'Token': "token", }
24+
self.holodeck.assert_has_request(Request(
25+
'get',
26+
'https://flex-api.twilio.com/v1/Insights/Conversations',
27+
headers=headers,
28+
))
29+
30+
def test_read_empty_response(self):
31+
self.holodeck.mock(Response(
32+
200,
33+
'''
34+
{
35+
"conversations": [],
36+
"meta": {
37+
"page": 0,
38+
"page_size": 50,
39+
"first_page_url": "https://flex-api.twilio.com/v1/Insights/Conversations?SegmentId=02dd8a65-c9e3-550b-9e98-5b11abb9b3a4&PageSize=50&Page=0",
40+
"previous_page_url": null,
41+
"url": "https://flex-api.twilio.com/v1/Insights/Conversations?SegmentId=02dd8a65-c9e3-550b-9e98-5b11abb9b3a4&PageSize=50&Page=0",
42+
"next_page_url": null,
43+
"key": "conversations"
44+
}
45+
}
46+
'''
47+
))
48+
49+
actual = self.client.flex_api.v1.insights_conversations.list()
50+
51+
self.assertIsNotNone(actual)
52+
53+
def test_read_full_response(self):
54+
self.holodeck.mock(Response(
55+
200,
56+
'''
57+
{
58+
"conversations": [
59+
{
60+
"account_id": "76e4c1c3-6f93-5d08-ae66-aad4b9092f2d",
61+
"conversation_id": "2cb2452a-c6d9-564d-b285-b5404f073031",
62+
"segment_count": 2,
63+
"segments": [
64+
{
65+
"segment_id": "02dd8a65-c9e3-550b-9e98-5b11abb9b3a4",
66+
"order": 0,
67+
"offset": 1.542,
68+
"talk_time": 18,
69+
"timestamp": "2022-05-11T16:02:27.659Z",
70+
"agent_name": "First Agent"
71+
},
72+
{
73+
"segment_id": "02dd8a65-c9e3-550b-9e98-5b11abb9b3a5",
74+
"order": 0,
75+
"offset": 1.211,
76+
"talk_time": 10,
77+
"timestamp": "2022-05-21T16:02:27.659Z",
78+
"agent_name": "Second Agent"
79+
}
80+
]
81+
}
82+
],
83+
"meta": {
84+
"page": 0,
85+
"page_size": 50,
86+
"first_page_url": "https://flex-api.twilio.com/v1/Insights/Conversations?SegmentId=02dd8a65-c9e3-550b-9e98-5b11abb9b3a4&PageSize=50&Page=0",
87+
"previous_page_url": null,
88+
"url": "https://flex-api.twilio.com/v1/Insights/Conversations?SegmentId=02dd8a65-c9e3-550b-9e98-5b11abb9b3a4&PageSize=50&Page=0",
89+
"next_page_url": null,
90+
"key": "conversations"
91+
}
92+
}
93+
'''
94+
))
95+
96+
actual = self.client.flex_api.v1.insights_conversations.list()
97+
98+
self.assertIsNotNone(actual)

tests/integration/lookups/v2/test_phone_number.py

+1
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,7 @@ def test_fetch_sms_pumping_risk_response(self):
539539
"number_blocked": false,
540540
"number_blocked_date": null,
541541
"number_blocked_last_3_months": null,
542+
"sms_pumping_risk_score": 61,
542543
"error_code": null
543544
},
544545
"disposable_phone_number_risk": null,

tests/integration/messaging/v1/test_domain_cert.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ def test_update_response(self):
4040
"date_created": "2021-02-06T18:02:04Z",
4141
"date_updated": "2021-02-06T18:02:04Z",
4242
"url": "https://messaging.twilio.com/v1/LinkShortening/Domains/DNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Certificate",
43-
"validated": true
43+
"cert_in_validation": {
44+
"date_expires": "2021-02-06T18:02:04Z",
45+
"status": "pending"
46+
}
4447
}
4548
'''
4649
))
@@ -57,11 +60,14 @@ def test_create_response(self):
5760
"certificate_sid": "CWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5861
"domain_name": "https://api.example.com",
5962
"domain_sid": "DNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
60-
"date_expires": "2021-02-06T18:02:04Z",
63+
"date_expires": null,
6164
"date_created": "2021-02-06T18:02:04Z",
6265
"date_updated": "2021-02-06T18:02:04Z",
6366
"url": "https://messaging.twilio.com/v1/LinkShortening/Domains/DNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Certificate",
64-
"validated": true
67+
"cert_in_validation": {
68+
"date_expires": "2021-02-06T18:02:04Z",
69+
"status": "pending"
70+
}
6571
}
6672
'''
6773
))
@@ -93,7 +99,10 @@ def test_fetch_response(self):
9399
"date_created": "2021-02-06T18:02:04Z",
94100
"date_updated": "2021-02-06T18:02:04Z",
95101
"url": "https://messaging.twilio.com/v1/LinkShortening/Domains/DNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Certificate",
96-
"validated": true
102+
"cert_in_validation": {
103+
"date_expires": "2021-02-06T18:02:04Z",
104+
"status": "pending"
105+
}
97106
}
98107
'''
99108
))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# coding=utf-8
2+
r"""
3+
This code was generated by
4+
\ / _ _ _| _ _
5+
| (_)\/(_)(_|\/| |(/_ v1.0.0
6+
/ /
7+
"""
8+
9+
from tests import IntegrationTestCase
10+
from tests.holodeck import Request
11+
from twilio.base.exceptions import TwilioException
12+
from twilio.http.response import Response
13+
14+
15+
class DomainConfigMessagingServiceTestCase(IntegrationTestCase):
16+
17+
def test_fetch_request(self):
18+
self.holodeck.mock(Response(500, ''))
19+
20+
with self.assertRaises(TwilioException):
21+
self.client.messaging.v1.domain_config_messaging_service("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()
22+
23+
self.holodeck.assert_has_request(Request(
24+
'get',
25+
'https://messaging.twilio.com/v1/LinkShortening/MessagingService/MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/DomainConfig',
26+
))
27+
28+
def test_fetch_response(self):
29+
self.holodeck.mock(Response(
30+
200,
31+
'''
32+
{
33+
"domain_sid": "DNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
34+
"config_sid": "ZKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
35+
"fallback_url": "https://www.example.com",
36+
"callback_url": "https://www.example.com",
37+
"date_created": "2015-07-30T20:00:00Z",
38+
"date_updated": "2015-07-30T20:00:00Z",
39+
"url": "https://messaging.twilio.com/v1/LinkShortening/MessagingService/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/DomainConfig",
40+
"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
41+
}
42+
'''
43+
))
44+
45+
actual = self.client.messaging.v1.domain_config_messaging_service("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()
46+
47+
self.assertIsNotNone(actual)

0 commit comments

Comments
 (0)