Debian Codegraph @

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