Debian Codegraph @

src/auth0/management/user_attribute_profiles/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_user_attribute_profile_response_content import CreateUserAttributeProfileResponseContent
9 from ..types.get_user_attribute_profile_response_content import GetUserAttributeProfileResponseContent
10 from ..types.get_user_attribute_profile_template_response_content import GetUserAttributeProfileTemplateResponseContent
11 from ..types.list_user_attribute_profile_template_response_content import (
12 ListUserAttributeProfileTemplateResponseContent,
13 )
14 from ..types.list_user_attribute_profiles_paginated_response_content import (
15 ListUserAttributeProfilesPaginatedResponseContent,
16 )
17 from ..types.update_user_attribute_profile_response_content import UpdateUserAttributeProfileResponseContent
18 from ..types.user_attribute_profile import UserAttributeProfile
19 from ..types.user_attribute_profile_name import UserAttributeProfileName
20 from ..types.user_attribute_profile_patch_user_id import UserAttributeProfilePatchUserId
21 from ..types.user_attribute_profile_user_attributes import UserAttributeProfileUserAttributes
22 from ..types.user_attribute_profile_user_id import UserAttributeProfileUserId
23 from .raw_client import AsyncRawUserAttributeProfilesClient, RawUserAttributeProfilesClient
24
25 # this is used as the default value for optional parameters
26 OMIT = typing.cast(typing.Any, ...)
27
28
29 class UserAttributeProfilesClient:
30 def __init__(self, *, client_wrapper: SyncClientWrapper):
31 self._raw_client = RawUserAttributeProfilesClient(client_wrapper=client_wrapper)
32
33 @property
34 def with_raw_response(self) -> RawUserAttributeProfilesClient:
35 """
36 Retrieves a raw implementation of this client that returns raw responses.
37
38 Returns
39 -------
40 RawUserAttributeProfilesClient
41 """
42 return self._raw_client
43
44 def list(
45 self,
46 *,
47 from_: typing.Optional[str] = None,
48 take: typing.Optional[int] = 50,
49 request_options: typing.Optional[RequestOptions] = None,
50 ) -> SyncPager[UserAttributeProfile, ListUserAttributeProfilesPaginatedResponseContent]:
51 """
52 Retrieve a list of User Attribute Profiles. This endpoint supports Checkpoint pagination.
53
54 Parameters
55 ----------
56 from_ : typing.Optional[str]
57 Optional Id from which to start selection.
58
59 take : typing.Optional[int]
60 Number of results per page. Defaults to 5.
61
62 request_options : typing.Optional[RequestOptions]
63 Request-specific configuration.
64
65 Returns
66 -------
67 SyncPager[UserAttributeProfile, ListUserAttributeProfilesPaginatedResponseContent]
68 User Attribute Profiles successfully retrieved.
69
70 Examples
71 --------
72 from auth0 import Auth0
73
74 client = Auth0(
75 token="YOUR_TOKEN",
76 )
77 response = client.user_attribute_profiles.list(
78 from_="from",
79 take=1,
80 )
81 for item in response:
82 yield item
83 # alternatively, you can paginate page-by-page
84 for page in response.iter_pages():
85 yield page
86 """
87 return self._raw_client.list(from_=from_, take=take, request_options=request_options)
88
89 def create(
90 self,
91 *,
92 name: UserAttributeProfileName,
93 user_attributes: UserAttributeProfileUserAttributes,
94 user_id: typing.Optional[UserAttributeProfileUserId] = OMIT,
95 request_options: typing.Optional[RequestOptions] = None,
96 ) -> CreateUserAttributeProfileResponseContent:
97 """
98 Create a User Attribute Profile.
99
100 Parameters
101 ----------
102 name : UserAttributeProfileName
103
104 user_attributes : UserAttributeProfileUserAttributes
105
106 user_id : typing.Optional[UserAttributeProfileUserId]
107
108 request_options : typing.Optional[RequestOptions]
109 Request-specific configuration.
110
111 Returns
112 -------
113 CreateUserAttributeProfileResponseContent
114 User attribute successfully created.
115
116 Examples
117 --------
118 from auth0 import Auth0, UserAttributeProfileUserAttributeAdditionalProperties
119
120 client = Auth0(
121 token="YOUR_TOKEN",
122 )
123 client.user_attribute_profiles.create(
124 name="name",
125 user_attributes={
126 "key": UserAttributeProfileUserAttributeAdditionalProperties(
127 description="description",
128 label="label",
129 profile_required=True,
130 auth_0_mapping="auth0_mapping",
131 )
132 },
133 )
134 """
135 _response = self._raw_client.create(
136 name=name, user_attributes=user_attributes, user_id=user_id, request_options=request_options
137 )
138 return _response.data
139
140 def list_templates(
141 self, *, request_options: typing.Optional[RequestOptions] = None
142 ) -> ListUserAttributeProfileTemplateResponseContent:
143 """
144 Retrieve a list of User Attribute Profile Templates.
145
146 Parameters
147 ----------
148 request_options : typing.Optional[RequestOptions]
149 Request-specific configuration.
150
151 Returns
152 -------
153 ListUserAttributeProfileTemplateResponseContent
154 User Attribute Profile Templates successfully retrieved.
155
156 Examples
157 --------
158 from auth0 import Auth0
159
160 client = Auth0(
161 token="YOUR_TOKEN",
162 )
163 client.user_attribute_profiles.list_templates()
164 """
165 _response = self._raw_client.list_templates(request_options=request_options)
166 return _response.data
167
168 def get_template(
169 self, id: str, *, request_options: typing.Optional[RequestOptions] = None
170 ) -> GetUserAttributeProfileTemplateResponseContent:
171 """
172 Retrieve a User Attribute Profile Template.
173
174 Parameters
175 ----------
176 id : str
177 ID of the user-attribute-profile-template to retrieve.
178
179 request_options : typing.Optional[RequestOptions]
180 Request-specific configuration.
181
182 Returns
183 -------
184 GetUserAttributeProfileTemplateResponseContent
185 User Attribute Profile Template successfully retrieved.
186
187 Examples
188 --------
189 from auth0 import Auth0
190
191 client = Auth0(
192 token="YOUR_TOKEN",
193 )
194 client.user_attribute_profiles.get_template(
195 id="id",
196 )
197 """
198 _response = self._raw_client.get_template(id, request_options=request_options)
199 return _response.data
200
201 def get(
202 self, id: str, *, request_options: typing.Optional[RequestOptions] = None
203 ) -> GetUserAttributeProfileResponseContent:
204 """
205 Retrieve details about a single User Attribute Profile specified by ID.
206
207 Parameters
208 ----------
209 id : str
210 ID of the user-attribute-profile to retrieve.
211
212 request_options : typing.Optional[RequestOptions]
213 Request-specific configuration.
214
215 Returns
216 -------
217 GetUserAttributeProfileResponseContent
218 Record for existing user attribute profile.
219
220 Examples
221 --------
222 from auth0 import Auth0
223
224 client = Auth0(
225 token="YOUR_TOKEN",
226 )
227 client.user_attribute_profiles.get(
228 id="id",
229 )
230 """
231 _response = self._raw_client.get(id, request_options=request_options)
232 return _response.data
233
234 def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
235 """
236 Delete a single User Attribute Profile specified by ID.
237
238 Parameters
239 ----------
240 id : str
241 ID of the user-attribute-profile to delete.
242
243 request_options : typing.Optional[RequestOptions]
244 Request-specific configuration.
245
246 Returns
247 -------
248 None
249
250 Examples
251 --------
252 from auth0 import Auth0
253
254 client = Auth0(
255 token="YOUR_TOKEN",
256 )
257 client.user_attribute_profiles.delete(
258 id="id",
259 )
260 """
261 _response = self._raw_client.delete(id, request_options=request_options)
262 return _response.data
263
264 def update(
265 self,
266 id: str,
267 *,
268 name: typing.Optional[UserAttributeProfileName] = OMIT,
269 user_id: typing.Optional[UserAttributeProfilePatchUserId] = OMIT,
270 user_attributes: typing.Optional[UserAttributeProfileUserAttributes] = OMIT,
271 request_options: typing.Optional[RequestOptions] = None,
272 ) -> UpdateUserAttributeProfileResponseContent:
273 """
274 Update the details of a specific User attribute profile, such as name, user_id and user_attributes.
275
276 Parameters
277 ----------
278 id : str
279 ID of the user attribute profile to update.
280
281 name : typing.Optional[UserAttributeProfileName]
282
283 user_id : typing.Optional[UserAttributeProfilePatchUserId]
284
285 user_attributes : typing.Optional[UserAttributeProfileUserAttributes]
286
287 request_options : typing.Optional[RequestOptions]
288 Request-specific configuration.
289
290 Returns
291 -------
292 UpdateUserAttributeProfileResponseContent
293 User attribute profile successfully updated.
294
295 Examples
296 --------
297 from auth0 import Auth0
298
299 client = Auth0(
300 token="YOUR_TOKEN",
301 )
302 client.user_attribute_profiles.update(
303 id="id",
304 )
305 """
306 _response = self._raw_client.update(
307 id, name=name, user_id=user_id, user_attributes=user_attributes, request_options=request_options
308 )
309 return _response.data
310
311
312 class AsyncUserAttributeProfilesClient:
313 def __init__(self, *, client_wrapper: AsyncClientWrapper):
314 self._raw_client = AsyncRawUserAttributeProfilesClient(client_wrapper=client_wrapper)
315
316 @property
317 def with_raw_response(self) -> AsyncRawUserAttributeProfilesClient:
318 """
319 Retrieves a raw implementation of this client that returns raw responses.
320
321 Returns
322 -------
323 AsyncRawUserAttributeProfilesClient
324 """
325 return self._raw_client
326
327 async def list(
328 self,
329 *,
330 from_: typing.Optional[str] = None,
331 take: typing.Optional[int] = 50,
332 request_options: typing.Optional[RequestOptions] = None,
333 ) -> AsyncPager[UserAttributeProfile, ListUserAttributeProfilesPaginatedResponseContent]:
334 """
335 Retrieve a list of User Attribute Profiles. This endpoint supports Checkpoint pagination.
336
337 Parameters
338 ----------
339 from_ : typing.Optional[str]
340 Optional Id from which to start selection.
341
342 take : typing.Optional[int]
343 Number of results per page. Defaults to 5.
344
345 request_options : typing.Optional[RequestOptions]
346 Request-specific configuration.
347
348 Returns
349 -------
350 AsyncPager[UserAttributeProfile, ListUserAttributeProfilesPaginatedResponseContent]
351 User Attribute Profiles successfully retrieved.
352
353 Examples
354 --------
355 import asyncio
356
357 from auth0 import AsyncAuth0
358
359 client = AsyncAuth0(
360 token="YOUR_TOKEN",
361 )
362
363
364 async def main() -> None:
365 response = await client.user_attribute_profiles.list(
366 from_="from",
367 take=1,
368 )
369 async for item in response:
370 yield item
371
372 # alternatively, you can paginate page-by-page
373 async for page in response.iter_pages():
374 yield page
375
376
377 asyncio.run(main())
378 """
379 return await self._raw_client.list(from_=from_, take=take, request_options=request_options)
380
381 async def create(
382 self,
383 *,
384 name: UserAttributeProfileName,
385 user_attributes: UserAttributeProfileUserAttributes,
386 user_id: typing.Optional[UserAttributeProfileUserId] = OMIT,
387 request_options: typing.Optional[RequestOptions] = None,
388 ) -> CreateUserAttributeProfileResponseContent:
389 """
390 Create a User Attribute Profile.
391
392 Parameters
393 ----------
394 name : UserAttributeProfileName
395
396 user_attributes : UserAttributeProfileUserAttributes
397
398 user_id : typing.Optional[UserAttributeProfileUserId]
399
400 request_options : typing.Optional[RequestOptions]
401 Request-specific configuration.
402
403 Returns
404 -------
405 CreateUserAttributeProfileResponseContent
406 User attribute successfully created.
407
408 Examples
409 --------
410 import asyncio
411
412 from auth0 import (
413 AsyncAuth0,
414 UserAttributeProfileUserAttributeAdditionalProperties,
415 )
416
417 client = AsyncAuth0(
418 token="YOUR_TOKEN",
419 )
420
421
422 async def main() -> None:
423 await client.user_attribute_profiles.create(
424 name="name",
425 user_attributes={
426 "key": UserAttributeProfileUserAttributeAdditionalProperties(
427 description="description",
428 label="label",
429 profile_required=True,
430 auth_0_mapping="auth0_mapping",
431 )
432 },
433 )
434
435
436 asyncio.run(main())
437 """
438 _response = await self._raw_client.create(
439 name=name, user_attributes=user_attributes, user_id=user_id, request_options=request_options
440 )
441 return _response.data
442
443 async def list_templates(
444 self, *, request_options: typing.Optional[RequestOptions] = None
445 ) -> ListUserAttributeProfileTemplateResponseContent:
446 """
447 Retrieve a list of User Attribute Profile Templates.
448
449 Parameters
450 ----------
451 request_options : typing.Optional[RequestOptions]
452 Request-specific configuration.
453
454 Returns
455 -------
456 ListUserAttributeProfileTemplateResponseContent
457 User Attribute Profile Templates successfully retrieved.
458
459 Examples
460 --------
461 import asyncio
462
463 from auth0 import AsyncAuth0
464
465 client = AsyncAuth0(
466 token="YOUR_TOKEN",
467 )
468
469
470 async def main() -> None:
471 await client.user_attribute_profiles.list_templates()
472
473
474 asyncio.run(main())
475 """
476 _response = await self._raw_client.list_templates(request_options=request_options)
477 return _response.data
478
479 async def get_template(
480 self, id: str, *, request_options: typing.Optional[RequestOptions] = None
481 ) -> GetUserAttributeProfileTemplateResponseContent:
482 """
483 Retrieve a User Attribute Profile Template.
484
485 Parameters
486 ----------
487 id : str
488 ID of the user-attribute-profile-template to retrieve.
489
490 request_options : typing.Optional[RequestOptions]
491 Request-specific configuration.
492
493 Returns
494 -------
495 GetUserAttributeProfileTemplateResponseContent
496 User Attribute Profile Template successfully retrieved.
497
498 Examples
499 --------
500 import asyncio
501
502 from auth0 import AsyncAuth0
503
504 client = AsyncAuth0(
505 token="YOUR_TOKEN",
506 )
507
508
509 async def main() -> None:
510 await client.user_attribute_profiles.get_template(
511 id="id",
512 )
513
514
515 asyncio.run(main())
516 """
517 _response = await self._raw_client.get_template(id, request_options=request_options)
518 return _response.data
519
520 async def get(
521 self, id: str, *, request_options: typing.Optional[RequestOptions] = None
522 ) -> GetUserAttributeProfileResponseContent:
523 """
524 Retrieve details about a single User Attribute Profile specified by ID.
525
526 Parameters
527 ----------
528 id : str
529 ID of the user-attribute-profile to retrieve.
530
531 request_options : typing.Optional[RequestOptions]
532 Request-specific configuration.
533
534 Returns
535 -------
536 GetUserAttributeProfileResponseContent
537 Record for existing user attribute profile.
538
539 Examples
540 --------
541 import asyncio
542
543 from auth0 import AsyncAuth0
544
545 client = AsyncAuth0(
546 token="YOUR_TOKEN",
547 )
548
549
550 async def main() -> None:
551 await client.user_attribute_profiles.get(
552 id="id",
553 )
554
555
556 asyncio.run(main())
557 """
558 _response = await self._raw_client.get(id, request_options=request_options)
559 return _response.data
560
561 async def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
562 """
563 Delete a single User Attribute Profile specified by ID.
564
565 Parameters
566 ----------
567 id : str
568 ID of the user-attribute-profile to delete.
569
570 request_options : typing.Optional[RequestOptions]
571 Request-specific configuration.
572
573 Returns
574 -------
575 None
576
577 Examples
578 --------
579 import asyncio
580
581 from auth0 import AsyncAuth0
582
583 client = AsyncAuth0(
584 token="YOUR_TOKEN",
585 )
586
587
588 async def main() -> None:
589 await client.user_attribute_profiles.delete(
590 id="id",
591 )
592
593
594 asyncio.run(main())
595 """
596 _response = await self._raw_client.delete(id, request_options=request_options)
597 return _response.data
598
599 async def update(
600 self,
601 id: str,
602 *,
603 name: typing.Optional[UserAttributeProfileName] = OMIT,
604 user_id: typing.Optional[UserAttributeProfilePatchUserId] = OMIT,
605 user_attributes: typing.Optional[UserAttributeProfileUserAttributes] = OMIT,
606 request_options: typing.Optional[RequestOptions] = None,
607 ) -> UpdateUserAttributeProfileResponseContent:
608 """
609 Update the details of a specific User attribute profile, such as name, user_id and user_attributes.
610
611 Parameters
612 ----------
613 id : str
614 ID of the user attribute profile to update.
615
616 name : typing.Optional[UserAttributeProfileName]
617
618 user_id : typing.Optional[UserAttributeProfilePatchUserId]
619
620 user_attributes : typing.Optional[UserAttributeProfileUserAttributes]
621
622 request_options : typing.Optional[RequestOptions]
623 Request-specific configuration.
624
625 Returns
626 -------
627 UpdateUserAttributeProfileResponseContent
628 User attribute profile successfully updated.
629
630 Examples
631 --------
632 import asyncio
633
634 from auth0 import AsyncAuth0
635
636 client = AsyncAuth0(
637 token="YOUR_TOKEN",
638 )
639
640
641 async def main() -> None:
642 await client.user_attribute_profiles.update(
643 id="id",
644 )
645
646
647 asyncio.run(main())
648 """
649 _response = await self._raw_client.update(
650 id, name=name, user_id=user_id, user_attributes=user_attributes, request_options=request_options
651 )
652 return _response.data