Debian Codegraph @

src/auth0/management/resource_servers/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_resource_server_response_content import CreateResourceServerResponseContent
9 from ..types.get_resource_server_response_content import GetResourceServerResponseContent
10 from ..types.list_resource_server_offset_paginated_response_content import (
11 ListResourceServerOffsetPaginatedResponseContent,
12 )
13 from ..types.resource_server import ResourceServer
14 from ..types.resource_server_authorization_policy import ResourceServerAuthorizationPolicy
15 from ..types.resource_server_consent_policy_enum import ResourceServerConsentPolicyEnum
16 from ..types.resource_server_proof_of_possession import ResourceServerProofOfPossession
17 from ..types.resource_server_scope import ResourceServerScope
18 from ..types.resource_server_subject_type_authorization import ResourceServerSubjectTypeAuthorization
19 from ..types.resource_server_token_dialect_schema_enum import ResourceServerTokenDialectSchemaEnum
20 from ..types.resource_server_token_encryption import ResourceServerTokenEncryption
21 from ..types.signing_algorithm_enum import SigningAlgorithmEnum
22 from ..types.update_resource_server_response_content import UpdateResourceServerResponseContent
23 from .raw_client import AsyncRawResourceServersClient, RawResourceServersClient
24
25 # this is used as the default value for optional parameters
26 OMIT = typing.cast(typing.Any, ...)
27
28
29 class ResourceServersClient:
30 def __init__(self, *, client_wrapper: SyncClientWrapper):
31 self._raw_client = RawResourceServersClient(client_wrapper=client_wrapper)
32
33 @property
34 def with_raw_response(self) -> RawResourceServersClient:
35 """
36 Retrieves a raw implementation of this client that returns raw responses.
37
38 Returns
39 -------
40 RawResourceServersClient
41 """
42 return self._raw_client
43
44 def list(
45 self,
46 *,
47 identifiers: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
48 page: typing.Optional[int] = 0,
49 per_page: typing.Optional[int] = 50,
50 include_totals: typing.Optional[bool] = True,
51 include_fields: typing.Optional[bool] = None,
52 request_options: typing.Optional[RequestOptions] = None,
53 ) -> SyncPager[ResourceServer, ListResourceServerOffsetPaginatedResponseContent]:
54 """
55 Retrieve details of all APIs associated with your tenant.
56
57 Parameters
58 ----------
59 identifiers : typing.Optional[typing.Union[str, typing.Sequence[str]]]
60 An optional filter on the resource server identifier. Must be URL encoded and may be specified multiple times (max 10).<br /><b>e.g.</b> <i>../resource-servers?identifiers=id1&identifiers=id2</i>
61
62 page : typing.Optional[int]
63 Page index of the results to return. First page is 0.
64
65 per_page : typing.Optional[int]
66 Number of results per page.
67
68 include_totals : typing.Optional[bool]
69 Return results inside an object that contains the total result count (true) or as a direct array of results (false, default).
70
71 include_fields : typing.Optional[bool]
72 Whether specified fields are to be included (true) or excluded (false).
73
74 request_options : typing.Optional[RequestOptions]
75 Request-specific configuration.
76
77 Returns
78 -------
79 SyncPager[ResourceServer, ListResourceServerOffsetPaginatedResponseContent]
80 Resource servers successfully retrieved.
81
82 Examples
83 --------
84 from auth0 import Auth0
85
86 client = Auth0(
87 token="YOUR_TOKEN",
88 )
89 response = client.resource_servers.list(
90 identifiers=["identifiers"],
91 page=1,
92 per_page=1,
93 include_totals=True,
94 include_fields=True,
95 )
96 for item in response:
97 yield item
98 # alternatively, you can paginate page-by-page
99 for page in response.iter_pages():
100 yield page
101 """
102 return self._raw_client.list(
103 identifiers=identifiers,
104 page=page,
105 per_page=per_page,
106 include_totals=include_totals,
107 include_fields=include_fields,
108 request_options=request_options,
109 )
110
111 def create(
112 self,
113 *,
114 identifier: str,
115 name: typing.Optional[str] = OMIT,
116 scopes: typing.Optional[typing.Sequence[ResourceServerScope]] = OMIT,
117 signing_alg: typing.Optional[SigningAlgorithmEnum] = OMIT,
118 signing_secret: typing.Optional[str] = OMIT,
119 allow_offline_access: typing.Optional[bool] = OMIT,
120 allow_online_access: typing.Optional[bool] = OMIT,
121 allow_online_access_with_ephemeral_sessions: typing.Optional[bool] = OMIT,
122 token_lifetime: typing.Optional[int] = OMIT,
123 token_dialect: typing.Optional[ResourceServerTokenDialectSchemaEnum] = OMIT,
124 skip_consent_for_verifiable_first_party_clients: typing.Optional[bool] = OMIT,
125 enforce_policies: typing.Optional[bool] = OMIT,
126 token_encryption: typing.Optional[ResourceServerTokenEncryption] = OMIT,
127 consent_policy: typing.Optional[ResourceServerConsentPolicyEnum] = OMIT,
128 authorization_details: typing.Optional[typing.Sequence[typing.Any]] = OMIT,
129 proof_of_possession: typing.Optional[ResourceServerProofOfPossession] = OMIT,
130 subject_type_authorization: typing.Optional[ResourceServerSubjectTypeAuthorization] = OMIT,
131 authorization_policy: typing.Optional[ResourceServerAuthorizationPolicy] = OMIT,
132 request_options: typing.Optional[RequestOptions] = None,
133 ) -> CreateResourceServerResponseContent:
134 """
135 Create a new API associated with your tenant. Note that all new APIs must be registered with Auth0. For more information, read <a href="https://www.auth0.com/docs/get-started/apis"> APIs</a>.
136
137 Parameters
138 ----------
139 identifier : str
140 Unique identifier for the API used as the audience parameter on authorization calls. Can not be changed once set.
141
142 name : typing.Optional[str]
143 Friendly name for this resource server. Can not contain `<` or `>` characters.
144
145 scopes : typing.Optional[typing.Sequence[ResourceServerScope]]
146 List of permissions (scopes) that this API uses.
147
148 signing_alg : typing.Optional[SigningAlgorithmEnum]
149
150 signing_secret : typing.Optional[str]
151 Secret used to sign tokens when using symmetric algorithms (HS256).
152
153 allow_offline_access : typing.Optional[bool]
154 Whether refresh tokens can be issued for this API (true) or not (false).
155
156 allow_online_access : typing.Optional[bool]
157 Whether Online Refresh Tokens can be issued for this API (true) or not (false).
158
159 allow_online_access_with_ephemeral_sessions : typing.Optional[bool]
160 Whether Online Refresh Tokens can be issued even when sessions are configured as ephemeral (true) or not (false).
161
162 token_lifetime : typing.Optional[int]
163 Expiration value (in seconds) for access tokens issued for this API from the token endpoint.
164
165 token_dialect : typing.Optional[ResourceServerTokenDialectSchemaEnum]
166
167 skip_consent_for_verifiable_first_party_clients : typing.Optional[bool]
168 Whether to skip user consent for applications flagged as first party (true) or not (false).
169
170 enforce_policies : typing.Optional[bool]
171 Whether to enforce authorization policies (true) or to ignore them (false).
172
173 token_encryption : typing.Optional[ResourceServerTokenEncryption]
174
175 consent_policy : typing.Optional[ResourceServerConsentPolicyEnum]
176
177 authorization_details : typing.Optional[typing.Sequence[typing.Any]]
178
179 proof_of_possession : typing.Optional[ResourceServerProofOfPossession]
180
181 subject_type_authorization : typing.Optional[ResourceServerSubjectTypeAuthorization]
182
183 authorization_policy : typing.Optional[ResourceServerAuthorizationPolicy]
184
185 request_options : typing.Optional[RequestOptions]
186 Request-specific configuration.
187
188 Returns
189 -------
190 CreateResourceServerResponseContent
191 Resource server successfully created.
192
193 Examples
194 --------
195 from auth0 import Auth0
196
197 client = Auth0(
198 token="YOUR_TOKEN",
199 )
200 client.resource_servers.create(
201 identifier="identifier",
202 )
203 """
204 _response = self._raw_client.create(
205 identifier=identifier,
206 name=name,
207 scopes=scopes,
208 signing_alg=signing_alg,
209 signing_secret=signing_secret,
210 allow_offline_access=allow_offline_access,
211 allow_online_access=allow_online_access,
212 allow_online_access_with_ephemeral_sessions=allow_online_access_with_ephemeral_sessions,
213 token_lifetime=token_lifetime,
214 token_dialect=token_dialect,
215 skip_consent_for_verifiable_first_party_clients=skip_consent_for_verifiable_first_party_clients,
216 enforce_policies=enforce_policies,
217 token_encryption=token_encryption,
218 consent_policy=consent_policy,
219 authorization_details=authorization_details,
220 proof_of_possession=proof_of_possession,
221 subject_type_authorization=subject_type_authorization,
222 authorization_policy=authorization_policy,
223 request_options=request_options,
224 )
225 return _response.data
226
227 def get(
228 self,
229 id: str,
230 *,
231 include_fields: typing.Optional[bool] = None,
232 request_options: typing.Optional[RequestOptions] = None,
233 ) -> GetResourceServerResponseContent:
234 """
235 Retrieve <a href="https://auth0.com/docs/apis">API</a> details with the given ID.
236
237 Parameters
238 ----------
239 id : str
240 ID or audience of the resource server to retrieve.
241
242 include_fields : typing.Optional[bool]
243 Whether specified fields are to be included (true) or excluded (false).
244
245 request_options : typing.Optional[RequestOptions]
246 Request-specific configuration.
247
248 Returns
249 -------
250 GetResourceServerResponseContent
251 Resource server successfully retrieved.
252
253 Examples
254 --------
255 from auth0 import Auth0
256
257 client = Auth0(
258 token="YOUR_TOKEN",
259 )
260 client.resource_servers.get(
261 id="id",
262 include_fields=True,
263 )
264 """
265 _response = self._raw_client.get(id, include_fields=include_fields, request_options=request_options)
266 return _response.data
267
268 def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
269 """
270 Delete an existing API by ID. For more information, read <a href="https://www.auth0.com/docs/get-started/apis/api-settings">API Settings</a>.
271
272 Parameters
273 ----------
274 id : str
275 ID or the audience of the resource server to delete.
276
277 request_options : typing.Optional[RequestOptions]
278 Request-specific configuration.
279
280 Returns
281 -------
282 None
283
284 Examples
285 --------
286 from auth0 import Auth0
287
288 client = Auth0(
289 token="YOUR_TOKEN",
290 )
291 client.resource_servers.delete(
292 id="id",
293 )
294 """
295 _response = self._raw_client.delete(id, request_options=request_options)
296 return _response.data
297
298 def update(
299 self,
300 id: str,
301 *,
302 name: typing.Optional[str] = OMIT,
303 scopes: typing.Optional[typing.Sequence[ResourceServerScope]] = OMIT,
304 signing_alg: typing.Optional[SigningAlgorithmEnum] = OMIT,
305 signing_secret: typing.Optional[str] = OMIT,
306 skip_consent_for_verifiable_first_party_clients: typing.Optional[bool] = OMIT,
307 allow_offline_access: typing.Optional[bool] = OMIT,
308 allow_online_access: typing.Optional[bool] = OMIT,
309 allow_online_access_with_ephemeral_sessions: typing.Optional[bool] = OMIT,
310 token_lifetime: typing.Optional[int] = OMIT,
311 token_dialect: typing.Optional[ResourceServerTokenDialectSchemaEnum] = OMIT,
312 enforce_policies: typing.Optional[bool] = OMIT,
313 token_encryption: typing.Optional[ResourceServerTokenEncryption] = OMIT,
314 consent_policy: typing.Optional[ResourceServerConsentPolicyEnum] = OMIT,
315 authorization_details: typing.Optional[typing.Sequence[typing.Any]] = OMIT,
316 proof_of_possession: typing.Optional[ResourceServerProofOfPossession] = OMIT,
317 subject_type_authorization: typing.Optional[ResourceServerSubjectTypeAuthorization] = OMIT,
318 authorization_policy: typing.Optional[ResourceServerAuthorizationPolicy] = OMIT,
319 request_options: typing.Optional[RequestOptions] = None,
320 ) -> UpdateResourceServerResponseContent:
321 """
322 Change an existing API setting by resource server ID. For more information, read <a href="https://www.auth0.com/docs/get-started/apis/api-settings">API Settings</a>.
323
324 Parameters
325 ----------
326 id : str
327 ID or audience of the resource server to update.
328
329 name : typing.Optional[str]
330 Friendly name for this resource server. Can not contain `<` or `>` characters.
331
332 scopes : typing.Optional[typing.Sequence[ResourceServerScope]]
333 List of permissions (scopes) that this API uses.
334
335 signing_alg : typing.Optional[SigningAlgorithmEnum]
336
337 signing_secret : typing.Optional[str]
338 Secret used to sign tokens when using symmetric algorithms (HS256).
339
340 skip_consent_for_verifiable_first_party_clients : typing.Optional[bool]
341 Whether to skip user consent for applications flagged as first party (true) or not (false).
342
343 allow_offline_access : typing.Optional[bool]
344 Whether refresh tokens can be issued for this API (true) or not (false).
345
346 allow_online_access : typing.Optional[bool]
347 Whether Online Refresh Tokens can be issued for this API (true) or not (false).
348
349 allow_online_access_with_ephemeral_sessions : typing.Optional[bool]
350 Whether Online Refresh Tokens can be issued even when sessions are configured as ephemeral (true) or not (false).
351
352 token_lifetime : typing.Optional[int]
353 Expiration value (in seconds) for access tokens issued for this API from the token endpoint.
354
355 token_dialect : typing.Optional[ResourceServerTokenDialectSchemaEnum]
356
357 enforce_policies : typing.Optional[bool]
358 Whether authorization policies are enforced (true) or not enforced (false).
359
360 token_encryption : typing.Optional[ResourceServerTokenEncryption]
361
362 consent_policy : typing.Optional[ResourceServerConsentPolicyEnum]
363
364 authorization_details : typing.Optional[typing.Sequence[typing.Any]]
365
366 proof_of_possession : typing.Optional[ResourceServerProofOfPossession]
367
368 subject_type_authorization : typing.Optional[ResourceServerSubjectTypeAuthorization]
369
370 authorization_policy : typing.Optional[ResourceServerAuthorizationPolicy]
371
372 request_options : typing.Optional[RequestOptions]
373 Request-specific configuration.
374
375 Returns
376 -------
377 UpdateResourceServerResponseContent
378 Resource server successfully updated.
379
380 Examples
381 --------
382 from auth0 import Auth0
383
384 client = Auth0(
385 token="YOUR_TOKEN",
386 )
387 client.resource_servers.update(
388 id="id",
389 )
390 """
391 _response = self._raw_client.update(
392 id,
393 name=name,
394 scopes=scopes,
395 signing_alg=signing_alg,
396 signing_secret=signing_secret,
397 skip_consent_for_verifiable_first_party_clients=skip_consent_for_verifiable_first_party_clients,
398 allow_offline_access=allow_offline_access,
399 allow_online_access=allow_online_access,
400 allow_online_access_with_ephemeral_sessions=allow_online_access_with_ephemeral_sessions,
401 token_lifetime=token_lifetime,
402 token_dialect=token_dialect,
403 enforce_policies=enforce_policies,
404 token_encryption=token_encryption,
405 consent_policy=consent_policy,
406 authorization_details=authorization_details,
407 proof_of_possession=proof_of_possession,
408 subject_type_authorization=subject_type_authorization,
409 authorization_policy=authorization_policy,
410 request_options=request_options,
411 )
412 return _response.data
413
414
415 class AsyncResourceServersClient:
416 def __init__(self, *, client_wrapper: AsyncClientWrapper):
417 self._raw_client = AsyncRawResourceServersClient(client_wrapper=client_wrapper)
418
419 @property
420 def with_raw_response(self) -> AsyncRawResourceServersClient:
421 """
422 Retrieves a raw implementation of this client that returns raw responses.
423
424 Returns
425 -------
426 AsyncRawResourceServersClient
427 """
428 return self._raw_client
429
430 async def list(
431 self,
432 *,
433 identifiers: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
434 page: typing.Optional[int] = 0,
435 per_page: typing.Optional[int] = 50,
436 include_totals: typing.Optional[bool] = True,
437 include_fields: typing.Optional[bool] = None,
438 request_options: typing.Optional[RequestOptions] = None,
439 ) -> AsyncPager[ResourceServer, ListResourceServerOffsetPaginatedResponseContent]:
440 """
441 Retrieve details of all APIs associated with your tenant.
442
443 Parameters
444 ----------
445 identifiers : typing.Optional[typing.Union[str, typing.Sequence[str]]]
446 An optional filter on the resource server identifier. Must be URL encoded and may be specified multiple times (max 10).<br /><b>e.g.</b> <i>../resource-servers?identifiers=id1&identifiers=id2</i>
447
448 page : typing.Optional[int]
449 Page index of the results to return. First page is 0.
450
451 per_page : typing.Optional[int]
452 Number of results per page.
453
454 include_totals : typing.Optional[bool]
455 Return results inside an object that contains the total result count (true) or as a direct array of results (false, default).
456
457 include_fields : typing.Optional[bool]
458 Whether specified fields are to be included (true) or excluded (false).
459
460 request_options : typing.Optional[RequestOptions]
461 Request-specific configuration.
462
463 Returns
464 -------
465 AsyncPager[ResourceServer, ListResourceServerOffsetPaginatedResponseContent]
466 Resource servers successfully retrieved.
467
468 Examples
469 --------
470 import asyncio
471
472 from auth0 import AsyncAuth0
473
474 client = AsyncAuth0(
475 token="YOUR_TOKEN",
476 )
477
478
479 async def main() -> None:
480 response = await client.resource_servers.list(
481 identifiers=["identifiers"],
482 page=1,
483 per_page=1,
484 include_totals=True,
485 include_fields=True,
486 )
487 async for item in response:
488 yield item
489
490 # alternatively, you can paginate page-by-page
491 async for page in response.iter_pages():
492 yield page
493
494
495 asyncio.run(main())
496 """
497 return await self._raw_client.list(
498 identifiers=identifiers,
499 page=page,
500 per_page=per_page,
501 include_totals=include_totals,
502 include_fields=include_fields,
503 request_options=request_options,
504 )
505
506 async def create(
507 self,
508 *,
509 identifier: str,
510 name: typing.Optional[str] = OMIT,
511 scopes: typing.Optional[typing.Sequence[ResourceServerScope]] = OMIT,
512 signing_alg: typing.Optional[SigningAlgorithmEnum] = OMIT,
513 signing_secret: typing.Optional[str] = OMIT,
514 allow_offline_access: typing.Optional[bool] = OMIT,
515 allow_online_access: typing.Optional[bool] = OMIT,
516 allow_online_access_with_ephemeral_sessions: typing.Optional[bool] = OMIT,
517 token_lifetime: typing.Optional[int] = OMIT,
518 token_dialect: typing.Optional[ResourceServerTokenDialectSchemaEnum] = OMIT,
519 skip_consent_for_verifiable_first_party_clients: typing.Optional[bool] = OMIT,
520 enforce_policies: typing.Optional[bool] = OMIT,
521 token_encryption: typing.Optional[ResourceServerTokenEncryption] = OMIT,
522 consent_policy: typing.Optional[ResourceServerConsentPolicyEnum] = OMIT,
523 authorization_details: typing.Optional[typing.Sequence[typing.Any]] = OMIT,
524 proof_of_possession: typing.Optional[ResourceServerProofOfPossession] = OMIT,
525 subject_type_authorization: typing.Optional[ResourceServerSubjectTypeAuthorization] = OMIT,
526 authorization_policy: typing.Optional[ResourceServerAuthorizationPolicy] = OMIT,
527 request_options: typing.Optional[RequestOptions] = None,
528 ) -> CreateResourceServerResponseContent:
529 """
530 Create a new API associated with your tenant. Note that all new APIs must be registered with Auth0. For more information, read <a href="https://www.auth0.com/docs/get-started/apis"> APIs</a>.
531
532 Parameters
533 ----------
534 identifier : str
535 Unique identifier for the API used as the audience parameter on authorization calls. Can not be changed once set.
536
537 name : typing.Optional[str]
538 Friendly name for this resource server. Can not contain `<` or `>` characters.
539
540 scopes : typing.Optional[typing.Sequence[ResourceServerScope]]
541 List of permissions (scopes) that this API uses.
542
543 signing_alg : typing.Optional[SigningAlgorithmEnum]
544
545 signing_secret : typing.Optional[str]
546 Secret used to sign tokens when using symmetric algorithms (HS256).
547
548 allow_offline_access : typing.Optional[bool]
549 Whether refresh tokens can be issued for this API (true) or not (false).
550
551 allow_online_access : typing.Optional[bool]
552 Whether Online Refresh Tokens can be issued for this API (true) or not (false).
553
554 allow_online_access_with_ephemeral_sessions : typing.Optional[bool]
555 Whether Online Refresh Tokens can be issued even when sessions are configured as ephemeral (true) or not (false).
556
557 token_lifetime : typing.Optional[int]
558 Expiration value (in seconds) for access tokens issued for this API from the token endpoint.
559
560 token_dialect : typing.Optional[ResourceServerTokenDialectSchemaEnum]
561
562 skip_consent_for_verifiable_first_party_clients : typing.Optional[bool]
563 Whether to skip user consent for applications flagged as first party (true) or not (false).
564
565 enforce_policies : typing.Optional[bool]
566 Whether to enforce authorization policies (true) or to ignore them (false).
567
568 token_encryption : typing.Optional[ResourceServerTokenEncryption]
569
570 consent_policy : typing.Optional[ResourceServerConsentPolicyEnum]
571
572 authorization_details : typing.Optional[typing.Sequence[typing.Any]]
573
574 proof_of_possession : typing.Optional[ResourceServerProofOfPossession]
575
576 subject_type_authorization : typing.Optional[ResourceServerSubjectTypeAuthorization]
577
578 authorization_policy : typing.Optional[ResourceServerAuthorizationPolicy]
579
580 request_options : typing.Optional[RequestOptions]
581 Request-specific configuration.
582
583 Returns
584 -------
585 CreateResourceServerResponseContent
586 Resource server successfully created.
587
588 Examples
589 --------
590 import asyncio
591
592 from auth0 import AsyncAuth0
593
594 client = AsyncAuth0(
595 token="YOUR_TOKEN",
596 )
597
598
599 async def main() -> None:
600 await client.resource_servers.create(
601 identifier="identifier",
602 )
603
604
605 asyncio.run(main())
606 """
607 _response = await self._raw_client.create(
608 identifier=identifier,
609 name=name,
610 scopes=scopes,
611 signing_alg=signing_alg,
612 signing_secret=signing_secret,
613 allow_offline_access=allow_offline_access,
614 allow_online_access=allow_online_access,
615 allow_online_access_with_ephemeral_sessions=allow_online_access_with_ephemeral_sessions,
616 token_lifetime=token_lifetime,
617 token_dialect=token_dialect,
618 skip_consent_for_verifiable_first_party_clients=skip_consent_for_verifiable_first_party_clients,
619 enforce_policies=enforce_policies,
620 token_encryption=token_encryption,
621 consent_policy=consent_policy,
622 authorization_details=authorization_details,
623 proof_of_possession=proof_of_possession,
624 subject_type_authorization=subject_type_authorization,
625 authorization_policy=authorization_policy,
626 request_options=request_options,
627 )
628 return _response.data
629
630 async def get(
631 self,
632 id: str,
633 *,
634 include_fields: typing.Optional[bool] = None,
635 request_options: typing.Optional[RequestOptions] = None,
636 ) -> GetResourceServerResponseContent:
637 """
638 Retrieve <a href="https://auth0.com/docs/apis">API</a> details with the given ID.
639
640 Parameters
641 ----------
642 id : str
643 ID or audience of the resource server to retrieve.
644
645 include_fields : typing.Optional[bool]
646 Whether specified fields are to be included (true) or excluded (false).
647
648 request_options : typing.Optional[RequestOptions]
649 Request-specific configuration.
650
651 Returns
652 -------
653 GetResourceServerResponseContent
654 Resource server successfully retrieved.
655
656 Examples
657 --------
658 import asyncio
659
660 from auth0 import AsyncAuth0
661
662 client = AsyncAuth0(
663 token="YOUR_TOKEN",
664 )
665
666
667 async def main() -> None:
668 await client.resource_servers.get(
669 id="id",
670 include_fields=True,
671 )
672
673
674 asyncio.run(main())
675 """
676 _response = await self._raw_client.get(id, include_fields=include_fields, request_options=request_options)
677 return _response.data
678
679 async def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
680 """
681 Delete an existing API by ID. For more information, read <a href="https://www.auth0.com/docs/get-started/apis/api-settings">API Settings</a>.
682
683 Parameters
684 ----------
685 id : str
686 ID or the audience of the resource server to delete.
687
688 request_options : typing.Optional[RequestOptions]
689 Request-specific configuration.
690
691 Returns
692 -------
693 None
694
695 Examples
696 --------
697 import asyncio
698
699 from auth0 import AsyncAuth0
700
701 client = AsyncAuth0(
702 token="YOUR_TOKEN",
703 )
704
705
706 async def main() -> None:
707 await client.resource_servers.delete(
708 id="id",
709 )
710
711
712 asyncio.run(main())
713 """
714 _response = await self._raw_client.delete(id, request_options=request_options)
715 return _response.data
716
717 async def update(
718 self,
719 id: str,
720 *,
721 name: typing.Optional[str] = OMIT,
722 scopes: typing.Optional[typing.Sequence[ResourceServerScope]] = OMIT,
723 signing_alg: typing.Optional[SigningAlgorithmEnum] = OMIT,
724 signing_secret: typing.Optional[str] = OMIT,
725 skip_consent_for_verifiable_first_party_clients: typing.Optional[bool] = OMIT,
726 allow_offline_access: typing.Optional[bool] = OMIT,
727 allow_online_access: typing.Optional[bool] = OMIT,
728 allow_online_access_with_ephemeral_sessions: typing.Optional[bool] = OMIT,
729 token_lifetime: typing.Optional[int] = OMIT,
730 token_dialect: typing.Optional[ResourceServerTokenDialectSchemaEnum] = OMIT,
731 enforce_policies: typing.Optional[bool] = OMIT,
732 token_encryption: typing.Optional[ResourceServerTokenEncryption] = OMIT,
733 consent_policy: typing.Optional[ResourceServerConsentPolicyEnum] = OMIT,
734 authorization_details: typing.Optional[typing.Sequence[typing.Any]] = OMIT,
735 proof_of_possession: typing.Optional[ResourceServerProofOfPossession] = OMIT,
736 subject_type_authorization: typing.Optional[ResourceServerSubjectTypeAuthorization] = OMIT,
737 authorization_policy: typing.Optional[ResourceServerAuthorizationPolicy] = OMIT,
738 request_options: typing.Optional[RequestOptions] = None,
739 ) -> UpdateResourceServerResponseContent:
740 """
741 Change an existing API setting by resource server ID. For more information, read <a href="https://www.auth0.com/docs/get-started/apis/api-settings">API Settings</a>.
742
743 Parameters
744 ----------
745 id : str
746 ID or audience of the resource server to update.
747
748 name : typing.Optional[str]
749 Friendly name for this resource server. Can not contain `<` or `>` characters.
750
751 scopes : typing.Optional[typing.Sequence[ResourceServerScope]]
752 List of permissions (scopes) that this API uses.
753
754 signing_alg : typing.Optional[SigningAlgorithmEnum]
755
756 signing_secret : typing.Optional[str]
757 Secret used to sign tokens when using symmetric algorithms (HS256).
758
759 skip_consent_for_verifiable_first_party_clients : typing.Optional[bool]
760 Whether to skip user consent for applications flagged as first party (true) or not (false).
761
762 allow_offline_access : typing.Optional[bool]
763 Whether refresh tokens can be issued for this API (true) or not (false).
764
765 allow_online_access : typing.Optional[bool]
766 Whether Online Refresh Tokens can be issued for this API (true) or not (false).
767
768 allow_online_access_with_ephemeral_sessions : typing.Optional[bool]
769 Whether Online Refresh Tokens can be issued even when sessions are configured as ephemeral (true) or not (false).
770
771 token_lifetime : typing.Optional[int]
772 Expiration value (in seconds) for access tokens issued for this API from the token endpoint.
773
774 token_dialect : typing.Optional[ResourceServerTokenDialectSchemaEnum]
775
776 enforce_policies : typing.Optional[bool]
777 Whether authorization policies are enforced (true) or not enforced (false).
778
779 token_encryption : typing.Optional[ResourceServerTokenEncryption]
780
781 consent_policy : typing.Optional[ResourceServerConsentPolicyEnum]
782
783 authorization_details : typing.Optional[typing.Sequence[typing.Any]]
784
785 proof_of_possession : typing.Optional[ResourceServerProofOfPossession]
786
787 subject_type_authorization : typing.Optional[ResourceServerSubjectTypeAuthorization]
788
789 authorization_policy : typing.Optional[ResourceServerAuthorizationPolicy]
790
791 request_options : typing.Optional[RequestOptions]
792 Request-specific configuration.
793
794 Returns
795 -------
796 UpdateResourceServerResponseContent
797 Resource server successfully updated.
798
799 Examples
800 --------
801 import asyncio
802
803 from auth0 import AsyncAuth0
804
805 client = AsyncAuth0(
806 token="YOUR_TOKEN",
807 )
808
809
810 async def main() -> None:
811 await client.resource_servers.update(
812 id="id",
813 )
814
815
816 asyncio.run(main())
817 """
818 _response = await self._raw_client.update(
819 id,
820 name=name,
821 scopes=scopes,
822 signing_alg=signing_alg,
823 signing_secret=signing_secret,
824 skip_consent_for_verifiable_first_party_clients=skip_consent_for_verifiable_first_party_clients,
825 allow_offline_access=allow_offline_access,
826 allow_online_access=allow_online_access,
827 allow_online_access_with_ephemeral_sessions=allow_online_access_with_ephemeral_sessions,
828 token_lifetime=token_lifetime,
829 token_dialect=token_dialect,
830 enforce_policies=enforce_policies,
831 token_encryption=token_encryption,
832 consent_policy=consent_policy,
833 authorization_details=authorization_details,
834 proof_of_possession=proof_of_possession,
835 subject_type_authorization=subject_type_authorization,
836 authorization_policy=authorization_policy,
837 request_options=request_options,
838 )
839 return _response.data