# This file was auto-generated by Fern from our API Definition. from __future__ import annotations import typing from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from ...core.pagination import AsyncPager, SyncPager from ...core.request_options import RequestOptions from ...types.list_user_effective_roles_response_content import ListUserEffectiveRolesResponseContent from ...types.user_effective_role import UserEffectiveRole from .raw_client import AsyncRawEffectiveRolesClient, RawEffectiveRolesClient if typing.TYPE_CHECKING: from .sources.client import AsyncSourcesClient, SourcesClient class EffectiveRolesClient: def __init__(self, *, client_wrapper: SyncClientWrapper): self._raw_client = RawEffectiveRolesClient(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._sources: typing.Optional[SourcesClient] = None @property def with_raw_response(self) -> RawEffectiveRolesClient: """ Retrieves a raw implementation of this client that returns raw responses. Returns ------- RawEffectiveRolesClient """ return self._raw_client def list( self, id: str, *, from_: typing.Optional[str] = None, take: typing.Optional[int] = 50, request_options: typing.Optional[RequestOptions] = None, ) -> SyncPager[UserEffectiveRole, ListUserEffectiveRolesResponseContent]: """ Retrieve detailed list of effective roles for a user, including roles assigned directly and through group memberships. Parameters ---------- id : str ID of the user to list effective roles for. from_ : typing.Optional[str] Optional Id from which to start selection. take : typing.Optional[int] Number of results per page. Defaults to 50. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SyncPager[UserEffectiveRole, ListUserEffectiveRolesResponseContent] User's effective roles successfully retrieved. Examples -------- from auth0 import Auth0 client = Auth0( token="YOUR_TOKEN", ) response = client.users.effective_roles.list( id="id", from_="from", take=1, ) for item in response: yield item # alternatively, you can paginate page-by-page for page in response.iter_pages(): yield page """ return self._raw_client.list(id, from_=from_, take=take, request_options=request_options) @property def sources(self): if self._sources is None: from .sources.client import SourcesClient # noqa: E402 self._sources = SourcesClient(client_wrapper=self._client_wrapper) return self._sources class AsyncEffectiveRolesClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): self._raw_client = AsyncRawEffectiveRolesClient(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._sources: typing.Optional[AsyncSourcesClient] = None @property def with_raw_response(self) -> AsyncRawEffectiveRolesClient: """ Retrieves a raw implementation of this client that returns raw responses. Returns ------- AsyncRawEffectiveRolesClient """ return self._raw_client async def list( self, id: str, *, from_: typing.Optional[str] = None, take: typing.Optional[int] = 50, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncPager[UserEffectiveRole, ListUserEffectiveRolesResponseContent]: """ Retrieve detailed list of effective roles for a user, including roles assigned directly and through group memberships. Parameters ---------- id : str ID of the user to list effective roles for. from_ : typing.Optional[str] Optional Id from which to start selection. take : typing.Optional[int] Number of results per page. Defaults to 50. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncPager[UserEffectiveRole, ListUserEffectiveRolesResponseContent] User's effective roles successfully retrieved. Examples -------- import asyncio from auth0 import AsyncAuth0 client = AsyncAuth0( token="YOUR_TOKEN", ) async def main() -> None: response = await client.users.effective_roles.list( id="id", from_="from", take=1, ) async for item in response: yield item # alternatively, you can paginate page-by-page async for page in response.iter_pages(): yield page asyncio.run(main()) """ return await self._raw_client.list(id, from_=from_, take=take, request_options=request_options) @property def sources(self): if self._sources is None: from .sources.client import AsyncSourcesClient # noqa: E402 self._sources = AsyncSourcesClient(client_wrapper=self._client_wrapper) return self._sources