Debian Codegraph @

src/auth0/management/organizations/connections/client.py

raw symbols SCIP
1 # This file was auto-generated by Fern from our API Definition.
2
3 import typing
4
5 from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6 from ...core.pagination import AsyncPager, SyncPager
7 from ...core.request_options import RequestOptions
8 from ...types.create_organization_all_connection_response_content import CreateOrganizationAllConnectionResponseContent
9 from ...types.get_organization_all_connection_response_content import GetOrganizationAllConnectionResponseContent
10 from ...types.list_organization_all_connections_offset_paginated_response_content import (
11 ListOrganizationAllConnectionsOffsetPaginatedResponseContent,
12 )
13 from ...types.organization_access_level_enum import OrganizationAccessLevelEnum
14 from ...types.organization_access_level_enum_with_null import OrganizationAccessLevelEnumWithNull
15 from ...types.organization_all_connection_post import OrganizationAllConnectionPost
16 from ...types.update_organization_all_connection_response_content import UpdateOrganizationAllConnectionResponseContent
17 from .raw_client import AsyncRawConnectionsClient, RawConnectionsClient
18
19 # this is used as the default value for optional parameters
20 OMIT = typing.cast(typing.Any, ...)
21
22
23 class ConnectionsClient:
24 def __init__(self, *, client_wrapper: SyncClientWrapper):
25 self._raw_client = RawConnectionsClient(client_wrapper=client_wrapper)
26
27 @property
28 def with_raw_response(self) -> RawConnectionsClient:
29 """
30 Retrieves a raw implementation of this client that returns raw responses.
31
32 Returns
33 -------
34 RawConnectionsClient
35 """
36 return self._raw_client
37
38 def list(
39 self,
40 id: str,
41 *,
42 page: typing.Optional[int] = 0,
43 per_page: typing.Optional[int] = 50,
44 include_totals: typing.Optional[bool] = True,
45 is_enabled: typing.Optional[bool] = None,
46 request_options: typing.Optional[RequestOptions] = None,
47 ) -> SyncPager[OrganizationAllConnectionPost, ListOrganizationAllConnectionsOffsetPaginatedResponseContent]:
48 """
49 Parameters
50 ----------
51 id : str
52 Organization identifier.
53
54 page : typing.Optional[int]
55 Page index of the results to return. First page is 0.
56
57 per_page : typing.Optional[int]
58 Number of results per page. Defaults to 50.
59
60 include_totals : typing.Optional[bool]
61 Return results inside an object that contains the total result count (true) or as a direct array of results (false, default).
62
63 is_enabled : typing.Optional[bool]
64 Filter connections by enabled status.
65
66 request_options : typing.Optional[RequestOptions]
67 Request-specific configuration.
68
69 Returns
70 -------
71 SyncPager[OrganizationAllConnectionPost, ListOrganizationAllConnectionsOffsetPaginatedResponseContent]
72 Connections successfully retrieved.
73
74 Examples
75 --------
76 from auth0 import Auth0
77
78 client = Auth0(
79 token="YOUR_TOKEN",
80 )
81 response = client.organizations.connections.list(
82 id="id",
83 page=1,
84 per_page=1,
85 include_totals=True,
86 is_enabled=True,
87 )
88 for item in response:
89 yield item
90 # alternatively, you can paginate page-by-page
91 for page in response.iter_pages():
92 yield page
93 """
94 return self._raw_client.list(
95 id,
96 page=page,
97 per_page=per_page,
98 include_totals=include_totals,
99 is_enabled=is_enabled,
100 request_options=request_options,
101 )
102
103 def create(
104 self,
105 id: str,
106 *,
107 connection_id: str,
108 organization_connection_name: typing.Optional[str] = OMIT,
109 assign_membership_on_login: typing.Optional[bool] = OMIT,
110 show_as_button: typing.Optional[bool] = OMIT,
111 is_signup_enabled: typing.Optional[bool] = OMIT,
112 organization_access_level: typing.Optional[OrganizationAccessLevelEnum] = OMIT,
113 is_enabled: typing.Optional[bool] = OMIT,
114 request_options: typing.Optional[RequestOptions] = None,
115 ) -> CreateOrganizationAllConnectionResponseContent:
116 """
117 Parameters
118 ----------
119 id : str
120 Organization identifier.
121
122 connection_id : str
123 Connection identifier.
124
125 organization_connection_name : typing.Optional[str]
126 Name of the connection in the scope of this organization.
127
128 assign_membership_on_login : typing.Optional[bool]
129 When true, all users that log in with this connection will be automatically granted membership in the organization. When false, users must be granted membership in the organization before logging in with this connection.
130
131 show_as_button : typing.Optional[bool]
132 Determines whether a connection should be displayed on this organization’s login prompt. Only applicable for enterprise connections. Default: true.
133
134 is_signup_enabled : typing.Optional[bool]
135 Determines whether organization signup should be enabled for this organization connection. Only applicable for database connections. Default: false.
136
137 organization_access_level : typing.Optional[OrganizationAccessLevelEnum]
138
139 is_enabled : typing.Optional[bool]
140 Whether the connection is enabled for the organization.
141
142 request_options : typing.Optional[RequestOptions]
143 Request-specific configuration.
144
145 Returns
146 -------
147 CreateOrganizationAllConnectionResponseContent
148 Connection successfully created.
149
150 Examples
151 --------
152 from auth0 import Auth0
153
154 client = Auth0(
155 token="YOUR_TOKEN",
156 )
157 client.organizations.connections.create(
158 id="id",
159 connection_id="connection_id",
160 )
161 """
162 _response = self._raw_client.create(
163 id,
164 connection_id=connection_id,
165 organization_connection_name=organization_connection_name,
166 assign_membership_on_login=assign_membership_on_login,
167 show_as_button=show_as_button,
168 is_signup_enabled=is_signup_enabled,
169 organization_access_level=organization_access_level,
170 is_enabled=is_enabled,
171 request_options=request_options,
172 )
173 return _response.data
174
175 def get(
176 self, id: str, connection_id: str, *, request_options: typing.Optional[RequestOptions] = None
177 ) -> GetOrganizationAllConnectionResponseContent:
178 """
179 Parameters
180 ----------
181 id : str
182 Organization identifier.
183
184 connection_id : str
185 Connection identifier.
186
187 request_options : typing.Optional[RequestOptions]
188 Request-specific configuration.
189
190 Returns
191 -------
192 GetOrganizationAllConnectionResponseContent
193 Connection successfully retrieved.
194
195 Examples
196 --------
197 from auth0 import Auth0
198
199 client = Auth0(
200 token="YOUR_TOKEN",
201 )
202 client.organizations.connections.get(
203 id="id",
204 connection_id="connection_id",
205 )
206 """
207 _response = self._raw_client.get(id, connection_id, request_options=request_options)
208 return _response.data
209
210 def delete(self, id: str, connection_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
211 """
212 Parameters
213 ----------
214 id : str
215 Organization identifier.
216
217 connection_id : str
218 Connection identifier.
219
220 request_options : typing.Optional[RequestOptions]
221 Request-specific configuration.
222
223 Returns
224 -------
225 None
226
227 Examples
228 --------
229 from auth0 import Auth0
230
231 client = Auth0(
232 token="YOUR_TOKEN",
233 )
234 client.organizations.connections.delete(
235 id="id",
236 connection_id="connection_id",
237 )
238 """
239 _response = self._raw_client.delete(id, connection_id, request_options=request_options)
240 return _response.data
241
242 def update(
243 self,
244 id: str,
245 connection_id: str,
246 *,
247 organization_connection_name: typing.Optional[str] = OMIT,
248 assign_membership_on_login: typing.Optional[bool] = OMIT,
249 show_as_button: typing.Optional[bool] = OMIT,
250 is_signup_enabled: typing.Optional[bool] = OMIT,
251 organization_access_level: typing.Optional[OrganizationAccessLevelEnumWithNull] = OMIT,
252 is_enabled: typing.Optional[bool] = OMIT,
253 request_options: typing.Optional[RequestOptions] = None,
254 ) -> UpdateOrganizationAllConnectionResponseContent:
255 """
256 Parameters
257 ----------
258 id : str
259 Organization identifier.
260
261 connection_id : str
262 Connection identifier.
263
264 organization_connection_name : typing.Optional[str]
265 Name of the connection in the scope of this organization.
266
267 assign_membership_on_login : typing.Optional[bool]
268 When true, all users that log in with this connection will be automatically granted membership in the organization. When false, users must be granted membership in the organization before logging in with this connection.
269
270 show_as_button : typing.Optional[bool]
271 Determines whether a connection should be displayed on this organization’s login prompt. Only applicable for enterprise connections. Default: true.
272
273 is_signup_enabled : typing.Optional[bool]
274 Determines whether organization signup should be enabled for this organization connection. Only applicable for database connections. Default: false.
275
276 organization_access_level : typing.Optional[OrganizationAccessLevelEnumWithNull]
277
278 is_enabled : typing.Optional[bool]
279 Whether the connection is enabled for the organization.
280
281 request_options : typing.Optional[RequestOptions]
282 Request-specific configuration.
283
284 Returns
285 -------
286 UpdateOrganizationAllConnectionResponseContent
287 Connection successfully updated.
288
289 Examples
290 --------
291 from auth0 import Auth0
292
293 client = Auth0(
294 token="YOUR_TOKEN",
295 )
296 client.organizations.connections.update(
297 id="id",
298 connection_id="connection_id",
299 )
300 """
301 _response = self._raw_client.update(
302 id,
303 connection_id,
304 organization_connection_name=organization_connection_name,
305 assign_membership_on_login=assign_membership_on_login,
306 show_as_button=show_as_button,
307 is_signup_enabled=is_signup_enabled,
308 organization_access_level=organization_access_level,
309 is_enabled=is_enabled,
310 request_options=request_options,
311 )
312 return _response.data
313
314
315 class AsyncConnectionsClient:
316 def __init__(self, *, client_wrapper: AsyncClientWrapper):
317 self._raw_client = AsyncRawConnectionsClient(client_wrapper=client_wrapper)
318
319 @property
320 def with_raw_response(self) -> AsyncRawConnectionsClient:
321 """
322 Retrieves a raw implementation of this client that returns raw responses.
323
324 Returns
325 -------
326 AsyncRawConnectionsClient
327 """
328 return self._raw_client
329
330 async def list(
331 self,
332 id: str,
333 *,
334 page: typing.Optional[int] = 0,
335 per_page: typing.Optional[int] = 50,
336 include_totals: typing.Optional[bool] = True,
337 is_enabled: typing.Optional[bool] = None,
338 request_options: typing.Optional[RequestOptions] = None,
339 ) -> AsyncPager[OrganizationAllConnectionPost, ListOrganizationAllConnectionsOffsetPaginatedResponseContent]:
340 """
341 Parameters
342 ----------
343 id : str
344 Organization identifier.
345
346 page : typing.Optional[int]
347 Page index of the results to return. First page is 0.
348
349 per_page : typing.Optional[int]
350 Number of results per page. Defaults to 50.
351
352 include_totals : typing.Optional[bool]
353 Return results inside an object that contains the total result count (true) or as a direct array of results (false, default).
354
355 is_enabled : typing.Optional[bool]
356 Filter connections by enabled status.
357
358 request_options : typing.Optional[RequestOptions]
359 Request-specific configuration.
360
361 Returns
362 -------
363 AsyncPager[OrganizationAllConnectionPost, ListOrganizationAllConnectionsOffsetPaginatedResponseContent]
364 Connections successfully retrieved.
365
366 Examples
367 --------
368 import asyncio
369
370 from auth0 import AsyncAuth0
371
372 client = AsyncAuth0(
373 token="YOUR_TOKEN",
374 )
375
376
377 async def main() -> None:
378 response = await client.organizations.connections.list(
379 id="id",
380 page=1,
381 per_page=1,
382 include_totals=True,
383 is_enabled=True,
384 )
385 async for item in response:
386 yield item
387
388 # alternatively, you can paginate page-by-page
389 async for page in response.iter_pages():
390 yield page
391
392
393 asyncio.run(main())
394 """
395 return await self._raw_client.list(
396 id,
397 page=page,
398 per_page=per_page,
399 include_totals=include_totals,
400 is_enabled=is_enabled,
401 request_options=request_options,
402 )
403
404 async def create(
405 self,
406 id: str,
407 *,
408 connection_id: str,
409 organization_connection_name: typing.Optional[str] = OMIT,
410 assign_membership_on_login: typing.Optional[bool] = OMIT,
411 show_as_button: typing.Optional[bool] = OMIT,
412 is_signup_enabled: typing.Optional[bool] = OMIT,
413 organization_access_level: typing.Optional[OrganizationAccessLevelEnum] = OMIT,
414 is_enabled: typing.Optional[bool] = OMIT,
415 request_options: typing.Optional[RequestOptions] = None,
416 ) -> CreateOrganizationAllConnectionResponseContent:
417 """
418 Parameters
419 ----------
420 id : str
421 Organization identifier.
422
423 connection_id : str
424 Connection identifier.
425
426 organization_connection_name : typing.Optional[str]
427 Name of the connection in the scope of this organization.
428
429 assign_membership_on_login : typing.Optional[bool]
430 When true, all users that log in with this connection will be automatically granted membership in the organization. When false, users must be granted membership in the organization before logging in with this connection.
431
432 show_as_button : typing.Optional[bool]
433 Determines whether a connection should be displayed on this organization’s login prompt. Only applicable for enterprise connections. Default: true.
434
435 is_signup_enabled : typing.Optional[bool]
436 Determines whether organization signup should be enabled for this organization connection. Only applicable for database connections. Default: false.
437
438 organization_access_level : typing.Optional[OrganizationAccessLevelEnum]
439
440 is_enabled : typing.Optional[bool]
441 Whether the connection is enabled for the organization.
442
443 request_options : typing.Optional[RequestOptions]
444 Request-specific configuration.
445
446 Returns
447 -------
448 CreateOrganizationAllConnectionResponseContent
449 Connection successfully created.
450
451 Examples
452 --------
453 import asyncio
454
455 from auth0 import AsyncAuth0
456
457 client = AsyncAuth0(
458 token="YOUR_TOKEN",
459 )
460
461
462 async def main() -> None:
463 await client.organizations.connections.create(
464 id="id",
465 connection_id="connection_id",
466 )
467
468
469 asyncio.run(main())
470 """
471 _response = await self._raw_client.create(
472 id,
473 connection_id=connection_id,
474 organization_connection_name=organization_connection_name,
475 assign_membership_on_login=assign_membership_on_login,
476 show_as_button=show_as_button,
477 is_signup_enabled=is_signup_enabled,
478 organization_access_level=organization_access_level,
479 is_enabled=is_enabled,
480 request_options=request_options,
481 )
482 return _response.data
483
484 async def get(
485 self, id: str, connection_id: str, *, request_options: typing.Optional[RequestOptions] = None
486 ) -> GetOrganizationAllConnectionResponseContent:
487 """
488 Parameters
489 ----------
490 id : str
491 Organization identifier.
492
493 connection_id : str
494 Connection identifier.
495
496 request_options : typing.Optional[RequestOptions]
497 Request-specific configuration.
498
499 Returns
500 -------
501 GetOrganizationAllConnectionResponseContent
502 Connection successfully retrieved.
503
504 Examples
505 --------
506 import asyncio
507
508 from auth0 import AsyncAuth0
509
510 client = AsyncAuth0(
511 token="YOUR_TOKEN",
512 )
513
514
515 async def main() -> None:
516 await client.organizations.connections.get(
517 id="id",
518 connection_id="connection_id",
519 )
520
521
522 asyncio.run(main())
523 """
524 _response = await self._raw_client.get(id, connection_id, request_options=request_options)
525 return _response.data
526
527 async def delete(
528 self, id: str, connection_id: str, *, request_options: typing.Optional[RequestOptions] = None
529 ) -> None:
530 """
531 Parameters
532 ----------
533 id : str
534 Organization identifier.
535
536 connection_id : str
537 Connection identifier.
538
539 request_options : typing.Optional[RequestOptions]
540 Request-specific configuration.
541
542 Returns
543 -------
544 None
545
546 Examples
547 --------
548 import asyncio
549
550 from auth0 import AsyncAuth0
551
552 client = AsyncAuth0(
553 token="YOUR_TOKEN",
554 )
555
556
557 async def main() -> None:
558 await client.organizations.connections.delete(
559 id="id",
560 connection_id="connection_id",
561 )
562
563
564 asyncio.run(main())
565 """
566 _response = await self._raw_client.delete(id, connection_id, request_options=request_options)
567 return _response.data
568
569 async def update(
570 self,
571 id: str,
572 connection_id: str,
573 *,
574 organization_connection_name: typing.Optional[str] = OMIT,
575 assign_membership_on_login: typing.Optional[bool] = OMIT,
576 show_as_button: typing.Optional[bool] = OMIT,
577 is_signup_enabled: typing.Optional[bool] = OMIT,
578 organization_access_level: typing.Optional[OrganizationAccessLevelEnumWithNull] = OMIT,
579 is_enabled: typing.Optional[bool] = OMIT,
580 request_options: typing.Optional[RequestOptions] = None,
581 ) -> UpdateOrganizationAllConnectionResponseContent:
582 """
583 Parameters
584 ----------
585 id : str
586 Organization identifier.
587
588 connection_id : str
589 Connection identifier.
590
591 organization_connection_name : typing.Optional[str]
592 Name of the connection in the scope of this organization.
593
594 assign_membership_on_login : typing.Optional[bool]
595 When true, all users that log in with this connection will be automatically granted membership in the organization. When false, users must be granted membership in the organization before logging in with this connection.
596
597 show_as_button : typing.Optional[bool]
598 Determines whether a connection should be displayed on this organization’s login prompt. Only applicable for enterprise connections. Default: true.
599
600 is_signup_enabled : typing.Optional[bool]
601 Determines whether organization signup should be enabled for this organization connection. Only applicable for database connections. Default: false.
602
603 organization_access_level : typing.Optional[OrganizationAccessLevelEnumWithNull]
604
605 is_enabled : typing.Optional[bool]
606 Whether the connection is enabled for the organization.
607
608 request_options : typing.Optional[RequestOptions]
609 Request-specific configuration.
610
611 Returns
612 -------
613 UpdateOrganizationAllConnectionResponseContent
614 Connection successfully updated.
615
616 Examples
617 --------
618 import asyncio
619
620 from auth0 import AsyncAuth0
621
622 client = AsyncAuth0(
623 token="YOUR_TOKEN",
624 )
625
626
627 async def main() -> None:
628 await client.organizations.connections.update(
629 id="id",
630 connection_id="connection_id",
631 )
632
633
634 asyncio.run(main())
635 """
636 _response = await self._raw_client.update(
637 id,
638 connection_id,
639 organization_connection_name=organization_connection_name,
640 assign_membership_on_login=assign_membership_on_login,
641 show_as_button=show_as_button,
642 is_signup_enabled=is_signup_enabled,
643 organization_access_level=organization_access_level,
644 is_enabled=is_enabled,
645 request_options=request_options,
646 )
647 return _response.data