Debian Codegraph @

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