Debian Codegraph @

src/auth0/management/self_service_profiles/client.py

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