Skip to content

Commit ec1b6bf

Browse files
committed
[Librarian] Regenerated @ ca4a5892d2b6a6161860845fe1152af07920bc07 403073118470eabf87311669c7fea876d35ced04
1 parent 0b8aab4 commit ec1b6bf

File tree

506 files changed

+20008
-5625
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

506 files changed

+20008
-5625
lines changed

CHANGES.md

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ twilio-python Changelog
33

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

6+
[2024-12-12] Version 9.4.0
7+
--------------------------
8+
**Library - Feature**
9+
- [PR #825](https://github.com/twilio/twilio-python/pull/825): Docs update and examples for organization api uptake and public oauth. Thanks to [@AsabuHere](https://github.com/AsabuHere)!
10+
- [PR #815](https://github.com/twilio/twilio-python/pull/815): Organizations Api uptake for twilio-python. Thanks to [@AsabuHere](https://github.com/AsabuHere)!
11+
12+
613
[2024-12-05] Version 9.3.8
714
--------------------------
815
**Api**

examples/organization_api.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ def example():
1818
"""
1919
self.client = Client(
2020
account_sid=ACCOUNT_SID,
21-
credential_provider= OrgsCredentialProvider(CLIENT_ID,CLIENT_SECRET)
21+
credential_provider=OrgsCredentialProvider(CLIENT_ID, CLIENT_SECRET),
2222
)
2323

24-
accounts = self.client.preview_iam.organization(organization_sid=ORGS_SID).accounts.stream()
24+
accounts = self.client.preview_iam.organization(
25+
organization_sid=ORGS_SID
26+
).accounts.stream()
2527
for record in accounts:
2628
print(record)
2729

examples/public_oauth.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def example():
1919
"""
2020
self.client = Client(
2121
account_sid=ACCOUNT_SID,
22-
credential_provider= ClientCredentialProvider(CLIENT_ID,CLIENT_SECRET)
22+
credential_provider=ClientCredentialProvider(CLIENT_ID, CLIENT_SECRET),
2323
)
2424

2525
msg = self.client.messages.create(

twilio/rest/__init__.py

+15-17
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from twilio.rest.events import Events
2525
from twilio.rest.flex_api import FlexApi
2626
from twilio.rest.frontline_api import FrontlineApi
27+
from twilio.rest.preview_iam import PreviewIam
2728
from twilio.rest.iam import Iam
2829
from twilio.rest.insights import Insights
2930
from twilio.rest.intelligence import Intelligence
@@ -96,7 +97,6 @@ def __init__(
9697
environment=None,
9798
edge=None,
9899
user_agent_extensions=None,
99-
credential_provider=None,
100100
):
101101
"""
102102
Initializes the Twilio Client
@@ -122,7 +122,6 @@ def __init__(
122122
environment,
123123
edge,
124124
user_agent_extensions,
125-
credential_provider,
126125
)
127126

128127
# Domains
@@ -136,8 +135,8 @@ def __init__(
136135
self._events: Optional["Events"] = None
137136
self._flex_api: Optional["FlexApi"] = None
138137
self._frontline_api: Optional["FrontlineApi"] = None
139-
self._iam: Optional["Iam"] = None
140138
self._preview_iam: Optional["PreviewIam"] = None
139+
self._iam: Optional["Iam"] = None
141140
self._insights: Optional["Insights"] = None
142141
self._intelligence: Optional["Intelligence"] = None
143142
self._ip_messaging: Optional["IpMessaging"] = None
@@ -150,7 +149,6 @@ def __init__(
150149
self._numbers: Optional["Numbers"] = None
151150
self._oauth: Optional["Oauth"] = None
152151
self._preview: Optional["Preview"] = None
153-
self._preview_iam: Optional["PreviewIam"] = None
154152
self._pricing: Optional["Pricing"] = None
155153
self._proxy: Optional["Proxy"] = None
156154
self._routes: Optional["Routes"] = None
@@ -296,6 +294,19 @@ def frontline_api(self) -> "FrontlineApi":
296294
self._frontline_api = FrontlineApi(self)
297295
return self._frontline_api
298296

297+
@property
298+
def preview_iam(self) -> "PreviewIam":
299+
"""
300+
Access the PreviewIam Twilio Domain
301+
302+
:returns: PreviewIam Twilio Domain
303+
"""
304+
if self._preview_iam is None:
305+
from twilio.rest.preview_iam import PreviewIam
306+
307+
self._preview_iam = PreviewIam(self)
308+
return self._preview_iam
309+
299310
@property
300311
def iam(self) -> "Iam":
301312
"""
@@ -400,19 +411,6 @@ def microvisor(self) -> "Microvisor":
400411
self._microvisor = Microvisor(self)
401412
return self._microvisor
402413

403-
@property
404-
def preview_iam(self) -> "PreviewIam":
405-
"""
406-
Access the PreviewIam Twilio Domain
407-
408-
:returns: PreviewIam Twilio Domain
409-
"""
410-
if self._preview_iam is None:
411-
from twilio.rest.preview_iam import PreviewIam
412-
413-
self._preview_iam = PreviewIam(self)
414-
return self._preview_iam
415-
416414
@property
417415
def monitor(self) -> "Monitor":
418416
"""

twilio/rest/accounts/v1/auth_token_promotion.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,14 @@ def update(self) -> AuthTokenPromotionInstance:
106106
107107
:returns: The updated AuthTokenPromotionInstance
108108
"""
109+
109110
data = values.of({})
111+
headers = values.of({})
112+
113+
headers["Accept"] = "application/json"
110114

111115
payload = self._version.update(
112-
method="POST",
113-
uri=self._uri,
114-
data=data,
116+
method="POST", uri=self._uri, data=data, headers=headers
115117
)
116118

117119
return AuthTokenPromotionInstance(self._version, payload)
@@ -123,12 +125,14 @@ async def update_async(self) -> AuthTokenPromotionInstance:
123125
124126
:returns: The updated AuthTokenPromotionInstance
125127
"""
128+
126129
data = values.of({})
130+
headers = values.of({})
131+
132+
headers["Accept"] = "application/json"
127133

128134
payload = await self._version.update_async(
129-
method="POST",
130-
uri=self._uri,
131-
data=data,
135+
method="POST", uri=self._uri, data=data, headers=headers
132136
)
133137

134138
return AuthTokenPromotionInstance(self._version, payload)

twilio/rest/accounts/v1/bulk_consents.py

+8
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ def create(self, items: List[object]) -> BulkConsentsInstance:
6969
)
7070
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})
7171

72+
headers["Content-Type"] = "application/x-www-form-urlencoded"
73+
74+
headers["Accept"] = "application/json"
75+
7276
payload = self._version.create(
7377
method="POST", uri=self._uri, data=data, headers=headers
7478
)
@@ -91,6 +95,10 @@ async def create_async(self, items: List[object]) -> BulkConsentsInstance:
9195
)
9296
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})
9397

98+
headers["Content-Type"] = "application/x-www-form-urlencoded"
99+
100+
headers["Accept"] = "application/json"
101+
94102
payload = await self._version.create_async(
95103
method="POST", uri=self._uri, data=data, headers=headers
96104
)

twilio/rest/accounts/v1/bulk_contacts.py

+8
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ def create(self, items: List[object]) -> BulkContactsInstance:
6969
)
7070
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})
7171

72+
headers["Content-Type"] = "application/x-www-form-urlencoded"
73+
74+
headers["Accept"] = "application/json"
75+
7276
payload = self._version.create(
7377
method="POST", uri=self._uri, data=data, headers=headers
7478
)
@@ -91,6 +95,10 @@ async def create_async(self, items: List[object]) -> BulkContactsInstance:
9195
)
9296
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})
9397

98+
headers["Content-Type"] = "application/x-www-form-urlencoded"
99+
100+
headers["Accept"] = "application/json"
101+
94102
payload = await self._version.create_async(
95103
method="POST", uri=self._uri, data=data, headers=headers
96104
)

twilio/rest/accounts/v1/credential/aws.py

+52-20
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,10 @@ def delete(self) -> bool:
164164
165165
:returns: True if delete succeeds, False otherwise
166166
"""
167-
return self._version.delete(
168-
method="DELETE",
169-
uri=self._uri,
170-
)
167+
168+
headers = values.of({})
169+
170+
return self._version.delete(method="DELETE", uri=self._uri, headers=headers)
171171

172172
async def delete_async(self) -> bool:
173173
"""
@@ -176,9 +176,11 @@ async def delete_async(self) -> bool:
176176
177177
:returns: True if delete succeeds, False otherwise
178178
"""
179+
180+
headers = values.of({})
181+
179182
return await self._version.delete_async(
180-
method="DELETE",
181-
uri=self._uri,
183+
method="DELETE", uri=self._uri, headers=headers
182184
)
183185

184186
def fetch(self) -> AwsInstance:
@@ -189,10 +191,11 @@ def fetch(self) -> AwsInstance:
189191
:returns: The fetched AwsInstance
190192
"""
191193

192-
payload = self._version.fetch(
193-
method="GET",
194-
uri=self._uri,
195-
)
194+
headers = values.of({})
195+
196+
headers["Accept"] = "application/json"
197+
198+
payload = self._version.fetch(method="GET", uri=self._uri, headers=headers)
196199

197200
return AwsInstance(
198201
self._version,
@@ -208,9 +211,12 @@ async def fetch_async(self) -> AwsInstance:
208211
:returns: The fetched AwsInstance
209212
"""
210213

214+
headers = values.of({})
215+
216+
headers["Accept"] = "application/json"
217+
211218
payload = await self._version.fetch_async(
212-
method="GET",
213-
uri=self._uri,
219+
method="GET", uri=self._uri, headers=headers
214220
)
215221

216222
return AwsInstance(
@@ -227,16 +233,20 @@ def update(self, friendly_name: Union[str, object] = values.unset) -> AwsInstanc
227233
228234
:returns: The updated AwsInstance
229235
"""
236+
230237
data = values.of(
231238
{
232239
"FriendlyName": friendly_name,
233240
}
234241
)
242+
headers = values.of({})
243+
244+
headers["Content-Type"] = "application/x-www-form-urlencoded"
245+
246+
headers["Accept"] = "application/json"
235247

236248
payload = self._version.update(
237-
method="POST",
238-
uri=self._uri,
239-
data=data,
249+
method="POST", uri=self._uri, data=data, headers=headers
240250
)
241251

242252
return AwsInstance(self._version, payload, sid=self._solution["sid"])
@@ -251,16 +261,20 @@ async def update_async(
251261
252262
:returns: The updated AwsInstance
253263
"""
264+
254265
data = values.of(
255266
{
256267
"FriendlyName": friendly_name,
257268
}
258269
)
270+
headers = values.of({})
271+
272+
headers["Content-Type"] = "application/x-www-form-urlencoded"
273+
274+
headers["Accept"] = "application/json"
259275

260276
payload = await self._version.update_async(
261-
method="POST",
262-
uri=self._uri,
263-
data=data,
277+
method="POST", uri=self._uri, data=data, headers=headers
264278
)
265279

266280
return AwsInstance(self._version, payload, sid=self._solution["sid"])
@@ -332,6 +346,10 @@ def create(
332346
)
333347
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})
334348

349+
headers["Content-Type"] = "application/x-www-form-urlencoded"
350+
351+
headers["Accept"] = "application/json"
352+
335353
payload = self._version.create(
336354
method="POST", uri=self._uri, data=data, headers=headers
337355
)
@@ -363,6 +381,10 @@ async def create_async(
363381
)
364382
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})
365383

384+
headers["Content-Type"] = "application/x-www-form-urlencoded"
385+
386+
headers["Accept"] = "application/json"
387+
366388
payload = await self._version.create_async(
367389
method="POST", uri=self._uri, data=data, headers=headers
368390
)
@@ -496,7 +518,13 @@ def page(
496518
}
497519
)
498520

499-
response = self._version.page(method="GET", uri=self._uri, params=data)
521+
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})
522+
523+
headers["Accept"] = "application/json"
524+
525+
response = self._version.page(
526+
method="GET", uri=self._uri, params=data, headers=headers
527+
)
500528
return AwsPage(self._version, response)
501529

502530
async def page_async(
@@ -523,8 +551,12 @@ async def page_async(
523551
}
524552
)
525553

554+
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})
555+
556+
headers["Accept"] = "application/json"
557+
526558
response = await self._version.page_async(
527-
method="GET", uri=self._uri, params=data
559+
method="GET", uri=self._uri, params=data, headers=headers
528560
)
529561
return AwsPage(self._version, response)
530562

0 commit comments

Comments
 (0)