Debian Codegraph @

src/auth0/management/users/effective_roles/sources/groups/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.group import Group
9 from .....types.list_user_role_source_groups_response_content import ListUserRoleSourceGroupsResponseContent
10 from .raw_client import AsyncRawGroupsClient, RawGroupsClient
11
12
13 class GroupsClient:
14 def __init__(self, *, client_wrapper: SyncClientWrapper):
15 self._raw_client = RawGroupsClient(client_wrapper=client_wrapper)
16
17 @property
18 def with_raw_response(self) -> RawGroupsClient:
19 """
20 Retrieves a raw implementation of this client that returns raw responses.
21
22 Returns
23 -------
24 RawGroupsClient
25 """
26 return self._raw_client
27
28 def list(
29 self,
30 id: str,
31 *,
32 role_id: str,
33 from_: typing.Optional[str] = None,
34 take: typing.Optional[int] = 50,
35 request_options: typing.Optional[RequestOptions] = None,
36 ) -> SyncPager[Group, ListUserRoleSourceGroupsResponseContent]:
37 """
38 Lists the groups that grant a user a specific role.
39
40 Parameters
41 ----------
42 id : str
43 ID of the user to list role source groups for.
44
45 role_id : str
46 ID of the role to get source groups for.
47
48 from_ : typing.Optional[str]
49 Optional Id from which to start selection.
50
51 take : typing.Optional[int]
52 Number of results per page. Defaults to 50.
53
54 request_options : typing.Optional[RequestOptions]
55 Request-specific configuration.
56
57 Returns
58 -------
59 SyncPager[Group, ListUserRoleSourceGroupsResponseContent]
60 User's role source groups successfully retrieved.
61
62 Examples
63 --------
64 from auth0 import Auth0
65
66 client = Auth0(
67 token="YOUR_TOKEN",
68 )
69 response = client.users.effective_roles.sources.groups.list(
70 id="id",
71 role_id="role_id",
72 from_="from",
73 take=1,
74 )
75 for item in response:
76 yield item
77 # alternatively, you can paginate page-by-page
78 for page in response.iter_pages():
79 yield page
80 """
81 return self._raw_client.list(id, role_id=role_id, from_=from_, take=take, request_options=request_options)
82
83
84 class AsyncGroupsClient:
85 def __init__(self, *, client_wrapper: AsyncClientWrapper):
86 self._raw_client = AsyncRawGroupsClient(client_wrapper=client_wrapper)
87
88 @property
89 def with_raw_response(self) -> AsyncRawGroupsClient:
90 """
91 Retrieves a raw implementation of this client that returns raw responses.
92
93 Returns
94 -------
95 AsyncRawGroupsClient
96 """
97 return self._raw_client
98
99 async def list(
100 self,
101 id: str,
102 *,
103 role_id: str,
104 from_: typing.Optional[str] = None,
105 take: typing.Optional[int] = 50,
106 request_options: typing.Optional[RequestOptions] = None,
107 ) -> AsyncPager[Group, ListUserRoleSourceGroupsResponseContent]:
108 """
109 Lists the groups that grant a user a specific role.
110
111 Parameters
112 ----------
113 id : str
114 ID of the user to list role source groups for.
115
116 role_id : str
117 ID of the role to get source groups for.
118
119 from_ : typing.Optional[str]
120 Optional Id from which to start selection.
121
122 take : typing.Optional[int]
123 Number of results per page. Defaults to 50.
124
125 request_options : typing.Optional[RequestOptions]
126 Request-specific configuration.
127
128 Returns
129 -------
130 AsyncPager[Group, ListUserRoleSourceGroupsResponseContent]
131 User's role source groups successfully retrieved.
132
133 Examples
134 --------
135 import asyncio
136
137 from auth0 import AsyncAuth0
138
139 client = AsyncAuth0(
140 token="YOUR_TOKEN",
141 )
142
143
144 async def main() -> None:
145 response = await client.users.effective_roles.sources.groups.list(
146 id="id",
147 role_id="role_id",
148 from_="from",
149 take=1,
150 )
151 async for item in response:
152 yield item
153
154 # alternatively, you can paginate page-by-page
155 async for page in response.iter_pages():
156 yield page
157
158
159 asyncio.run(main())
160 """
161 return await self._raw_client.list(id, role_id=role_id, from_=from_, take=take, request_options=request_options)