44
55from pydantic import Field , StrictFloat , StrictInt , StrictStr
66
7+ from conductor .asyncio_client .adapters .models .granted_access_response_adapter import (
8+ GrantedAccessResponseAdapter ,
9+ )
710from conductor .asyncio_client .adapters .models .group_adapter import GroupAdapter
811from conductor .asyncio_client .adapters .models .upsert_group_request_adapter import (
912 UpsertGroupRequestAdapter ,
1013)
1114from conductor .asyncio_client .http .api import GroupResourceApi
15+ from conductor .asyncio_client .adapters .utils import convert_list_to_adapter , convert_to_adapter
16+
1217
18+ class GroupResourceApiAdapter :
19+ """Adapter for GroupResourceApi that converts between generated models and adapters."""
1320
14- class GroupResourceApiAdapter (GroupResourceApi ):
15- async def list_groups ( # type: ignore[override]
21+ def __init__ (self , api_client ):
22+ self ._api = GroupResourceApi (api_client )
23+
24+ async def list_groups (
1625 self ,
1726 _request_timeout : Union [
1827 None ,
@@ -24,14 +33,15 @@ async def list_groups( # type: ignore[override]
2433 _headers : Optional [Dict [StrictStr , Any ]] = None ,
2534 _host_index : Annotated [StrictInt , Field (ge = 0 , le = 0 )] = 0 ,
2635 ) -> List [GroupAdapter ]:
27- result = await super ().list_groups (
36+ """List all groups, returning GroupAdapter instances."""
37+ result = await self ._api .list_groups (
2838 _request_timeout = _request_timeout ,
2939 _request_auth = _request_auth ,
3040 _content_type = _content_type ,
3141 _headers = _headers ,
3242 _host_index = _host_index ,
3343 )
34- return result # type: ignore[return-value]
44+ return convert_list_to_adapter ( result , GroupAdapter )
3545
3646 async def get_group (
3747 self ,
@@ -46,20 +56,21 @@ async def get_group(
4656 _headers : Optional [Dict [StrictStr , Any ]] = None ,
4757 _host_index : Annotated [StrictInt , Field (ge = 0 , le = 0 )] = 0 ,
4858 ) -> GroupAdapter :
49- result = await super ().get_group (
59+ """Get a group by ID, returning a GroupAdapter instance."""
60+ result = await self ._api .get_group (
5061 id ,
5162 _request_timeout = _request_timeout ,
5263 _request_auth = _request_auth ,
5364 _content_type = _content_type ,
5465 _headers = _headers ,
5566 _host_index = _host_index ,
5667 )
57- return result # type: ignore[return-value]
68+ return convert_to_adapter ( result , GroupAdapter )
5869
5970 async def upsert_group (
6071 self ,
6172 id : StrictStr ,
62- upsert_group_request : UpsertGroupRequestAdapter , # type: ignore[override]
73+ upsert_group_request : UpsertGroupRequestAdapter ,
6374 _request_timeout : Union [
6475 None ,
6576 Annotated [StrictFloat , Field (gt = 0 )],
@@ -70,7 +81,8 @@ async def upsert_group(
7081 _headers : Optional [Dict [StrictStr , Any ]] = None ,
7182 _host_index : Annotated [StrictInt , Field (ge = 0 , le = 0 )] = 0 ,
7283 ) -> GroupAdapter :
73- result = await super ().upsert_group (
84+ """Create or update a group, returning a GroupAdapter instance."""
85+ result = await self ._api .upsert_group (
7486 id ,
7587 upsert_group_request ,
7688 _request_timeout = _request_timeout ,
@@ -79,5 +91,174 @@ async def upsert_group(
7991 _headers = _headers ,
8092 _host_index = _host_index ,
8193 )
94+ return convert_to_adapter (result , GroupAdapter )
95+
96+ async def delete_group (
97+ self ,
98+ id : StrictStr ,
99+ _request_timeout : Union [
100+ None ,
101+ Annotated [StrictFloat , Field (gt = 0 )],
102+ Tuple [Annotated [StrictFloat , Field (gt = 0 )], Annotated [StrictFloat , Field (gt = 0 )]],
103+ ] = None ,
104+ _request_auth : Optional [Dict [StrictStr , Any ]] = None ,
105+ _content_type : Optional [StrictStr ] = None ,
106+ _headers : Optional [Dict [StrictStr , Any ]] = None ,
107+ _host_index : Annotated [StrictInt , Field (ge = 0 , le = 0 )] = 0 ,
108+ ) -> None :
109+ """Delete a group by ID."""
110+ await self ._api .delete_group (
111+ id ,
112+ _request_timeout = _request_timeout ,
113+ _request_auth = _request_auth ,
114+ _content_type = _content_type ,
115+ _headers = _headers ,
116+ _host_index = _host_index ,
117+ )
82118
83- return result # type: ignore[return-value]
119+ async def add_user_to_group (
120+ self ,
121+ group_id : StrictStr ,
122+ user_id : StrictStr ,
123+ _request_timeout : Union [
124+ None ,
125+ Annotated [StrictFloat , Field (gt = 0 )],
126+ Tuple [Annotated [StrictFloat , Field (gt = 0 )], Annotated [StrictFloat , Field (gt = 0 )]],
127+ ] = None ,
128+ _request_auth : Optional [Dict [StrictStr , Any ]] = None ,
129+ _content_type : Optional [StrictStr ] = None ,
130+ _headers : Optional [Dict [StrictStr , Any ]] = None ,
131+ _host_index : Annotated [StrictInt , Field (ge = 0 , le = 0 )] = 0 ,
132+ ) -> object :
133+ """Add a user to a group."""
134+ return await self ._api .add_user_to_group (
135+ group_id ,
136+ user_id ,
137+ _request_timeout = _request_timeout ,
138+ _request_auth = _request_auth ,
139+ _content_type = _content_type ,
140+ _headers = _headers ,
141+ _host_index = _host_index ,
142+ )
143+
144+ async def remove_user_from_group (
145+ self ,
146+ group_id : StrictStr ,
147+ user_id : StrictStr ,
148+ _request_timeout : Union [
149+ None ,
150+ Annotated [StrictFloat , Field (gt = 0 )],
151+ Tuple [Annotated [StrictFloat , Field (gt = 0 )], Annotated [StrictFloat , Field (gt = 0 )]],
152+ ] = None ,
153+ _request_auth : Optional [Dict [StrictStr , Any ]] = None ,
154+ _content_type : Optional [StrictStr ] = None ,
155+ _headers : Optional [Dict [StrictStr , Any ]] = None ,
156+ _host_index : Annotated [StrictInt , Field (ge = 0 , le = 0 )] = 0 ,
157+ ) -> object :
158+ """Remove a user from a group."""
159+ return await self ._api .remove_user_from_group (
160+ group_id ,
161+ user_id ,
162+ _request_timeout = _request_timeout ,
163+ _request_auth = _request_auth ,
164+ _content_type = _content_type ,
165+ _headers = _headers ,
166+ _host_index = _host_index ,
167+ )
168+
169+ async def add_users_to_group (
170+ self ,
171+ group_id : StrictStr ,
172+ request_body : List [StrictStr ],
173+ _request_timeout : Union [
174+ None ,
175+ Annotated [StrictFloat , Field (gt = 0 )],
176+ Tuple [Annotated [StrictFloat , Field (gt = 0 )], Annotated [StrictFloat , Field (gt = 0 )]],
177+ ] = None ,
178+ _request_auth : Optional [Dict [StrictStr , Any ]] = None ,
179+ _content_type : Optional [StrictStr ] = None ,
180+ _headers : Optional [Dict [StrictStr , Any ]] = None ,
181+ _host_index : Annotated [StrictInt , Field (ge = 0 , le = 0 )] = 0 ,
182+ ) -> None :
183+ """Add multiple users to a group."""
184+ await self ._api .add_users_to_group (
185+ group_id ,
186+ request_body ,
187+ _request_timeout = _request_timeout ,
188+ _request_auth = _request_auth ,
189+ _content_type = _content_type ,
190+ _headers = _headers ,
191+ _host_index = _host_index ,
192+ )
193+
194+ async def remove_users_from_group (
195+ self ,
196+ group_id : StrictStr ,
197+ request_body : List [StrictStr ],
198+ _request_timeout : Union [
199+ None ,
200+ Annotated [StrictFloat , Field (gt = 0 )],
201+ Tuple [Annotated [StrictFloat , Field (gt = 0 )], Annotated [StrictFloat , Field (gt = 0 )]],
202+ ] = None ,
203+ _request_auth : Optional [Dict [StrictStr , Any ]] = None ,
204+ _content_type : Optional [StrictStr ] = None ,
205+ _headers : Optional [Dict [StrictStr , Any ]] = None ,
206+ _host_index : Annotated [StrictInt , Field (ge = 0 , le = 0 )] = 0 ,
207+ ) -> None :
208+ """Remove multiple users from a group."""
209+ await self ._api .remove_users_from_group (
210+ group_id ,
211+ request_body ,
212+ _request_timeout = _request_timeout ,
213+ _request_auth = _request_auth ,
214+ _content_type = _content_type ,
215+ _headers = _headers ,
216+ _host_index = _host_index ,
217+ )
218+
219+ async def get_users_in_group (
220+ self ,
221+ id : StrictStr ,
222+ _request_timeout : Union [
223+ None ,
224+ Annotated [StrictFloat , Field (gt = 0 )],
225+ Tuple [Annotated [StrictFloat , Field (gt = 0 )], Annotated [StrictFloat , Field (gt = 0 )]],
226+ ] = None ,
227+ _request_auth : Optional [Dict [StrictStr , Any ]] = None ,
228+ _content_type : Optional [StrictStr ] = None ,
229+ _headers : Optional [Dict [StrictStr , Any ]] = None ,
230+ _host_index : Annotated [StrictInt , Field (ge = 0 , le = 0 )] = 0 ,
231+ ) -> object :
232+ """Get users in a group."""
233+ return await self ._api .get_users_in_group (
234+ id ,
235+ _request_timeout = _request_timeout ,
236+ _request_auth = _request_auth ,
237+ _content_type = _content_type ,
238+ _headers = _headers ,
239+ _host_index = _host_index ,
240+ )
241+
242+ async def get_granted_permissions1 (
243+ self ,
244+ group_id : StrictStr ,
245+ _request_timeout : Union [
246+ None ,
247+ Annotated [StrictFloat , Field (gt = 0 )],
248+ Tuple [Annotated [StrictFloat , Field (gt = 0 )], Annotated [StrictFloat , Field (gt = 0 )]],
249+ ] = None ,
250+ _request_auth : Optional [Dict [StrictStr , Any ]] = None ,
251+ _content_type : Optional [StrictStr ] = None ,
252+ _headers : Optional [Dict [StrictStr , Any ]] = None ,
253+ _host_index : Annotated [StrictInt , Field (ge = 0 , le = 0 )] = 0 ,
254+ ) -> GrantedAccessResponseAdapter :
255+ """Get granted permissions for a group."""
256+ result = await self ._api .get_granted_permissions1 (
257+ group_id ,
258+ _request_timeout = _request_timeout ,
259+ _request_auth = _request_auth ,
260+ _content_type = _content_type ,
261+ _headers = _headers ,
262+ _host_index = _host_index ,
263+ )
264+ return convert_to_adapter (result , GrantedAccessResponseAdapter )
0 commit comments